/* =====================================================================
   FuturesBot — light trading terminal UI
   Indian-broker style (white canvas, green/red P&L) + iOS-style glass,
   rounded cards and segmented controls.
   ===================================================================== */
:root {
  --bg: #f4f5f8;
  --bg-2: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef3;
  --line: rgba(15, 23, 42, .07);
  --line-2: rgba(15, 23, 42, .12);
  --text: #0b1220;
  --muted: #5b6577;
  --dim: #8a93a3;
  --accent: #3b6cf6;
  --accent-2: #5b8cff;
  --accent-soft: rgba(59, 108, 246, .1);
  --up: #00b386;
  --up-soft: rgba(0, 179, 134, .1);
  --down: #eb5b3c;
  --down-soft: rgba(235, 91, 60, .1);
  --warn: #e8930c;
  --warn-soft: rgba(232, 147, 12, .12);
  --info: #3b6cf6;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, .05), 0 24px 60px rgba(16, 24, 40, .14);
  --glass: rgba(255, 255, 255, .72);
  --sidebar: 252px;
  --topbar: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-emphasis-color: var(--text);
  --bs-link-color-rgb: 59, 108, 246;
  --bs-link-hover-color-rgb: 37, 84, 214;
}
* { scrollbar-width: thin; scrollbar-color: #cfd4dd transparent; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); }
body { font-size: .9rem; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "tnum" 1; letter-spacing: -.005em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #2554d6; }
code { color: var(--accent); background: var(--accent-soft); padding: .05em .4em; border-radius: 6px; }
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -.02em; }
.text-up { color: var(--up) !important; }
.text-down { color: var(--down) !important; }
.text-warn { color: var(--warn) !important; }
.text-secondary { color: var(--muted) !important; }
.tiny { font-size: .74rem; }
.hint { font-size: .72rem; color: var(--muted); min-height: 1em; margin-top: 2px; }

/* ---------------- app shell ---------------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 1040;
  background: rgba(255, 255, 255, .82); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .35s var(--ease);
}
.brand { display: flex; align-items: center; gap: .7rem; height: var(--topbar); padding: 0 1.25rem; color: var(--text); font-weight: 700; font-size: 1.08rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b8cff, #3b6cf6 55%, #2a4fd8); box-shadow: 0 6px 16px rgba(59, 108, 246, .32); }
.brand-mark.big { width: 68px; height: 68px; border-radius: 20px; font-size: 1.9rem; }
.side-nav { flex: 1; overflow-y: auto; padding: .4rem .75rem 1rem; }
.side-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: 1.1rem .65rem .35rem; font-weight: 650; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .75rem; border-radius: 12px; color: var(--muted); font-weight: 550;
  border: 0; background: none; text-align: left; position: relative; transition: background .2s var(--ease), color .2s var(--ease); }
.side-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.side-link:hover { color: var(--text); background: rgba(15, 23, 42, .04); }
.side-link.active { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.side-link.active i { color: var(--accent); }
.side-foot { border-top: 1px solid var(--line); padding: .85rem 1.25rem; display: grid; gap: .4rem; }
.side-status { display: flex; align-items: center; gap: .5rem; font-size: .76rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.dot.on { background: var(--up); box-shadow: 0 0 0 3px rgba(0, 179, 134, .18); }
.dot.off { background: var(--down); box-shadow: 0 0 0 3px rgba(235, 91, 60, .18); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(232, 147, 12, .18); }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar); display: flex; align-items: center; gap: .9rem; padding: 0 1.5rem;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.25rem; font-weight: 750; margin: 0; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.main, .content, .terminal > *, .term-grid > *, .settings-layout > * { min-width: 0; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.top-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; font-size: 1.15rem; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn:active { transform: scale(.94); }
.avatar { font-weight: 700; font-size: .9rem; color: #fff; border: 0; background: linear-gradient(135deg, #5b8cff, #3b6cf6); }
.content { padding: 1.4rem 1.5rem 2.2rem; flex: 1; }
.global-alerts:empty { display: none; }
.global-alerts { padding: .9rem 1.5rem 0; display: grid; gap: .5rem; }
.g-alert { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-radius: 14px; font-size: .84rem; border: 1px solid; }
.g-alert.err { background: #fff3f0; border-color: rgba(235, 91, 60, .25); color: #b5381c; }
.g-alert.warn { background: #fff8eb; border-color: rgba(232, 147, 12, .28); color: #95600a; }
.g-alert a { color: inherit; text-decoration: underline; font-weight: 650; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 650; letter-spacing: .02em; padding: .4rem .7rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; box-shadow: var(--shadow-sm); }
.pill .dot { width: 7px; height: 7px; }
.mode-pill.PAPER { color: var(--muted); }
.mode-pill.TESTNET { color: var(--accent); border-color: rgba(59, 108, 246, .25); background: var(--accent-soft); }
.mode-pill.LIVE { color: #fff; background: linear-gradient(135deg, #f26b4d, #e0442a); border-color: transparent; animation: pulse 2s infinite; }
.bot-pill.RUNNING { color: var(--up); border-color: rgba(0, 179, 134, .25); background: var(--up-soft); }
.bot-pill.PAUSED { color: var(--warn); border-color: rgba(232, 147, 12, .3); background: var(--warn-soft); }
.bot-pill.ERROR { color: var(--down); border-color: rgba(235, 91, 60, .3); background: var(--down-soft); }
.worker-pill.on { color: var(--up); }
.worker-pill.off { color: var(--down); border-color: rgba(235, 91, 60, .3); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(235, 91, 60, .4); } 50% { box-shadow: 0 0 0 6px rgba(235, 91, 60, 0); } }

/* buttons */
.btn { border-radius: 12px; font-weight: 600; font-size: .85rem; transition: transform .15s var(--ease), filter .15s, background .15s; }
.btn:active { transform: scale(.97); }
.btn-accent { background: var(--accent); color: #fff; border: 0; box-shadow: 0 4px 14px rgba(59, 108, 246, .28); }
.btn-accent:hover, .btn-accent:focus { color: #fff; background: #2f5fe8; }
.btn-accent:disabled { opacity: .45; color: #fff; background: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-2); }
.btn-emergency { color: #95600a; border: 1px solid rgba(232, 147, 12, .35); background: #fff8eb; }
.btn-emergency:hover { background: #ffefd0; color: #7a4e06; }
.btn-danger-solid { background: var(--down); color: #fff; border: 0; box-shadow: 0 4px 14px rgba(235, 91, 60, .28); }
.btn-danger-solid:hover, .btn-danger-solid:focus { color: #fff; filter: brightness(.95); }
.btn-danger-solid:disabled { opacity: .45; color: #fff; }
.btn-long { background: var(--up); color: #fff; border: 0; font-weight: 750; padding: .75rem; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 179, 134, .28); }
.btn-long:hover, .btn-long:focus { color: #fff; filter: brightness(.96); }
.btn-short { background: var(--down); color: #fff; border: 0; font-weight: 750; padding: .75rem; border-radius: 14px; box-shadow: 0 6px 18px rgba(235, 91, 60, .28); }
.btn-short:hover, .btn-short:focus { color: #fff; filter: brightness(.96); }
.btn-xs { padding: .18rem .55rem; font-size: .72rem; border-radius: 8px; }
.btn-outline-danger { --bs-btn-color: var(--down); --bs-btn-border-color: rgba(235, 91, 60, .4); --bs-btn-hover-bg: var(--down); --bs-btn-hover-border-color: var(--down); }
.btn-outline-secondary { --bs-btn-color: var(--muted); --bs-btn-border-color: var(--line-2); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--line-2); }
.top-right .btn { white-space: nowrap; }
.top-right .btn-emergency, .top-right .btn-danger-solid { height: 36px; display: inline-flex; align-items: center; gap: .3rem; }

/* segmented control (iOS) + tabs */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-3); border: 0; }
.seg button { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: .8rem; padding: .4rem .85rem; border-radius: 9px; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 1px rgba(16, 24, 40, .04); }
.seg-sm button { padding: .26rem .62rem; font-size: .74rem; }
.seg-lg button { padding: .58rem 1.2rem; font-size: .88rem; }
.seg.w-100 { display: flex; }
.seg.w-100 button { flex: 1; }
#mode-group button[data-mode="LIVE"].active { background: var(--down); color: #fff; }
#mode-group button[data-mode="TESTNET"].active { background: var(--accent); color: #fff; }
.tabs-x { display: flex; gap: .25rem; overflow-x: auto; }
.tabs-x button { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: .84rem; padding: .45rem .85rem; border-radius: 999px; white-space: nowrap; }
.tabs-x button.active { color: var(--accent); background: var(--accent-soft); }
.badge-soft { display: inline-block; font-size: .68rem; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-3); color: var(--muted); margin-left: .25rem; }

/* cards */
.card-x { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card-x-h { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; font-weight: 700; font-size: .95rem; letter-spacing: -.015em; flex-wrap: wrap; }
.card-x-h i { color: var(--accent); margin-right: .3rem; }
.chart-box { position: relative; height: 270px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: .85rem; text-align: center; padding: 1rem; }
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state i { font-size: 3rem; color: #c3c9d4; }
.empty-row { text-align: center; color: var(--dim) !important; padding: 1.8rem .5rem !important; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .85rem; }
.kpi-grid.kpi-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.kpi-grid.kpi-6 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem; position: relative; overflow: hidden; min-width: 0;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 24, 40, .04), 0 14px 32px rgba(16, 24, 40, .09); }
.kpi .k { font-size: .74rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k i { margin-right: .25rem; color: var(--dim); }
.kpi .v { font-size: 1.45rem; font-weight: 750; margin-top: .3rem; font-family: var(--font); letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .v.small-v { font-size: .98rem; }
.kpi .s { font-size: .74rem; color: var(--dim); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-bot .v { font-family: var(--font); }

/* forms */
.form-label { font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: .3rem; }
.form-control, .form-select, .input-group-text { background-color: var(--surface-2); border-color: var(--line-2); color: var(--text); border-radius: 12px; }
.input-group > .form-control, .input-group > .btn, .input-group > .input-group-text { border-radius: 12px; }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group-text { color: var(--muted); font-size: .78rem; }
.form-control:focus, .form-select:focus { background-color: var(--surface); color: var(--text); border-color: rgba(59, 108, 246, .55); box-shadow: 0 0 0 4px rgba(59, 108, 246, .12); }
.form-control::placeholder { color: var(--dim); }
.form-control:disabled { background: var(--surface-3); }
.form-text { color: var(--dim); font-size: .74rem; }
.form-range::-webkit-slider-thumb { background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.form-range::-moz-range-thumb { background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.form-range::-webkit-slider-runnable-track { background: var(--surface-3); }
.form-check-input { background-color: #e5e7ec; border-color: transparent; }
.form-switch .form-check-input { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3.2' fill='%23fff'/%3e%3c/svg%3e"); }
.form-check-input:checked { background-color: #34c759; border-color: #34c759; }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(52, 199, 89, .15); border-color: transparent; }
.big-switch .form-check-input { width: 3.6em; height: 1.95em; cursor: pointer; }
#live-switch:checked { background-color: var(--down); border-color: var(--down); }
.warn-text { font-size: .74rem; color: var(--warn); margin-top: .25rem; }
.warn-text::before { content: "⚠ "; }
.is-warn { border-color: rgba(232, 147, 12, .6) !important; }
.search-x { position: relative; min-width: 220px; }
.search-x i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search-x .form-control { padding-left: 2.2rem; border-radius: 999px; }
.search-x.sm { min-width: 180px; }
.code-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .95rem; font-family: var(--mono); font-size: .78rem; color: #334155; white-space: pre-wrap; word-break: break-all; }

/* tables */
.table-x { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: rgba(59, 108, 246, .035); --bs-table-hover-color: var(--text); --bs-table-border-color: var(--line); font-size: .84rem; margin: 0; }
.table-x th { color: var(--dim); font-weight: 600; font-size: .72rem; letter-spacing: .01em; white-space: nowrap; border-bottom-color: var(--line); padding: .6rem .65rem; background: transparent; }
.table-x td { white-space: nowrap; padding: .7rem .65rem; vertical-align: middle; }
.table-x td.num { font-family: var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x th[data-sort] { cursor: pointer; }
.table-x th[data-sort]:hover { color: var(--text); }
.side-LONG, .table-x td.side-LONG { color: var(--up); font-weight: 700; }
.side-SHORT, .table-x td.side-SHORT { color: var(--down); font-weight: 700; }
.res { display: inline-block; font-size: .7rem; font-weight: 700; padding: .18rem .55rem; border-radius: 999px; }
.res-WIN { background: var(--up-soft); color: var(--up); }
.res-LOSS { background: var(--down-soft); color: var(--down); }
.res-BREAKEVEN { background: var(--surface-3); color: var(--muted); }
.src { font-size: .62rem; font-weight: 700; letter-spacing: .04em; padding: .12rem .45rem; border-radius: 999px; background: var(--surface-3); color: var(--muted); vertical-align: middle; }
.src-BOT { color: #7c4ddb; background: rgba(124, 77, 219, .1); }
.src-MANUAL { color: var(--accent); background: var(--accent-soft); }
.src-GRID { color: var(--up); background: var(--up-soft); }
.src-GRID-END { color: var(--down); background: var(--down-soft); }
.side-GRID, .table-x td.side-GRID { color: var(--muted); font-weight: 700; }
.act-btns { text-align: right; }
.act-btns .btn { padding: .2rem .55rem; font-size: .72rem; border-radius: 8px; margin-left: .15rem; }
.sym-link { color: var(--text); font-weight: 650; }
.sym-link:hover { color: var(--accent); }
.fav-star { border: 0; background: none; color: #c3c9d4; font-size: 1rem; padding: 0 .2rem; }
.fav-star.on, .fav-star:hover { color: #f5a623; }

@media (max-width: 767.98px) {
  .t-cards thead { display: none; }
  .t-cards tr { display: block; border: 1px solid var(--line); border-radius: 16px; margin-bottom: .6rem; padding: .55rem .8rem; background: var(--surface); box-shadow: var(--shadow-sm); }
  .t-cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important; padding: .22rem 0 !important; white-space: normal; text-align: right !important; }
  .t-cards td::before { content: attr(data-l); color: var(--dim); font-size: .72rem; text-align: left; }
  .t-cards td.act-btns { justify-content: flex-end; flex-wrap: wrap; gap: .3rem; padding-top: .5rem !important; }
  .t-cards td.act-btns::before, .t-cards td.empty-row::before { content: none; }
  .t-cards td.empty-row { justify-content: center; }
  .t-cards td.d-none { display: none !important; }
}

/* activity feed */
.activity { list-style: none; padding: 0; margin: 0; max-height: 380px; overflow-y: auto; font-size: .8rem; }
[data-tall] .activity { max-height: 640px; }
.activity li { display: grid; grid-template-columns: 62px 10px auto 1fr; align-items: baseline; gap: .55rem; padding: .45rem .2rem; border-bottom: 1px solid var(--line); }
.activity time { color: var(--dim); font-family: var(--mono); font-size: .74rem; }
.activity .lv { width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.activity .sym { font-weight: 650; color: var(--text); }
.activity .msg { color: #3c4657; overflow-wrap: anywhere; }
.lv { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.lv-INFO, .lv-ok.info { background: var(--info); }
.lv-SUCCESS, .lv-ok { background: var(--up); }
.lv-WARNING, .lv-warn { background: var(--warn); }
.lv-ERROR, .lv-fail { background: var(--down); }
.activity li[hidden] { display: none; }
.min-w-0 { min-width: 0; }
.activity li.l-ERROR .msg { color: #c13d20; }
.activity li.l-WARNING .msg { color: #95600a; }
.activity li.l-SUCCESS .msg { color: #00865f; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); margin-left: .3rem; animation: blink 1.6s infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: .25; } }

/* key/value */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1.2rem; font-size: .83rem; }
.kv.kv-1 { grid-template-columns: 1fr; }
.kv div { display: flex; justify-content: space-between; gap: .6rem; border-bottom: 1px solid var(--line); padding: .4rem 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 650; text-align: right; }

/* ---------------- symbol picker ---------------- */
.global-search { position: relative; width: min(420px, 38vw); }
.global-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--dim); z-index: 2; }
.global-search .form-control { padding-left: 2.3rem; background: rgba(118, 118, 128, .1); border-color: transparent; height: 38px; border-radius: 999px; }
.global-search .form-control:focus { background: var(--surface); }
.picker-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 1060; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; padding: .4rem; }
.picker-menu.show { display: block; animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.picker-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: .5rem .65rem .25rem; font-weight: 700; }
.picker-item { display: flex; align-items: center; gap: .55rem; width: 100%; border: 0; background: none; color: var(--text); padding: .5rem .65rem; border-radius: 10px; text-align: left; font-size: .86rem; }
.picker-item:hover, .picker-item.hl { background: var(--accent-soft); }
.picker-item b { font-weight: 650; }
.picker-item small { color: var(--dim); }
.picker-item .tag { margin-left: auto; font-size: .62rem; font-weight: 700; color: #7c4ddb; background: rgba(124, 77, 219, .1); padding: .1rem .4rem; border-radius: 999px; }
.picker-item .star { color: #f5a623; }
.picker-empty { padding: .9rem; color: var(--muted); font-size: .82rem; text-align: center; }

/* ---------------- trade terminal ---------------- */
.terminal { display: grid; gap: .85rem; }
.ticker-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.5rem; padding: .8rem 1.1rem; }
.sym-picker { position: relative; }
.sym-btn { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 14px; padding: .4rem .85rem .4rem .45rem; }
.sym-btn:hover { border-color: var(--line-2); }
.sym-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #5b8cff, #3b6cf6); font-size: .85rem; }
.sym-name { display: block; font-weight: 750; font-size: 1.05rem; line-height: 1.1; letter-spacing: -.02em; }
.sym-sub { display: block; font-size: .7rem; color: var(--muted); }
.picker-panel { display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 1060; width: 360px; max-width: calc(100vw - 2rem);
  background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: .65rem; }
.picker-panel.show { display: block; animation: pop .18s var(--ease); }
.picker-panel .picker-menu { display: block; position: static; box-shadow: none; border: 0; padding: 0; max-height: 380px; background: none; backdrop-filter: none; animation: none; }
.picker-search { position: relative; margin-bottom: .45rem; }
.picker-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--dim); }
.picker-search .form-control { padding-left: 2.2rem; border-radius: 999px; }
.fav-btn { border: 1px solid var(--line); background: var(--surface); color: #c3c9d4; border-radius: 12px; width: 38px; height: 38px; font-size: 1.05rem; }
.fav-btn.on { color: #f5a623; border-color: rgba(245, 166, 35, .4); }
.tick-price .px { font-size: 1.6rem; font-weight: 750; letter-spacing: -.035em; transition: color .25s; font-variant-numeric: tabular-nums; }
.tick-stat { display: flex; flex-direction: column; gap: .1rem; }
.tick-stat span { font-size: .7rem; color: var(--dim); font-weight: 600; }
.tick-stat b { font-size: .9rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tf-group { display: flex; gap: 2px; background: var(--surface-3); border: 0; border-radius: 12px; padding: 3px; }
.tf-group button { border: 0; background: none; color: var(--muted); font-size: .76rem; font-weight: 600; padding: .32rem .6rem; border-radius: 9px; }
.tf-group button:hover { color: var(--text); }
.tf-group button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.term-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "chart order" "bottom bottom"; gap: .85rem; }
.term-chart { grid-area: chart; overflow: hidden; }
.term-order { grid-area: order; }
.term-bottom { grid-area: bottom; }
.tv-chart { height: 560px; border-radius: 14px; overflow: hidden; }
.acct-mini { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; }
.acct-mini span { display: block; font-size: .68rem; color: var(--dim); font-weight: 600; }
.acct-mini b { font-size: .9rem; font-variant-numeric: tabular-nums; }
.pct-chips { display: flex; gap: .3rem; }
.pct-chips button { flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .72rem; border-radius: 999px; padding: .2rem 0; font-weight: 600; }
.pct-chips button:hover { color: var(--accent); border-color: rgba(59, 108, 246, .35); background: var(--accent-soft); }
.order-sum { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .65rem .8rem; margin-top: .6rem; font-size: .8rem; }
.order-sum span { display: block; color: var(--dim); font-size: .68rem; }
.order-summary { width: 100%; font-size: .9rem; }
.order-summary td { padding: .38rem 0; border-bottom: 1px solid var(--line); }
.order-summary td:last-child { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.live-warning { background: #fff3f0; border: 1px solid rgba(235, 91, 60, .3); color: #b5381c; border-radius: 14px; padding: .6rem .8rem; font-size: .85rem; }

/* ---------------- markets ---------------- */
.markets-wrap { max-height: calc(100vh - 230px); overflow-y: auto; }
.markets-wrap thead th { position: sticky; top: 0; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); z-index: 2; }

/* ---------------- bot page ---------------- */
.bot-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; align-items: center; padding: 1.4rem 1.5rem;
  background: radial-gradient(500px 220px at 0% 0%, rgba(59, 108, 246, .08), transparent 70%), radial-gradient(400px 200px at 100% 100%, rgba(0, 179, 134, .07), transparent 70%), var(--surface); }
.bot-hero-main { display: flex; align-items: center; gap: 1.1rem; }
.bot-orb { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 1.9rem; background: var(--surface-3); color: var(--dim); transition: all .35s var(--ease); }
.bot-orb.RUNNING { background: linear-gradient(135deg, #2fd6a8, #00b386); color: #fff; box-shadow: 0 0 0 6px rgba(0, 179, 134, .12), 0 12px 30px rgba(0, 179, 134, .3); }
.bot-orb.PAUSED { background: var(--warn-soft); color: var(--warn); }
.bot-orb.ERROR { background: var(--down-soft); color: var(--down); }
.bot-state { font-size: 1.8rem; font-weight: 800; letter-spacing: -.035em; }
.add-pair { display: flex; gap: .5rem; }
.add-pair .global-search { width: auto; }
.ovr-input { width: 76px; padding: .22rem .5rem; font-size: .78rem; border-radius: 8px; }

/* ---------------- settings ---------------- */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.settings-tabs { position: sticky; top: calc(var(--topbar) + 1rem); display: grid; gap: .15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem; box-shadow: var(--shadow); }
.settings-tabs a { display: flex; align-items: center; gap: .65rem; padding: .58rem .8rem; border-radius: 12px; color: var(--muted); font-weight: 550; }
.settings-tabs a:hover { color: var(--text); background: rgba(15, 23, 42, .04); }
.settings-tabs a.active { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.settings-tabs a.active i { color: var(--accent); }
.form-section + .form-section { margin-top: 1.4rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.form-section-h { font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: .8rem; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem .9rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); height: 100%; }
.switch-row.locked { opacity: .85; }
.switch-row .form-check-input { width: 2.75em; height: 1.55em; cursor: pointer; }
.save-row { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.2rem -1.2rem -1.1rem; padding: .85rem 1.2rem;
  background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.save-row:only-child, .save-row:first-child { margin-top: 0; }
.env-badge { font-size: .66rem; font-weight: 800; letter-spacing: .04em; padding: .16rem .5rem; border-radius: 999px; margin-right: .3rem; }
.env-badge.TESTNET { background: var(--accent-soft); color: var(--accent); }
.env-badge.LIVE { background: var(--down-soft); color: var(--down); }
.conn-result .ok { color: var(--up); font-weight: 700; }
.conn-result .bad { color: var(--down); font-weight: 700; }
.live-card.on { border-color: rgba(235, 91, 60, .35); background: linear-gradient(90deg, #fff3f0, transparent 60%), var(--surface); }

/* status page */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.status-item { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.status-item > i { font-size: 1.25rem; color: var(--dim); }
.status-item .nm { font-weight: 650; }
.status-item .dt { font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; }
.status-item .st { margin-left: auto; font-size: .72rem; font-weight: 700; white-space: nowrap; }

/* modals / toasts (iOS sheet look) */
.modal-backdrop.show { opacity: .25; }
.modal-content { background: rgba(255, 255, 255, .96); backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-weight: 700; letter-spacing: -.02em; }
.live-head { background: linear-gradient(90deg, #fff0ec, transparent); color: #b5381c; border-radius: 24px 24px 0 0; }
.checklist { list-style: none; padding: 0; margin: 0 0 .9rem; font-size: .86rem; }
.checklist li { display: flex; gap: .55rem; align-items: center; padding: .42rem 0; border-bottom: 1px solid var(--line); }
.checklist .detail { color: var(--muted); margin-left: auto; text-align: right; font-size: .76rem; max-width: 60%; }
.result-card .big-icon { font-size: 3rem; line-height: 1; }
.toast-container { bottom: 0; right: 0; z-index: 1090; }
.toast { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.toast.t-ok { border-left: 4px solid var(--up); }
.toast.t-err { border-left: 4px solid var(--down); }
.toast.t-warn { border-left: 4px solid var(--warn); }
.dropdown-menu { background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: .4rem; }
.dropdown-item { color: var(--text); border-radius: 10px; padding: .45rem .7rem; }
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent); }
.alert { border-radius: 14px; }
.alert-warning { background: #fff8eb; border-color: rgba(232, 147, 12, .28); color: #95600a; }
.alert-danger { background: #fff3f0; border-color: rgba(235, 91, 60, .25); color: #b5381c; }
.alert-success { background: #ebfaf5; border-color: rgba(0, 179, 134, .25); color: #00704f; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; align-items: end; }

/* ---------------- auth ---------------- */
.auth-page { min-height: 100vh; background: radial-gradient(900px 500px at 10% 0%, rgba(59, 108, 246, .1), transparent 60%), radial-gradient(800px 500px at 100% 100%, rgba(0, 179, 134, .08), transparent 60%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 4rem; padding: 16px; }
.auth-hero { max-width: 380px; }
.hero-points { list-style: none; padding: 0; display: grid; gap: .75rem; color: var(--muted); }
.hero-points i { color: var(--up); margin-right: .5rem; }
.auth-card { width: 100%; max-width: 410px; background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--line);
  border-radius: 28px; padding: 2.1rem 1.7rem; box-shadow: var(--shadow-lg); }
.auth-card.wide { max-width: 540px; }
.setup-steps { display: flex; gap: .35rem; }
.setup-steps span { flex: 1; text-align: center; font-size: .74rem; padding: .38rem; border-radius: 999px; background: var(--surface-3); color: var(--dim); font-weight: 600; }
.setup-steps span.on { background: var(--accent-soft); color: var(--accent); }

/* ---------------- bottom nav (mobile, iOS tab bar) ---------------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .45rem; font-size: .66rem; color: var(--dim); font-weight: 600; }
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--accent); }

/* ---------------- responsive ---------------- */
@media (max-width: 1399.98px) {
  .term-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); background: rgba(255, 255, 255, .96); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; z-index: 1039; background: rgba(15, 23, 42, .25); backdrop-filter: blur(2px); }
  .main { margin-left: 0; }
  .content { padding-bottom: 5.5rem; }
  .toast-container { bottom: 4.5rem !important; }
  .term-grid { grid-template-columns: 1fr; grid-template-areas: "chart" "order" "bottom"; }
  .tv-chart { height: 460px; }
  .bot-hero { grid-template-columns: 1fr; }
}
@media (max-width: 991.98px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; display: flex; overflow-x: auto; gap: .3rem; }
  .settings-tabs a { white-space: nowrap; }
}
@media (max-width: 767.98px) {
  .topbar { padding: 0 .9rem; gap: .5rem; }
  .content { padding: 1rem 1rem 5.5rem; }
  .global-alerts { padding: .7rem 1rem 0; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { border-radius: 18px; }
  .kpi .v { font-size: 1.12rem; }
  .card-x { padding: .95rem .9rem; border-radius: 18px; }
  .tv-chart { height: 360px; }
  .ticker-bar { gap: .55rem 1rem; }
  .tf-group { width: 100%; justify-content: space-between; }
  .page-title { font-size: 1.1rem; }
  .add-pair { flex-direction: column; }
  .bot-state { font-size: 1.4rem; }
  .save-row { flex-direction: column; align-items: stretch; }
  .auth-wrap { gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.fx-pill { color: var(--text); font-variant-numeric: tabular-nums; }
#t-inr { color: var(--dim); margin-left: .35rem; }

/* ---------------- position cards (big live PNL + expected ₹ at every target) ---------------- */
.kpi .v { font-size: 1.6rem; }
.pos-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.pos-summary > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: .7rem .9rem; }
.pos-summary > div.warn { background: #fff3f0; border-color: rgba(235, 91, 60, .25); }
.pos-summary span { display: block; font-size: .74rem; color: var(--muted); font-weight: 600; }
.pos-summary b { display: block; font-size: 1.45rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: .9rem; }
.pos-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1rem 1.1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pos-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--up); }
.pos-card.is-short::before { background: var(--down); }
.pos-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.pos-id { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pos-id .sym-link { font-size: 1.15rem; font-weight: 750; letter-spacing: -.02em; }
.pos-id .sym-link small { color: var(--dim); font-weight: 500; font-size: .75rem; }
.pos-side { font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; background: var(--up-soft); }
.pos-side.side-SHORT { background: var(--down-soft); }
.pos-dur { font-size: .74rem; color: var(--dim); white-space: nowrap; }
.pos-pnl { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: .7rem 0 .6rem; flex-wrap: wrap; }
.pos-pnl-v { font-size: 2.1rem; font-weight: 800; letter-spacing: -.045em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pos-pnl-s { font-size: .85rem; font-weight: 650; margin-top: .15rem; }
.pos-outcomes { display: grid; gap: .15rem; text-align: right; }
.pos-outcomes div { display: flex; justify-content: flex-end; gap: .6rem; align-items: baseline; }
.pos-outcomes span { font-size: .72rem; color: var(--muted); }
.pos-outcomes b { font-size: 1rem; font-weight: 750; font-variant-numeric: tabular-nums; min-width: 92px; }
.pos-bar { position: relative; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--down-soft), var(--surface-3) 45%, var(--up-soft)); margin-top: .3rem; }
.pos-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; opacity: .35; }
.pos-bar-fill.up { background: var(--up); }
.pos-bar-fill.down { background: var(--down); }
.pos-bar-entry { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); border-radius: 2px; transform: translateX(-1px); }
.pos-bar-now { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: left .6s var(--ease); }
.pos-bar-l { display: flex; justify-content: space-between; font-size: .66rem; color: var(--dim); margin-top: .25rem; font-weight: 600; }
.pos-hint { font-size: .8rem; color: var(--muted); margin-top: .45rem; }
.pos-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .9rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.pos-stats span { display: block; font-size: .7rem; color: var(--dim); font-weight: 600; }
.pos-stats b { font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.pos-ladder { margin-top: .75rem; background: var(--surface-2); border-radius: 14px; padding: .55rem .75rem; }
.pos-ladder summary { cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--muted); list-style: none; }
.pos-ladder summary::-webkit-details-marker { display: none; }
.pos-ladder summary::before { content: "▸ "; }
.pos-ladder[open] summary::before { content: "▾ "; }
.pos-ladder summary small { font-weight: 500; color: var(--dim); }
.lv-row { display: grid; grid-template-columns: 58px 1fr auto; gap: .5rem; align-items: baseline; padding: .42rem 0; border-top: 1px solid var(--line); font-size: .86rem; }
.pos-ladder summary + .lv-row { margin-top: .4rem; }
.lv-name { font-weight: 750; font-size: .74rem; }
.lv-row.sl .lv-name { color: var(--down); }
.lv-row.tp .lv-name { color: var(--up); }
.lv-row.rest .lv-name, .lv-row.booked .lv-name { color: var(--muted); }
.lv-px { font-variant-numeric: tabular-nums; min-width: 0; }
.lv-px em { font-style: normal; color: var(--dim); font-size: .76rem; }
.lv-row b { font-size: 1.02rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.pos-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; margin-top: .8rem; }
.pos-actions:empty { display: none; }
.pos-grid.compact .pos-card { padding: .9rem 1rem; }
.pos-grid.compact .pos-pnl-v { font-size: 1.8rem; }

/* trade form: profit at TP */
.order-sum .sum-big b { font-size: 1.05rem; font-weight: 750; }

/* analytics insights */
.insight-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.insight-list li { padding: .65rem .85rem .65rem 2.2rem; border-radius: 14px; background: var(--surface-2); position: relative; font-size: .88rem; line-height: 1.45; }
.insight-list li::before { position: absolute; left: .85rem; top: .62rem; font-weight: 800; }
.insight-list li.ins-up { background: #ebfaf5; } .insight-list li.ins-up::before { content: "✓"; color: var(--up); }
.insight-list li.ins-down { background: #fff3f0; } .insight-list li.ins-down::before { content: "!"; color: var(--down); }
.insight-list li.ins-info::before { content: "i"; color: var(--accent); }

@media (max-width: 767.98px) {
  .pos-grid { grid-template-columns: 1fr; }
  .pos-pnl-v { font-size: 1.9rem; }
  .pos-outcomes { text-align: left; width: 100%; }
  .pos-outcomes div { justify-content: space-between; }
  .pos-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-summary b { font-size: 1.2rem; }
  .kpi .v { font-size: 1.2rem; }
}
/* ---------------- Strategy Lab ---------------- */
.strat-hero { display: flex; justify-content: space-between; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  background: radial-gradient(500px 200px at 0% 0%, rgba(59, 108, 246, .08), transparent 70%), var(--surface); }
.strat-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em; }
.strat-pick { max-width: 100%; }
.cap-num { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.cap-num span { font-size: 1rem; color: var(--dim); font-weight: 600; }
.cap-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: .4rem; }
.cap-bar > div { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #5b8cff, var(--accent)); transition: width .6s var(--ease); }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.h-item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border-radius: 12px; background: var(--surface-2); }
.h-item .dot { margin-top: .35rem; }
.h-item b { display: block; font-size: .82rem; }
.h-item small { color: var(--muted); font-size: .74rem; }
.q-badge { display: inline-block; min-width: 2.2rem; text-align: center; font-weight: 750; font-size: .78rem; padding: .12rem .45rem; border-radius: 999px; }
.q-hi { background: var(--up-soft); color: var(--up); }
.q-mid { background: var(--accent-soft); color: var(--accent); }
.q-lo { background: var(--surface-3); color: var(--muted); }
.row-dim td { opacity: .55; }
.row-key td { background: rgba(59, 108, 246, .04); }
.rank-wrap { max-height: 560px; overflow-y: auto; }
.last-scan { display: grid; gap: .25rem; margin-top: .5rem; font-size: .8rem; }
.last-scan > div { display: grid; grid-template-columns: 130px 1fr auto; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.last-scan span { color: var(--muted); overflow-wrap: anywhere; }
.last-scan small { color: var(--dim); }
@media (max-width: 767.98px) {
  .strat-name { font-size: 1.25rem; }
  .last-scan > div { grid-template-columns: 1fr; gap: .1rem; }
}

/* Trade page: bot chart bar + legend */
.chart-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.chart-legend { display: flex; gap: .7rem; flex-wrap: wrap; font-size: .72rem; color: var(--muted); font-weight: 600; }
.chart-legend::after { content: none; }
.chart-info { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; padding: .55rem .8rem; font-size: .88rem; color: var(--muted); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.chart-info:empty { display: none; }
.chart-info b { font-weight: 750; }
.ci { font-weight: 750; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.ci-up { background: var(--up-soft); color: var(--up); }
.ci-down { background: var(--down-soft); color: var(--down); }
.lg-buy::before { border-color: #00b386; border-top-style: dashed; }
.lg-sell::before { border-color: #eb5b3c; border-top-style: dashed; }
.lg::before { content: ""; display: inline-block; width: 14px; height: 0; border-top: 2px solid; margin-right: .3rem; vertical-align: middle; }
.lg-entry::before { border-color: #3b6cf6; }
.lg-sl::before { border-color: #eb5b3c; }
.lg-tp::before { border-color: #00b386; }
.lg-liq::before { border-color: #e8930c; border-top-style: dotted; }
.lg-grid::before { border-color: rgba(120, 130, 150, .7); border-top-style: dotted; }
#lw-chart { height: 560px; }
@media (max-width: 1199.98px) { #lw-chart { height: 460px; } }
@media (max-width: 767.98px) { #lw-chart { height: 360px; } }

/* Strategy Lab control panel */
.control-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; align-items: start; }
.control-grid > div { display: flex; flex-direction: column; gap: .25rem; }
.control-grid span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.control-grid b { font-size: 1.15rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.control-grid b.big { font-size: 1.8rem; }

/* Grid V4 panel */
.grid-ladder { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; font-size: .82rem; }
.gl { display: grid; grid-template-columns: 44px 1fr 1fr auto; gap: .5rem; padding: .3rem .6rem; border-radius: 8px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.gl-empty { background: var(--accent-soft); outline: 1px dashed rgba(59, 108, 246, .4); }
.gl-k { color: var(--dim); font-weight: 700; }
.gn-box { display: grid; gap: .4rem; margin: .8rem 0 .6rem; }
.gn-title { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.gn { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .8rem; padding: .55rem .8rem; border-radius: 12px; font-variant-numeric: tabular-nums; }
.gn b { font-size: 1rem; }
.gn span { font-size: .82rem; color: var(--muted); }
.gn-buy { background: var(--up-soft); } .gn-buy b { color: var(--up); }
.gn-sell { background: var(--down-soft); } .gn-sell b { color: var(--down); }
.gn-count { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .7rem; }
.gn-count div { background: var(--surface-2); border-radius: 12px; padding: .45rem .3rem; text-align: center; }
.gn-count b { display: block; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gn-count span { font-size: .7rem; color: var(--muted); }
.gn-act { display: grid; gap: .3rem; margin-top: .4rem; max-height: 260px; overflow-y: auto; }
.ga { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; align-items: baseline; font-size: .82rem; padding: .35rem .55rem; border-radius: 10px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.ga-cycle { background: var(--up-soft); }
.gn-t { color: var(--dim); font-size: .74rem; white-space: nowrap; grid-column: 1 / -1; }
.gn-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.gn-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Grid V5 ladder (Binance-style: SELL rows above the price, BUY rows below) */
.gl-row-buy { background: var(--up-soft); }
.gl-row-sell { background: var(--down-soft); }
.gl-o { font-weight: 700; white-space: nowrap; font-size: .76rem; }
.gl-buy { color: var(--up); }
.gl-sell { color: var(--down); }
.gl-mark { background: var(--accent-soft); outline: 1px dashed rgba(59, 108, 246, .45); color: var(--accent); }
.gl-stop { background: var(--surface-3); color: var(--muted); font-size: .76rem; }
.gl > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.grid-summary { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin-bottom: .7rem; }
.grid-chart { display: block; width: 100%; height: auto; margin: .7rem 0 .4rem; background: var(--surface-2); border-radius: 12px; }
.calc-out { font-size: .84rem; }
.calc-out .bad { color: var(--down); font-weight: 650; }
.calc-out .good { color: var(--up); font-weight: 650; }
@media (max-width: 575.98px) {
  .gl { grid-template-columns: 34px 1fr auto; }
  .gl > span:nth-child(3) { grid-column: 2 / -1; grid-row: 2; font-size: .74rem; }
}
/* Grid scorecard */
.sc-verdict { font-size: 1.05rem; font-weight: 700; padding: .7rem .9rem; border-radius: 12px; margin-bottom: .7rem; background: var(--surface-2); }
.sc-verdict.sc-good { background: var(--up-soft); color: var(--up); }
.sc-verdict.sc-bad { background: var(--down-soft); color: var(--down); }
.pill.sc-TOO_EARLY, .pill.sc-LOW { background: var(--down-soft); color: var(--down); }
.pill.sc-MEDIUM { background: var(--surface-3); color: var(--text); }
.pill.sc-HIGH { background: var(--up-soft); color: var(--up); }

/* Grid Bot page */
.bot-hero.gb-hero { grid-template-columns: 1fr; gap: 1rem; }
.gb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.gb-kpis div { background: var(--surface-2); border-radius: 14px; padding: .65rem .8rem; display: grid; gap: .1rem; }
.gb-kpis span { font-size: .74rem; color: var(--muted); }
.gb-kpis b { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gb-kpis small { font-size: .72rem; color: var(--dim); }
.gs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem 1.2rem; }
.gs-grid > div { display: grid; gap: .3rem; align-content: start; }
.gs-grid small { font-size: .72rem; }
.gs-grid .seg { width: 100%; }
.gs-grid .seg button { flex: 1; }
.gs-summary .kv { margin: 0; }
.gs-warn { padding-left: 1.1rem; font-size: .82rem; color: #95600a; }
.gs-warn li { margin-bottom: .2rem; }
.gs-cap { border-top: 1px dashed var(--line, rgba(127,127,127,.25)); padding-top: .9rem; }
.gs-cap .cap-head { font-size: .92rem; }
.gs-cap .cap-bind td { background: rgba(240, 185, 11, .12); }
.gs-cap .kv { margin: 0; }
.gs-fixed { background: var(--surface-2); border-radius: 12px; padding: .6rem .85rem; font-size: .88rem; }

/* ---------------- Hedge Neutral Grid: two legs side by side, P&L periods ---------------- */
.legs-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; margin: .7rem 0; }
.leg-box { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; background: var(--surface-2); }
.leg-box.leg-LONG { border-left: 4px solid var(--up); }
.leg-box.leg-SHORT { border-left: 4px solid var(--down); }
.leg-box .gn-title small { text-transform: none; font-weight: 500; letter-spacing: 0; margin-left: .3rem; }
.pnl-table td, .pnl-table th { white-space: nowrap; }
.pnl-table tr.fw-bold td { border-top: 2px solid var(--line); }

/* ---------------- Dashboard: Profit & loss cards + hedge legs live ---------------- */
.pnl-tabs { margin-bottom: .8rem; }
.pnl-tabs button { display: flex; flex-direction: column; align-items: center; gap: .1rem; line-height: 1.15; }
.pnl-tabs button b { font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pnl-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: .6rem; }
.pnl-hero > div { border-radius: 16px; padding: .8rem 1rem; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: .15rem; }
.pnl-hero .pnl-main { background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2); }
.pnl-hero span { font-size: .74rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.pnl-hero b { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pnl-hero .pnl-side b { font-size: 1.3rem; }
.pnl-hero small { font-size: .74rem; color: var(--muted); }
.pnl-hero small b { font-size: inherit; font-weight: 700; letter-spacing: 0; }
.pnl-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: .8rem 0 .35rem; gap: 2px; }
.pnl-bar i, .pnl-legend i { display: block; }
.pb-long { background: var(--up); } .pb-short { background: var(--down); } .pb-end { background: #e6a23c; } .pb-other { background: #8a93a3; }
.pnl-bar i.neg { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 3px, transparent 3px 7px); }
.pnl-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .72rem; color: var(--muted); margin-bottom: .6rem; }
.pnl-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.pnl-legend i { width: 10px; height: 10px; border-radius: 3px; }
.pnl-alert { font-size: .8rem; border-radius: 12px; padding: .55rem .75rem; margin-bottom: .6rem; background: var(--down-soft); color: var(--down); }
.pnl-alert a { color: inherit; text-decoration: underline; }
.legs-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: .4rem; align-items: stretch; }
.legs-plus { align-self: center; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--muted); background: var(--surface-3); }
.leg-card, .hl-side { border-radius: 16px; padding: .7rem .85rem; border: 1px solid var(--line); background: var(--surface-2); position: relative; overflow: hidden; }
.leg-card::before, .hl-side::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; }
.leg-long::before { background: var(--up); } .leg-short::before { background: var(--down); }
.leg-long { background: linear-gradient(160deg, var(--up-soft), transparent 55%), var(--surface-2); }
.leg-short { background: linear-gradient(160deg, var(--down-soft), transparent 55%), var(--surface-2); }
.leg-top { display: flex; justify-content: space-between; align-items: center; gap: .4rem; font-size: .74rem; }
.leg-badge { font-weight: 800; letter-spacing: .05em; }
.leg-long .leg-badge { color: var(--up); } .leg-short .leg-badge { color: var(--down); }
.leg-n { color: var(--muted); font-weight: 600; }
.leg-v { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin: .2rem 0 .1rem; font-variant-numeric: tabular-nums; }
.leg-how { font-size: .72rem; color: var(--muted); margin-bottom: .35rem; }
.leg-row { display: flex; justify-content: space-between; gap: .5rem; font-size: .78rem; padding: .2rem 0; border-top: 1px dashed var(--line); }
.leg-row span { color: var(--muted); } .leg-row b { font-variant-numeric: tabular-nums; }
.pnl-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .45rem; margin-top: .6rem; }
.pnl-mini div { border-radius: 12px; padding: .5rem .7rem; background: var(--surface-2); border: 1px solid var(--line); }
.pnl-mini span { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; }
.pnl-mini b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.hl-card { border: 1px solid var(--line); border-radius: 18px; padding: .75rem; margin-bottom: .7rem; }
.hl-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-bottom: .55rem; }
.hl-head .sym-link { font-weight: 800; font-size: 1.05rem; }
.hl-price { color: var(--muted); font-size: .8rem; margin-left: auto; }
.hl-qty { font-size: 1.1rem; font-weight: 800; margin: .25rem 0; }
.hl-qty small { font-size: .74rem; font-weight: 600; color: var(--muted); }
.hl-side .ok { color: var(--up); font-weight: 650; } .hl-side .bad { color: var(--down); font-weight: 700; } .hl-side .muted { color: var(--muted); }
.hl-foot { font-size: .74rem; color: var(--muted); margin-top: .5rem; }
@media (max-width: 575px) {
  .pnl-hero { grid-template-columns: 1fr; }
  .legs-pair { grid-template-columns: 1fr; }
  .legs-plus { justify-self: center; }
  .pnl-tabs button { padding: .35rem .4rem; font-size: .72rem; }
}
