/* ============================================================
   TradeDesk — terminal theme (dark default · light via [data-theme])
   ============================================================ */
:root {
  --bg: #000000;          /* app background — true black */
  --bg2: #0D0D0D;         /* panel background (lifted off black) */
  --bg3: #1A1A1A;         /* raised / hover */
  --line: #242424;        /* hairlines */
  --line2: #333333;       /* stronger lines */
  --fg: #ECECEC;          /* primary text — neutral near-white */
  --dim: #8A8A8A;         /* secondary text — neutral gray */
  --accent: #E8A33D;      /* brand amber */
  --up: #2EBD85;
  --down: #F0524F;
  --buy: #2EBD85;
  --sell: #F0524F;
  --shadow-color: rgba(0,0,0,0.6);    /* elevation shadow tint */
  --scrim: rgba(0, 0, 0, 0.66);       /* modal backdrop (glass over black) */
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

/* ---------- light theme ---------- */
html[data-theme="light"] {
  --bg: #F1F4F9;          /* app background — soft blue-gray, easy on the eyes */
  --bg2: #FFFFFF;         /* panel background */
  --bg3: #E9EEF6;         /* raised / hover */
  --line: #E4E9F1;        /* hairlines */
  --line2: #CCD6E2;       /* stronger lines */
  --fg: #18212F;          /* primary text — dark slate, high contrast */
  --dim: #64748B;         /* secondary text */
  --accent: #B5780F;      /* brand amber, deepened to read on white */
  --up: #0B9A5F;          /* greens/reds deepened for contrast on light bg */
  --down: #D23A37;
  --buy: #0B9A5F;
  --sell: #D23A37;
  --shadow-color: rgba(23, 33, 52, 0.12);
  --scrim: rgba(23, 33, 52, 0.32);
}
/* exchange chips: re-tuned so the borders/text read on a white panel */
html[data-theme="light"] .chip-nse { color: #2E6FB0; border-color: #BBCDE2; }
html[data-theme="light"] .chip-bse { color: #8B47A8; border-color: #DAC4E5; }
html[data-theme="light"] .chip-mcx { color: #9A6B12; border-color: #E2CEA3; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 13px;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--up); }
.neg { color: var(--down); }
.flat { color: var(--dim); }
.dim { color: var(--dim); }
.ta-l { text-align: left; }
.ta-r { text-align: right; }

/* tick flash */
@keyframes flashUp   { 0% { background: color-mix(in oklab, var(--up) 28%, transparent); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: color-mix(in oklab, var(--down) 28%, transparent); } 100% { background: transparent; } }
.flash-up   { animation: flashUp 0.9s ease-out; border-radius: 2px; }
.flash-down { animation: flashDown 0.9s ease-out; border-radius: 2px; }
.no-flash .flash-up, .no-flash .flash-down { animation: none; }

/* ---------- layout ---------- */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app-body { display: flex; flex: 1; min-height: 0; }
.main { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.screen { padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 46px; padding: 0 14px;
  background: var(--bg2); border-bottom: 1px solid var(--line2);
  flex-shrink: 0; z-index: 30; min-width: 0;
}
.top-right { min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent); font-size: 18px; line-height: 1; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: 0.02em; }
.chip {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line2); color: var(--dim);
}
.chip-paper { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.chip-nse { color: #5B9BD5; border-color: #2A3B50; }
.chip-bse { color: #C58BD8; border-color: #3D2E4A; }
.chip-mcx { color: #D8A656; border-color: #4A3B22; }

/* dark / light theme toggle (top bars of all three apps) */
.theme-toggle {
  font-size: 14px; line-height: 1; color: var(--dim);
  padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line2);
  transition: color 0.15s, background 0.15s, border-color 0.15s; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); background: var(--bg3); border-color: color-mix(in oklab, var(--accent) 45%, transparent); }

.nav-tabs { display: flex; gap: 2px; height: 100%; }
.nav-tab {
  padding: 0 13px; color: var(--dim); font-size: 12.5px; font-weight: 500;
  border-bottom: 2px solid transparent; transition: color 0.15s;
}
.nav-tab:hover { color: var(--fg); }
.nav-on { color: var(--fg); border-bottom-color: var(--accent); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.search-wrap { position: relative; }
.search {
  width: 230px; background: var(--bg); border: 1px solid var(--line2);
  border-radius: 4px; padding: 5px 9px; font-size: 12px; outline: none;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--dim); }
.search-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg3); border: 1px solid var(--line2); border-radius: 6px;
  overflow: hidden; box-shadow: 0 12px 32px var(--shadow-color); z-index: 50;
}
.search-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; text-align: left; }
.search-item:hover { background: var(--bg2); }
.search-name { flex: 1; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-funds { font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.top-pnl { font-size: 11px; }
.mkt-clock { font-size: 11px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mkt-dot { width: 7px; height: 7px; border-radius: 50%; }
.mkt-open { background: var(--up); box-shadow: 0 0 6px var(--up); }
.mkt-closed { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

/* ---------- watchlist ---------- */
.watchlist {
  width: 285px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg2); border-right: 1px solid var(--line2);
}
/* watchlist toolbar: list picker + new/rename/delete + collapse */
.wl-bar { display: flex; align-items: center; gap: 5px; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.wl-pick { flex: 1; min-width: 0; font-size: 11.5px; padding: 5px 7px; }
.wl-ico {
  flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); color: var(--dim);
  font-size: 12px; line-height: 1; cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}
.wl-ico:hover { color: var(--fg); border-color: var(--accent); background: var(--bg3); }
.wl-collapse { margin-left: 2px; font-size: 16px; }
/* collapsed rail — a slim reopen strip so the rest of the screen gets the width */
.watchlist.wl-collapsed { width: 32px; align-items: stretch; }
.wl-reopen {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 0; color: var(--dim); cursor: pointer; background: none; border: 0;
}
.wl-reopen:hover { color: var(--accent); background: var(--bg3); }
.wl-reopen-i { font-size: 16px; }
.wl-reopen-t { writing-mode: vertical-rl; font-size: 11px; letter-spacing: 0.08em; }
/* search-to-add box */
.wl-addwrap { position: relative; padding: 8px; border-bottom: 1px solid var(--line); }
.wl-addwrap .wl-search { width: 100%; padding-right: 26px; }
.wl-clear {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--dim); font-size: 12px; cursor: pointer;
}
.wl-clear:hover { color: var(--fg); }
/* search results (add mode) */
.wl-results { flex: 1; overflow-y: auto; }
.wl-result {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline;
  width: 100%; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: none; cursor: pointer;
}
.wl-result:hover { background: var(--bg3); }
.wl-r-sym { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.wl-r-name { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-r-add { font-size: 13px; font-weight: 700; color: var(--accent); }
.wl-r-add.on { color: var(--up); }
.wl-result.on { background: color-mix(in oklab, var(--up) 6%, transparent); }
.wl-list { flex: 1; overflow-y: auto; }
.wl-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 11px 11px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; position: relative;
}
/* leave room for the star so it doesn't overlap the change % */
.wl-row .wl-head-r { padding-right: 16px; }
.wl-up { border-left-color: color-mix(in oklab, var(--up) 60%, transparent); }
.wl-down { border-left-color: color-mix(in oklab, var(--down) 60%, transparent); }
.wl-row:hover { background: var(--bg3); }
.wl-sel { background: color-mix(in oklab, var(--accent) 6%, transparent); }
.wl-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 8px; text-align: left; width: 100%; }
.wl-head-l { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wl-ltp { font-size: 10px; font-weight: 500; letter-spacing: 0.03em; }
.wl-sym { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.wl-name { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.wl-head-r { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 3px; max-width: 110px; }
.wl-arrow { font-size: 9px; }
.wl-chg { font-size: 12px; font-weight: 600; }
.wl-pct { font-size: 10.5px; width: 100%; text-align: right; }
.wl-quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wl-quote {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 9px; border: 1px solid var(--line2); border-radius: 6px;
  background: var(--bg); transition: background 0.12s, border-color 0.12s;
}
.wl-bid { border-left: 2px solid color-mix(in oklab, var(--down) 55%, transparent); }
.wl-ask { border-left: 2px solid color-mix(in oklab, var(--up) 55%, transparent); }
.wl-bid:hover { background: color-mix(in oklab, var(--sell) 14%, transparent); border-color: var(--sell); }
.wl-ask:hover { background: color-mix(in oklab, var(--buy) 14%, transparent); border-color: var(--buy); }
.wl-q-tag { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; color: var(--dim); }
.wl-bid .wl-q-tag, .wl-ask .wl-q-tag { color: #fff; }
.wl-q-px { font-size: 14px; font-weight: 600; color: #fff; }
.wl-q-sub { font-size: 9.5px; color: var(--dim); }
.wl-foot-row { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; }
.wl-ohlc { display: flex; gap: 14px; }
.wl-open, .wl-close { color: var(--fg); }
.wl-opt { color: var(--accent); font-size: 10.5px; font-weight: 500; }
.wl-opt:hover { text-decoration: underline; }
.wl-ohl-vix { display: flex; gap: 14px; font-size: 11px; }
.wl-foot { padding: 8px 12px; font-size: 9.5px; border-top: 1px solid var(--line); line-height: 1.5; }

/* ---------- market watch ---------- */
.mw-bar { gap: 12px; }
.mw-search { width: 220px; }
.mw-sortwrap { display: flex; align-items: center; gap: 7px; font-size: 11px; white-space: nowrap; }
.mw-sortwrap .sel { font-size: 11.5px; padding: 5px 7px; }
.mw-ad { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; }
.mw-ad-total { font-weight: 400; }
.mw-panel { padding: 0; }
.mw-thead { display: flex; align-items: center; padding: 10px 14px 9px; border-bottom: 1px solid var(--line); }
.mw-grp { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.mw-grp-n { font-family: var(--mono); font-size: 10.5px; font-weight: 400; }
.mw-scroll { overflow-x: auto; }
.mw-tbl { font-size: 11px; width: 100%; min-width: 700px; }
.mw-tbl th, .mw-tbl td { padding: 5px 7px; white-space: nowrap; }
.mw-tbl thead th { position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.mw-sym-col { min-width: 124px; }
.mw-tbl .mw-sym-col { text-align: left; }
/* expiry-month selector (bar) + per-row expiry tag */
.mw-expwrap { gap: 6px; }
.mw-exp { display: inline-flex; }
.mw-exp button { font-family: var(--mono); font-size: 10px; padding: 3px 8px; }
.mw-exp-tag { font-family: var(--mono); font-size: 9px; color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 32%, transparent); border-radius: 3px; padding: 1px 5px; margin-left: 7px; vertical-align: middle; }
/* hide secondary columns on narrower desktops so the essentials + Trade fit */
@media (max-width: 1480px) { .mw-hide-d { display: none; } }
.mw-rowsub { font-size: 9.5px; margin-left: 9px; font-family: var(--sans); font-weight: 400; }
.mw-row { cursor: pointer; border-left: 3px solid transparent; }
.mw-up { border-left-color: color-mix(in oklab, var(--up) 55%, transparent); background: color-mix(in oklab, var(--up) 5%, transparent); }
.mw-down { border-left-color: color-mix(in oklab, var(--down) 55%, transparent); background: color-mix(in oklab, var(--down) 5%, transparent); }
.mw-up:hover { background: color-mix(in oklab, var(--up) 11%, transparent); }
.mw-down:hover { background: color-mix(in oklab, var(--down) 11%, transparent); }
.mw-ltp { font-weight: 600; }
/* bid/ask kept white for readability (distinguished by the BID/ASK column headers) */
.mw-bidc, .mw-askc, .mw-bid-px, .mw-ask-px { color: var(--fg); }
/* keyboard-trade selection: '=' buys / '−' sells this row */
.mw-sel { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 55%, transparent); background: color-mix(in oklab, var(--accent) 12%, transparent) !important; }
.mw-sel.mw-up, .mw-sel.mw-down { border-left-color: var(--accent); }
.mw-sym-col { cursor: pointer; }
.mw-sym-col:hover .sym-cell { color: var(--accent); }
.mw-trade-col { width: 64px; }
.mw-bs { display: inline-flex; gap: 4px; }
.mw-b, .mw-s { font-family: var(--mono); font-size: 10px; font-weight: 700; width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--line2); color: var(--dim); }
.mw-b:hover { background: var(--buy); border-color: var(--buy); color: #06130d; }
.mw-s:hover { background: var(--sell); border-color: var(--sell); color: #190707; }
.mw-na { font-size: 11px; }
.mw-foot { padding: 4px 4px 8px; font-size: 10px; }

/* mobile Market Watch — card list (no horizontal scroll) */
.mw-cards { display: flex; flex-direction: column; }
.mwc { border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.mwc-up { border-left-color: color-mix(in oklab, var(--up) 60%, transparent); }
.mwc-down { border-left-color: color-mix(in oklab, var(--down) 60%, transparent); }
.mwc-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 11px 12px 8px; }
.mwc-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mwc-sym-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mwc-sym { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.mwc-name { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.mwc-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.mwc-ltp { font-size: 15px; font-weight: 600; }
.mwc-chg { font-size: 11px; white-space: nowrap; }
.mwc-act { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 10px; }
.mwc-more { font-size: 11px; color: var(--accent); }
.mwc-bs { display: inline-flex; gap: 8px; }
.mwc-bs .mw-b, .mwc-bs .mw-s { width: 38px; height: 28px; font-size: 12px; }
.mwc-detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 10px; padding: 2px 12px 11px; font-size: 11px; }

/* ---------- panels & tables ---------- */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.panel-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 14px 9px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 12.5px; font-weight: 600; letter-spacing: 0.015em; }
.panel-sub { font-size: 10.5px; color: var(--dim); font-family: var(--mono); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.07em;
  color: var(--dim); text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line);
  text-transform: uppercase; white-space: nowrap;
}
.tbl td { text-align: right; padding: 6.5px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg3); }
.row-click { cursor: pointer; }
.sym-cell { font-family: var(--mono); font-weight: 600; font-size: 12px; }
.link-btn { color: var(--accent); font-size: 11.5px; }
.link-btn:hover { text-decoration: underline; }
.btn-accent {
  background: var(--accent); color: #14100a; font-weight: 600; font-size: 12px;
  padding: 8px 14px; border-radius: 5px;
}
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost { border: 1px solid var(--line2); border-radius: 5px; padding: 7px 14px; color: var(--dim); }
.btn-ghost:hover { color: var(--fg); border-color: var(--dim); }
.btn-xs { padding: 4px 10px; font-size: 11px; }

.sel {
  background: var(--bg); border: 1px solid var(--line2); border-radius: 4px;
  padding: 5px 8px; font-size: 12px; outline: none;
}
.sel-big { font-family: var(--mono); font-weight: 600; font-size: 13px; padding: 7px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; }
.seg button { padding: 5px 10px; font-size: 11px; font-family: var(--mono); color: var(--dim); border-right: 1px solid var(--line2); }
.seg button:last-child { border-right: none; }
.seg .seg-on { background: var(--bg3); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- dashboard ---------- */
.idx-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 10px; }
.idx-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 13px; display: flex; flex-direction: column; gap: 5px; text-align: left;
  transition: border-color 0.15s;
}
.idx-card:hover { border-color: var(--line2); }
.idx-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.idx-name { font-size: 11.5px; color: var(--dim); font-weight: 500; }
.idx-ltp { font-size: 19px; font-weight: 600; }
.idx-chg { font-size: 11.5px; }
.idx-spark { margin-top: 2px; }
.idx-olh { font-size: 9.5px; color: var(--dim); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.movers-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 10px 14px 12px; }
.mini-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; padding: 4px 0 6px; }
.up-label { color: var(--up); }
.down-label { color: var(--down); }
.mover-row {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center;
  width: 100%; padding: 5.5px 4px; font-size: 12px; border-radius: 4px; text-align: left;
}
.mover-row:hover { background: var(--bg3); }
.mover-vol { font-size: 10px; }
.mover-pct { min-width: 52px; text-align: right; }

.bu-tag { font-family: var(--mono); font-size: 9.5px; padding: 2px 7px; border-radius: 3px; }
.bu-long { color: var(--up); background: color-mix(in oklab, var(--up) 12%, transparent); }
.bu-short { color: var(--down); background: color-mix(in oklab, var(--down) 12%, transparent); }

/* mobile OI-buildup card list (no horizontal scroll) */
.oi-cards { display: flex; flex-direction: column; }
.oi-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.oi-card:hover { background: var(--bg3); }
.oi-l { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.oi-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.oi-px { display: inline-flex; gap: 8px; align-items: baseline; font-size: 12px; }
.oi-oi { font-size: 10px; }

.mcx-list { display: flex; flex-direction: column; }
.mcx-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left;
}
.mcx-row:last-child { border-bottom: none; }
.mcx-row:hover { background: var(--bg3); }
.mcx-id { display: flex; flex-direction: column; gap: 1px; }
.mcx-name { font-size: 10px; }
.mcx-px { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12.5px; min-width: 150px; }
.mcx-px .num:last-child { font-size: 10.5px; }

.acct-panel { display: flex; flex-direction: column; }
.acct-equity { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.acct-big { font-size: 22px; font-weight: 600; }
.acct-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.acct-stats > div { display: flex; justify-content: space-between; font-size: 12px; }
.acct-pos-list { padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.acct-pos { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 11.5px; }
.acct-pos-label { font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qty-tag, .side-tag, .fill-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 3px;
}
.qty-long { color: var(--up); background: color-mix(in oklab, var(--up) 14%, transparent); }
.qty-short { color: var(--down); background: color-mix(in oklab, var(--down) 14%, transparent); }
/* open-position qty badge in Market Watch (after the symbol) */
.mw-pos { font-family: var(--mono); font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-left: 7px; vertical-align: middle; }
.mover-empty { padding: 10px 4px; font-size: 11px; }
/* watchlist star toggles (Market Watch rows + rail rows) */
.mw-star, .wl-star { background: none; border: 0; cursor: pointer; color: var(--line2); font-size: 12px; line-height: 1; padding: 0; }
.mw-star { margin-right: 6px; vertical-align: middle; }
.mw-star:hover, .wl-star:hover { color: var(--accent); }
.mw-star.on, .wl-star.on { color: var(--accent); }
.wl-star { position: absolute; top: 8px; right: 8px; z-index: 2; font-size: 13px; }
.wl-search { margin: 0; width: 100%; }
.wl-empty { padding: 16px 10px; font-size: 11px; line-height: 1.5; }
.fill-tag { color: var(--up); border: 1px solid color-mix(in oklab, var(--up) 40%, transparent); }
.pend-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 3px; color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent); }
.cncl-tag, .rej-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 3px; color: var(--dim); border: 1px solid var(--line2); }
.rej-tag { color: var(--down); border-color: color-mix(in oklab, var(--down) 40%, transparent); }
/* expiry auto-settlement fill + end-of-day auto-void (so HQ/clients can tell them
   apart from manual fills/cancels) */
.settle-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 3px; color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent); }
.eod-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 3px; color: var(--dim); border: 1px dashed var(--line2); }
.pend-wrap { display: inline-flex; align-items: center; gap: 8px; }
.row-dim td { opacity: 0.5; }
.acct-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; font-size: 12px; }

/* suspended-script banner in the order ticket */
.ticket-susp { margin: 0 16px 10px; padding: 8px 12px; border-radius: 6px; font-size: 11.5px; line-height: 1.45;
  color: var(--down); background: color-mix(in oklab, var(--down) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--down) 40%, transparent); }

/* ---------- ledger / P&L statement ---------- */
.btn-sm { padding: 6px 12px; font-size: 12px; }
.ledger-bar { display: flex; align-items: flex-end; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.led-fld { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.led-fld .px-input { padding: 6px 8px; color-scheme: dark; }
.led-dl { margin-left: auto; display: flex; gap: 8px; }
.ledger-summary { flex-wrap: wrap; }
.led-scroll { overflow-x: auto; }
.led-tbl { width: 100%; min-width: 720px; }
.led-tbl th, .led-tbl td { padding: 6px 8px; white-space: nowrap; }
.led-tbl thead th { position: sticky; top: 0; background: var(--bg2); z-index: 1; }

/* ---------- option chain ---------- */
.chain-bar, .chart-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chain-spot { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.chain-spot-px { font-size: 17px; font-weight: 600; }
.chain-meta { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--dim); }
.chain-meta b { color: var(--fg); }
.chain-wrap { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.chain-tbl { font-size: 11.5px; }
.chain-tbl th, .chain-tbl td { padding: 5px 8px; text-align: right; }
.chain-side-head th { text-align: center; font-size: 10px; letter-spacing: 0.18em; padding: 8px 0 4px; border-bottom: none; }
.ce-head { color: var(--up); }
.pe-head { color: var(--down); }
.strike-col {
  text-align: center !important; background: var(--bg3);
  border-left: 1px solid var(--line2); border-right: 1px solid var(--line2);
  position: relative; min-width: 86px;
}
.strike-num { font-weight: 600; font-size: 12px; }
.atm-row td { background: color-mix(in oklab, var(--accent) 5%, transparent); }
.atm-tag {
  font-family: var(--mono); font-size: 8px; color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 50%, transparent);
  border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: 1px;
}
.itm { background: color-mix(in oklab, var(--bg3) 65%, transparent); }
.oi-cell { position: relative; min-width: 86px; }
.oi-cell .num { position: relative; z-index: 1; }
.oi-bar { position: absolute; top: 15%; bottom: 15%; right: 0; opacity: 0.16; border-radius: 2px; }
.oi-bar-ce { background: var(--up); }
.oi-cell-pe .oi-bar { right: auto; left: 0; background: var(--down); }
.ltp-cell { position: relative; font-weight: 600; min-width: 92px; }
.bs-hover {
  display: none; position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  gap: 3px; z-index: 2;
}
.chain-tbl tr:hover .bs-hover { display: inline-flex; }
.bs-b, .bs-s {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  width: 20px; height: 20px; border-radius: 3px; color: #fff;
}
.bs-b { background: var(--buy); color: #06130d; }
.bs-s { background: var(--sell); color: #190707; }
.small-num { font-size: 10.5px; }
.chain-foot { padding: 7px 14px; font-size: 10px; border-top: 1px solid var(--line); }
.seg-expiry button { padding: 5px 12px; }

/* ---------- chart screen ---------- */
.chart-exp-sel { font-family: var(--mono); font-size: 12px; padding: 6px 9px; }
.chart-back { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--dim); border: 1px solid var(--line2); border-radius: 7px; padding: 6px 11px; transition: color .15s, border-color .15s, background .15s; }
.chart-back:hover { color: var(--fg); border-color: var(--dim); background: var(--bg3); }
.chart-quote { display: flex; align-items: baseline; gap: 10px; }
.chart-ltp { font-size: 21px; font-weight: 600; }
.chart-ohlc { font-size: 11px; }
.chart-ohlc b { color: var(--fg); font-weight: 500; }
.chart-bar .seg { margin-left: auto; }
.chart-body { display: grid; grid-template-columns: 1fr 270px; gap: 12px; flex: 1; min-height: 0; }
.candle-wrap {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  min-height: 420px; height: calc(100vh - 220px); overflow: hidden; padding: 6px;
  position: relative;
}
.candle-wrap canvas { cursor: grab; }
.candle-wrap canvas.grabbing { cursor: grabbing; }
.chart-reset {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--line2); background: color-mix(in oklab, var(--bg3) 80%, transparent);
  color: var(--dim); cursor: pointer; backdrop-filter: blur(3px);
}
.chart-reset:hover { color: var(--accent); border-color: var(--accent); }
.chart-hint {
  position: absolute; bottom: 6px; left: 12px; z-index: 1; pointer-events: none;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.04em; opacity: 0.5;
}
/* chart overlay controls (type toggle + indicators) */
.chart-tools {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.chart-tools .seg-mini button { padding: 3px 8px; font-size: 10px; }
.ov-chip {
  font-family: var(--mono); font-size: 10px; padding: 3px 8px; cursor: pointer;
  border: 1px solid var(--line2); border-radius: 4px; color: var(--dim);
  background: color-mix(in oklab, var(--bg) 70%, transparent); backdrop-filter: blur(3px);
}
.ov-chip:hover { color: var(--fg); }
.chart-side { display: flex; flex-direction: column; gap: 12px; }
.fut-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; }
.fut-card-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }
.fut-px { font-size: 20px; font-weight: 600; }
.fut-basis { font-size: 10.5px; }
.fut-meta { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; }
.fut-meta > div { display: flex; justify-content: space-between; }
.fut-meta b { font-weight: 500; }
.fut-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.btn-buy, .btn-sell { font-weight: 700; font-size: 12px; padding: 9px 0; border-radius: 5px; letter-spacing: 0.04em; }
.btn-buy { background: var(--buy); color: #06130d; }
.btn-sell { background: var(--sell); color: #190707; }
.btn-buy:hover, .btn-sell:hover { filter: brightness(1.12); }
.daystats-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }
.range-bar { position: relative; height: 4px; background: linear-gradient(90deg, var(--down), var(--line2) 50%, var(--up)); border-radius: 2px; margin: 6px 0 2px; }
.range-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 10px; height: 10px; background: var(--fg); border-radius: 50%; border: 2px solid var(--bg2); }
.range-ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); }

/* ---------- strategy ---------- */
.strat-grid { display: grid; grid-template-columns: minmax(380px, 5fr) minmax(420px, 6fr); gap: 12px; align-items: start; }
.tpl-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.tpl-btn { border: 1px solid var(--line2); border-radius: 5px; padding: 7px 12px; font-size: 12px; color: var(--dim); }
.tpl-btn:hover { color: var(--fg); border-color: var(--dim); }
.tpl-on { color: var(--accent); border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, transparent); }
.legs-head { border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.legs-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.strat-empty { padding: 14px; font-size: 12px; }
.leg-row { display: flex; align-items: center; gap: 8px; }
.leg-side { width: 26px; height: 26px; border-radius: 4px; font-family: var(--mono); font-weight: 700; font-size: 12px; }
.on-buy { background: var(--buy); color: #06130d; }
.on-sell { background: var(--sell); color: #190707; }
.leg-fut-label { font-size: 11px; flex: 1; }
.leg-px { margin-left: auto; font-weight: 600; min-width: 70px; text-align: right; }
.leg-rm { color: var(--dim); font-size: 15px; width: 22px; }
.leg-rm:hover { color: var(--down); }
.payoff-svg { width: 100%; height: auto; display: block; padding: 8px 10px 0; }
.payoff-empty { padding: 60px 14px; text-align: center; }
.strat-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; padding: 10px 16px; font-size: 12px; }
.strat-stats > div { display: flex; justify-content: space-between; gap: 10px; }
.strat-stats b { font-weight: 600; }
.strat-note { padding: 0 16px 4px; font-size: 9.5px; }
.strat-exec { margin: 10px 14px 14px; }

/* ---------- positions / orders ---------- */
.funds-strip {
  display: flex; gap: 26px; align-items: center; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 13px 18px;
}
.fund-cell { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.fund-cell .dim { font-size: 10px; font-family: var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
.funds-big { font-size: 17px; font-weight: 600; }
.reset-btn { margin-left: auto; }
.pos-tbl td { padding: 8px 12px; }
.pos-label { margin-left: 8px; }
.pos-pnl { font-weight: 600; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 20px; }
.empty-glyph { font-size: 26px; color: var(--line2); }

/* ---------- ticker tape ---------- */
.tape { height: 28px; background: var(--bg2); border-top: 1px solid var(--line2); overflow: hidden; flex-shrink: 0; }
.tape-track { display: flex; gap: 28px; align-items: center; height: 100%; width: max-content; animation: tape 55s linear infinite; padding-left: 12px; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-track { animation: none; flex-wrap: wrap; } }
.tape-cell { font-size: 11px; white-space: nowrap; color: var(--dim); }
.tape-cell b { color: var(--fg); font-weight: 600; }

/* ---------- modal / ticket ---------- */
.modal-veil {
  position: fixed; inset: 0; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(2px);
}
.ticket {
  width: 430px; max-width: calc(100vw - 32px);
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: 0 24px 64px var(--shadow-color); overflow: hidden;
}
.ticket-buy { border-top: 3px solid var(--buy); }
.ticket-sell { border-top: 3px solid var(--sell); }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; }
.ticket-sym { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.ticket-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
.side-switch { display: flex; border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; }
.side-btn { padding: 6px 14px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--dim); }
.side-btn.on-buy { background: var(--buy); color: #06130d; }
.side-btn.on-sell { background: var(--sell); color: #190707; }
.ticket-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; padding: 8px 16px 14px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; color: var(--dim); }
.fld-hint { font-size: 9.5px; }
.stepper { display: flex; border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; }
.stepper button { width: 26px; background: var(--bg3); color: var(--dim); font-size: 14px; }
.stepper button:hover { color: var(--fg); }
.stepper input { width: 100%; min-width: 0; text-align: center; background: var(--bg); border: none; outline: none; font-family: var(--mono); font-size: 13px; padding: 6px 0; }
.stepper-sm input { padding: 3px 0; font-size: 12px; }
.stepper-sm button { width: 20px; font-size: 12px; }
.px-input {
  background: var(--bg); border: 1px solid var(--line2); border-radius: 5px;
  padding: 6px 8px; font-family: var(--mono); font-size: 13px; outline: none; width: 100%;
}
.px-input:disabled { color: var(--dim); }
.px-input:focus { border-color: var(--accent); }
.px-bad { border-color: var(--down) !important; color: var(--down); }
.fld-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg-mini button { padding: 2px 8px; font-size: 9.5px; }
.exits-block { border-top: 1px solid var(--line); margin: 0 16px; }
.exits-toggle {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 9px 0; font-size: 11.5px; color: var(--fg); text-align: left;
}
.exits-toggle:hover { color: var(--accent); }
.exits-caret { color: var(--accent); width: 10px; }
.exits-hint { margin-left: auto; font-size: 10px; }
.exits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 2px 0 14px; }
.ticket-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.ticket-margin { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dim); }
.ticket-margin b { color: var(--fg); font-weight: 600; }
.ticket-actions { display: flex; gap: 10px; justify-content: flex-end; }
.ticket-actions .btn-buy, .ticket-actions .btn-sell { padding: 9px 18px; }
.ticket-paper-note {
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  text-align: center; padding: 5px;
}

@media (max-width: 768px) {
  .hide-m { display: none; }
}

/* ---------- login ---------- */
.login-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, color-mix(in oklab, var(--accent) 7%, transparent), transparent),
    var(--bg);
}
.login-strip { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; font-size: 11px; color: var(--dim); }
.login-strip-cell { white-space: nowrap; }
.login-strip-cell b { color: var(--fg); font-weight: 600; }
.login-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 26px 26px 18px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 64px var(--shadow-color);
}
.login-shake { animation: loginShake 0.3s ease-out; }
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); }
}
.login-brand { display: flex; align-items: center; gap: 9px; }
.login-brand .brand-mark { font-size: 22px; }
.login-title { font-size: 19px; font-weight: 600; letter-spacing: 0.02em; }
.login-sub { font-size: 11.5px; margin-top: -8px; }
.login-fld { gap: 6px; }
.login-fld .px-input { padding: 9px 11px; }
.login-err {
  color: var(--down); font-size: 11.5px;
  background: color-mix(in oklab, var(--down) 9%, transparent);
  border: 1px solid color-mix(in oklab, var(--down) 30%, transparent);
  border-radius: 5px; padding: 8px 10px;
}
.login-btn { padding: 11px 0; font-size: 13px; margin-top: 2px; }
.login-hint { font-size: 11px; text-align: center; }
.login-hint b { color: var(--accent); font-weight: 600; }
.login-foot { font-size: 9.5px; text-align: center; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- profile ---------- */
.profile-wrap { position: relative; }
.avatar-btn { display: flex; border-radius: 50%; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 18%, var(--bg3));
  border: 1px solid color-mix(in oklab, var(--accent) 50%, transparent);
  color: var(--accent); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0.04em;
}
.avatar-btn:hover .avatar, .avatar-on .avatar { background: color-mix(in oklab, var(--accent) 30%, var(--bg3)); }
.avatar-lg { width: 38px; height: 38px; font-size: 13px; }
.profile-drop {
  position: absolute; top: calc(100% + 10px); right: 0; width: 264px;
  background: var(--bg3); border: 1px solid var(--line2); border-radius: 8px;
  box-shadow: 0 16px 48px var(--shadow-color); z-index: 60; overflow: hidden;
}
.profile-id { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid var(--line2); }
.profile-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-who b { font-size: 13px; }
.profile-who span { font-size: 10.5px; }
.profile-stats { display: flex; flex-direction: column; gap: 7px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.profile-stats > div { display: flex; justify-content: space-between; font-size: 11.5px; }
.profile-stats b { font-weight: 600; }
.profile-acct { font-size: 9.5px; padding: 9px 14px; border-bottom: 1px solid var(--line2); }
.profile-signout {
  width: 100%; padding: 11px; font-size: 12px; font-weight: 600; color: var(--down); text-align: center;
}
.profile-signout:hover { background: color-mix(in oklab, var(--down) 10%, transparent); }
@media (max-width: 900px) { .profile-wrap { margin-left: auto; } }

/* ---------- toasts ---------- */
.toast-host { position: fixed; bottom: 44px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--bg3); border: 1px solid var(--line2); border-radius: 7px;
  padding: 10px 14px; width: 320px; box-shadow: 0 12px 32px var(--shadow-color);
  animation: toastIn 0.22s ease-out;
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-buy { border-left: 3px solid var(--buy); }
.toast-sell { border-left: 3px solid var(--sell); }
.toast-err { border-left: 3px solid var(--accent); }
.toast-title { font-size: 12px; font-weight: 600; font-family: var(--mono); }
.toast-body { font-size: 11px; color: var(--dim); margin-top: 3px; }

/* ---------- mobile bottom nav ---------- */
.bottom-nav { display: none; }
.topbar-back {
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; color: var(--fg); flex-shrink: 0;
}
.topbar-back:disabled { opacity: 0.3; cursor: default; }
.topbar-back:not(:disabled):hover { background: var(--bg3); }
.book-seg-bar { padding: 12px 12px 0; }
.seg-book { width: 100%; }
.seg-book button { flex: 1; padding: 9px 0; font-size: 12px; }
.hide-m-only { display: none; }

/* ---------- touch devices: hover affordances become persistent ---------- */
@media (hover: none) {
  .bs-hover { display: inline-flex; position: static; transform: none; margin-left: 6px; vertical-align: middle; }
  .bs-b, .bs-s { width: 26px; height: 24px; }
  .ltp-cell { min-width: 0; }
  .wl-acts {
    display: flex; position: static; transform: none;
    grid-column: 1 / -1; justify-content: flex-end;
    background: transparent; border: none; padding: 2px 0 0;
  }
  .wl-act { padding: 6px 12px; font-size: 11px; }
  .wl-row { padding: 9px 12px; }
}

/* ---------- responsive (tablet / mobile) ---------- */
@media (max-width: 1340px) {
  .search { width: 170px; }
  .nav-tab { padding: 0 9px; }
  .topbar { gap: 12px; }
}
@media (max-width: 1220px) {
  .mkt-clock { display: none; }
  .search { width: 140px; }
}
@media (max-width: 1100px) {
  .dash-grid, .strat-grid { grid-template-columns: 1fr; }
  .chart-body { grid-template-columns: 1fr; }
  .chart-side { flex-direction: row; }
  .chart-side .fut-card { flex: 1; }
  .candle-wrap { height: 46vh; min-height: 300px; }
}
@media (max-width: 1020px) {
  .top-funds { display: none; }
}
@media (max-width: 900px) {
  .watchlist { display: none; }
}
@media (max-width: 768px) {
  body { font-size: 12px; position: fixed; width: 100%; height: 100%; }  /* lock page; only inner content scrolls */
  .app { height: 100dvh; }
  .topbar { position: sticky; top: 0; }
  /* compact single-row topbar; nav moves to bottom bar */
  .topbar { height: auto; min-height: 46px; padding: 0 10px; gap: 8px; padding-top: env(safe-area-inset-top, 0px); }
  .topbar-back { display: flex; }
  .nav-tabs { display: none; }
  .brand-name { display: none; }
  .search-wrap { flex: 1; min-width: 0; }
  .search { width: 100%; }
  .top-right { flex: 1; min-width: 0; gap: 10px; }

  /* bottom tab bar — flex so however many items are visible (Chain/Strategy may
     be hidden) they always spread evenly; safe-area keeps it above the home bar */
  .bottom-nav {
    display: flex;
    background: var(--bg2); border-top: 1px solid var(--line2);
    padding-bottom: max(env(safe-area-inset-bottom), 14px); flex-shrink: 0; z-index: 40;
  }
  .bnav-btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 52px; padding: 6px 0 5px;
    color: var(--dim); font-size: 9px; font-weight: 500; letter-spacing: 0.01em;
  }
  .bnav-on { color: var(--accent); }
  .tape { height: 24px; }

  /* watchlist as a full screen */
  .watchlist.wl-as-screen {
    display: flex; width: 100%; border-right: none; background: transparent;
  }
  .wl-as-screen .wl-list, .wl-as-screen .wl-results { padding-bottom: 8px; }
  .wl-as-screen .wl-pick { font-size: 13px; padding: 8px; }
  .wl-as-screen .wl-ico { width: 32px; height: 32px; }
  .wl-as-screen .wl-sym { font-size: 13px; }
  .wl-as-screen .wl-px { font-size: 13px; }

  /* order ticket becomes a bottom sheet */
  .modal-veil { align-items: flex-end; }
  .ticket {
    width: 100%; max-width: 100%; border-radius: 14px 14px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    animation: sheetUp 0.22s ease-out;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .ticket-grid { grid-template-columns: 1fr 1fr; }
  .ticket-grid .fld:first-child { grid-column: 1 / -1; }
  .exits-grid { grid-template-columns: 1fr 1fr; }
  .stepper button { width: 40px; font-size: 16px; }
  .stepper input { padding: 9px 0; font-size: 15px; }
  /* 16px min on every field stops iOS Safari from auto-zooming on focus */
  .px-input { padding: 9px 10px; font-size: 16px; }
  .search, input, select, textarea { font-size: 16px; }
  .side-btn { padding: 9px 16px; }
  .ticket-actions .btn-buy, .ticket-actions .btn-sell { padding: 12px 22px; flex: 1; }
  .ticket-actions .btn-ghost { padding: 12px 16px; }

  /* dense tables scroll sideways instead of clipping */
  .panel { overflow-x: auto; }
  .chain-tbl th, .chain-tbl td { padding: 7px 6px; }
  .ltp-cell { font-size: 12px; }
  .chain-meta { margin-left: 0; width: 100%; justify-content: space-between; }

  /* toasts above bottom nav */
  .toast-host { bottom: 92px; right: 10px; left: 10px; }
  .toast { width: auto; }

  .screen { padding: 10px 10px 20px; }
  .idx-row { grid-template-columns: 1fr 1fr; }
  .idx-ltp { font-size: 17px; }
  .movers-cols { grid-template-columns: 1fr; }
  .chart-side { flex-direction: column; }
  .candle-wrap { height: 38vh; min-height: 240px; }
  .funds-strip { gap: 12px 20px; padding: 12px 14px; }
  .btn-buy, .btn-sell { padding: 12px 0; }
  .profile-drop { position: fixed; top: 52px; right: 8px; left: auto; }
}

@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
