/* =========================================================
   NusaTrade — Terminal Trading Kripto & Saham
   ========================================================= */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 10px;
}
:root, [data-theme="dark"] {
  --bg: #090c11;
  --panel: #10141b;
  --panel2: #151a23;
  --hover: #1a212c;
  --line: #1d2430;
  --line2: #2a3343;
  --text: #e8ebf1;
  --muted: #8b95a7;
  --dim: #586276;
  --up: #1bc683;
  --down: #f2475a;
  --up-bg: rgba(27, 198, 131, .13);
  --down-bg: rgba(242, 71, 90, .13);
  --accent: #4f8cff;
  --accent-bg: rgba(79, 140, 255, .14);
  --warn: #f5a524;
  --warn-bg: rgba(245, 165, 36, .14);
  --shadow: 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel2: #f5f7fa;
  --hover: #eef2f7;
  --line: #e2e7ee;
  --line2: #d0d8e3;
  --text: #0f172a;
  --muted: #5a6577;
  --dim: #98a3b5;
  --up: #05976a;
  --down: #d92b3f;
  --up-bg: rgba(5, 151, 106, .1);
  --down-bg: rgba(217, 43, 63, .09);
  --accent: #2f6fec;
  --accent-bg: rgba(47, 111, 236, .1);
  --warn: #b97409;
  --warn-bg: rgba(185, 116, 9, .1);
  --shadow: 0 16px 40px rgba(15, 23, 42, .14);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
kbd {
  font: 500 11px var(--mono); padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--muted);
}
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 13.5px; font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: 58px 46px minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.sidebar {
  grid-row: 1 / -1;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 12px; gap: 6px;
}
.brand { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  position: relative;
  width: 54px; padding: 8px 0 6px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 10px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-btn svg.i { width: 20px; height: 20px; }
.nav-btn:hover { background: var(--hover); color: var(--text); }
.nav-btn.active { background: var(--accent-bg); color: var(--accent); }
.nav-count {
  position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--down); color: #fff; font: 600 10px/16px var(--font); font-style: normal;
}

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; min-width: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.search { position: relative; width: 300px; flex-shrink: 0; }
.search input {
  width: 100%; height: 36px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel2);
  padding: 0 40px 0 36px; outline: none; transition: border-color .15s;
}
.search input:focus { border-color: var(--accent); }
.search > svg { position: absolute; left: 11px; top: 9px; color: var(--dim); }
.search kbd { position: absolute; right: 9px; top: 8px; }
.search-results {
  position: absolute; top: 42px; left: 0; width: 380px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 420px; overflow: auto; display: none; padding: 6px;
}
.search-results.open { display: block; }
.sr-item {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.sr-item:hover, .sr-item.sel { background: var(--hover); }
.sr-item small { display: block; color: var(--muted); font-size: 11px; }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }

.feeds { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 99px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); display: inline-block; flex-shrink: 0; }
.dot.live { background: var(--up); box-shadow: 0 0 0 3px var(--up-bg); animation: pulse 2s infinite; }
.dot.sim { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

.acct { display: flex; gap: 22px; margin-left: auto; }
.stat { display: flex; flex-direction: column; line-height: 1.25; white-space: nowrap; }
.stat span { font-size: 11px; color: var(--muted); }
.stat b { font: 600 14px var(--mono); font-variant-numeric: tabular-nums; }
.clock { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }
.demo-badge {
  font: 700 10px var(--font); letter-spacing: .08em; padding: 5px 8px; border-radius: 6px;
  color: var(--warn); background: var(--warn-bg); white-space: nowrap;
}

.tape { background: var(--panel); border-bottom: 1px solid var(--line); overflow: hidden; min-width: 0; }
.main { min-height: 0; min-width: 0; overflow: hidden; position: relative; }
.view { display: none; height: 100%; }
.view.active { display: block; }

/* ---------- Generic panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px 6px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.card-body { padding: 16px; }

.tabs {
  display: flex; align-items: center; gap: 2px; padding: 0 8px;
  border-bottom: 1px solid var(--line); flex-shrink: 0; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs > button {
  padding: 10px 10px 9px; color: var(--muted); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s;
}
.tabs > button:hover { color: var(--text); }
.tabs > button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs-sm > button { padding: 7px 7px 6px; font-size: 12px; }
.tabs-spacer { flex: 1; }
.count {
  font: 600 10.5px var(--mono); font-style: normal; padding: 1px 6px; border-radius: 99px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); margin-left: 4px;
}
.link-btn { color: var(--accent); font-size: 12px; font-weight: 500; padding: 6px 8px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-bg); }

.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { padding: 4px 10px; border-radius: 6px; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 0 0 1px var(--line2); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2);
  font-weight: 500; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); background: var(--down-bg); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 500;
}
.btn-ghost:hover { color: var(--text); background: var(--hover); }
.btn-ghost svg.i { width: 15px; height: 15px; }
.mini { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line2); }
.mini:hover { background: var(--hover); }
.mini.sell { color: var(--down); }
.badge {
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.buy { color: var(--up); background: var(--up-bg); border-color: transparent; }
.badge.sell { color: var(--down); background: var(--down-bg); border-color: transparent; }
.badge.ok { color: var(--accent); background: var(--accent-bg); border-color: transparent; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- Terminal layout ---------- */
.view-trade.active {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 316px;
  grid-template-rows: minmax(0, 1fr) 248px;
  grid-template-areas: "watch chart side" "watch bottom side";
  gap: 6px; padding: 6px;
}
.watch { grid-area: watch; }
.chartpanel { grid-area: chart; }
.bottom { grid-area: bottom; }
.side { grid-area: side; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 6px; min-height: 0; min-width: 0; }

/* Watchlist */
.wl-filter { padding: 8px 10px 6px; }
.wl-filter input {
  width: 100%; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel2); padding: 0 10px; outline: none; font-size: 12px;
}
.wl-filter input:focus { border-color: var(--accent); }
.wl-head, .wl-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 66px; gap: 8px; align-items: center; }
.wl-head { padding: 4px 12px 6px; color: var(--dim); font-size: 11px; font-weight: 500; }
.wl-head span:nth-child(3), .wl-head span:nth-child(4) { text-align: right; }
.wl-list { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 6px; }
.wl-row { padding: 7px 12px 7px 10px; cursor: pointer; border-left: 2px solid transparent; }
.wl-row:hover { background: var(--hover); }
.wl-row.active { background: var(--accent-bg); border-left-color: var(--accent); }
.wl-sym { min-width: 0; }
.wl-sym b { font-weight: 600; }
.wl-sym small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-price { font: 500 12.5px var(--mono); text-align: right; padding: 1px 4px; border-radius: 4px; }
.chgpill { font: 600 11.5px var(--mono); text-align: center; padding: 3px 0; border-radius: 5px; }
.chgpill.up { background: var(--up-bg); }
.chgpill.down { background: var(--down-bg); }
.flash-up { animation: flashUp .7s ease-out; }
.flash-down { animation: flashDown .7s ease-out; }
@keyframes flashUp { from { background: var(--up-bg); color: var(--up); } }
@keyframes flashDown { from { background: var(--down-bg); color: var(--down); } }
.star { color: var(--dim); display: grid; place-items: center; }
.star svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star:hover { color: var(--warn); }
.star.on { color: var(--warn); }
.star.on svg { fill: currentColor; }
.star.big svg { width: 19px; height: 19px; }

/* Symbol bar + chart */
.symbar {
  display: flex; align-items: center; gap: 22px; row-gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.sym-id { display: flex; align-items: center; gap: 10px; }
.sym-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sym-name .q { color: var(--muted); font-weight: 500; }
.sym-sub { font-size: 12px; color: var(--muted); }
.src { display: inline-flex; align-items: center; gap: 5px; font: 600 10px var(--font); letter-spacing: .05em; color: var(--muted); }
.sym-price { display: flex; flex-direction: column; line-height: 1.2; }
.sym-price b { font: 600 20px var(--mono); font-variant-numeric: tabular-nums; }
.sym-price span { font: 500 12px var(--mono); }
.sym-stats { display: flex; gap: 20px; }
.sym-stats div { display: flex; flex-direction: column; line-height: 1.3; }
.sym-stats span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sym-stats b { font: 500 12.5px var(--mono); white-space: nowrap; }
.sym-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pop-wrap { position: relative; }
.pop {
  position: absolute; right: 0; top: 36px; z-index: 30; width: 220px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow);
  display: none;
}
.pop.open { display: block; }
.pop label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pop label:hover { background: var(--hover); }
.pop p { padding: 4px 8px 6px; font-size: 11px; color: var(--muted); }
.chart { flex: 1; min-height: 0; position: relative; }
/* cegah latar iframe widget menjadi putih saat color-scheme halaman = dark */
.tradingview-widget-container iframe { color-scheme: normal; }
.tv-box { width: 100%; height: 100%; }

/* Bottom panel */
.bottom-body { flex: 1; overflow: auto; min-height: 0; }
.ta-wrap { height: 100%; min-height: 220px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 500;
  color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11.5px;
}
.tbl td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--panel2); }
.tbl .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl small { font-size: 11px; opacity: .85; }
.symlink { color: var(--text); font-weight: 600; cursor: pointer; }
.symlink:hover { color: var(--accent); }
.tbl-wrap { overflow: auto; min-height: 0; flex: 1; }
.tbl-wrap.max420 { max-height: 420px; }

/* Order book */
.book-body { flex: 1; display: flex; flex-direction: column; min-height: 0; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.bk-head, .bk-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; padding: 0 12px; }
.bk-head { color: var(--dim); font: 500 11px var(--font); padding: 7px 12px 5px; }
.bk-head span:not(:first-child), .bk-row span:not(:first-child) { text-align: right; }
.bk-side { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.bk-asks { flex-direction: column-reverse; }
.bk-bids { flex-direction: column; }
.bk-row { position: relative; height: 20px; line-height: 20px; cursor: pointer; flex-shrink: 0; }
.bk-row:hover { background: var(--hover); }
.bk-row i { position: absolute; top: 1px; bottom: 1px; right: 0; z-index: 0; pointer-events: none; }
.bk-asks .bk-row i { background: var(--down-bg); }
.bk-bids .bk-row i { background: var(--up-bg); }
.bk-row span { position: relative; z-index: 1; }
.bk-mid {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 7px 12px; border-block: 1px solid var(--line); flex-shrink: 0;
}
.bk-mid b { font-size: 15px; font-weight: 600; }
.bk-mid span { font: 11px var(--font); }
.tr-list { flex: 1; overflow: hidden; }
.tr-list .bk-row { cursor: default; }

/* Order form */
.orderform { padding: 12px 14px 12px; gap: 10px; overflow: visible; }
.of-top { display: flex; flex-direction: column; gap: 8px; }
.side-seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.side-seg button { padding: 7px 0; font-weight: 600; font-size: 13px; }
.side-seg button.active.buy { background: var(--up); color: #fff; box-shadow: none; }
.side-seg button.active.sell { background: var(--down); color: #fff; box-shadow: none; }
.type-seg { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
.of-avail { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.of-avail b { color: var(--text); font-weight: 500; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.inp {
  display: flex; align-items: center; height: 36px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); transition: border-color .15s;
}
.inp:focus-within { border-color: var(--accent); }
.inp input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; padding: 0 10px; font-family: var(--mono); font-size: 13px; }
.inp input:disabled { color: var(--muted); font-family: var(--font); font-size: 12.5px; }
.inp em { font-style: normal; color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 0 10px; }
.inp-btn { font-size: 12px; color: var(--accent); padding: 0 10px; height: 100%; }
.field.sm .inp { height: 32px; }
.pcts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pcts button { padding: 4px 0; font-size: 11.5px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.pcts button:hover { color: var(--text); border-color: var(--line2); background: var(--hover); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; color: var(--muted); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.br-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 8px; }
.field { min-width: 0; }
.field.sm .inp em { padding: 0 8px 0 4px; }
.of-sum { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.of-sum div { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.of-sum b { color: var(--text); font-weight: 500; font-size: 12px; }
.submit {
  height: 40px; border-radius: 9px; color: #fff; font-weight: 600; font-size: 14px;
  transition: filter .15s, transform .05s; width: 100%;
}
.submit:hover { filter: brightness(1.08); }
.submit:active { transform: translateY(1px); }
.submit.buy { background: var(--up); }
.submit.sell { background: var(--down); }
.submit.accent { background: var(--accent); }
.of-note { text-align: center; font-size: 11px; color: var(--dim); }

/* ---------- Pages ---------- */
.page { padding: 20px; overflow: auto; }
.page.active { display: block; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin-top: 3px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.wbox { position: relative; }
.h480 { height: 480px; }
.h540 { height: 540px; }
.hfill { flex: 1; min-height: 560px; }
.grid-news { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; height: calc(100% - 70px); min-height: 620px; }
.grid-alerts { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: start; }
.grid-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.form { display: flex; flex-direction: column; gap: 14px; }
.input {
  height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2);
  padding: 0 10px; outline: none; width: 100%;
}
.input:focus { border-color: var(--accent); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.src-list { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--muted); }
.src-list li { display: flex; gap: 10px; align-items: baseline; }
.src-list b { color: var(--text); }
.al-info { font-size: 12px; color: var(--muted); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.al-info b { color: var(--text); }

/* Market movers */
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.movers > div { min-width: 0; }
.movers > div + div { border-left: 1px solid var(--line); }
.movers h4 { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 14px 6px; }
.mv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; gap: 10px; align-items: center; padding: 8px 14px; cursor: pointer; }
.mv-row:hover { background: var(--hover); }
.mv-row small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Portfolio */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi span { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kpi b { display: block; font: 600 20px var(--mono); margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi small { font-size: 11.5px; color: var(--muted); }
.eq-box { position: relative; height: 320px; }
.eq-chart { position: absolute; inset: 10px 6px 6px 6px; }
.eq-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--muted); pointer-events: none; }
.alloc { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px; }
.alloc canvas { width: 190px; height: 190px; }
.alloc-legend { width: 100%; display: flex; flex-direction: column; gap: 6px; max-height: 130px; overflow: auto; }
.lg-row { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; font-size: 12px; }
.lg-row i { width: 10px; height: 10px; border-radius: 3px; }
.lg-row .mono { color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; }
.stats div { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.stats div:nth-child(odd) { border-right: 1px solid var(--line); }
.stats span { display: block; font-size: 11.5px; color: var(--muted); }
.stats b { font: 600 15px var(--mono); }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 34px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: 330px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 12.5px;
  transform: translateX(20px); opacity: 0; transition: transform .25s, opacity .25s;
}
.toast.in { transform: none; opacity: 1; }
.toast b { display: block; margin-bottom: 2px; font-size: 13px; }
.toast.up { border-left-color: var(--up); }
.toast.down { border-left-color: var(--down); }
.toast.warn { border-left-color: var(--warn); }
.attrib { position: fixed; right: 12px; bottom: 6px; font-size: 10.5px; color: var(--dim); z-index: 5; pointer-events: auto; }
.attrib a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .view-trade.active { grid-template-columns: 240px minmax(0, 1fr) 300px; }
  .hide-md { display: none; }
  .feeds { display: none; }
}
@media (max-width: 1100px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; grid-template-rows: 58px 46px auto; }
  .main { overflow: visible; }
  .page { overflow: visible; }
  .view-trade.active {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "chart chart" "side side" "bottom bottom" "watch watch";
  }
  .chartpanel { height: 600px; }
  .side { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .book { height: 560px; }
  .bottom { height: 360px; }
  .watch { height: 520px; }
  .grid3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .grid-news { grid-template-columns: 1fr; height: auto; }
  .grid-alerts { grid-template-columns: 1fr; }
  .clock { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 46px auto; padding-bottom: 66px; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 62px;
    flex-direction: row; padding: 0 4px; border-right: 0; border-top: 1px solid var(--line); grid-row: auto;
  }
  .brand, .nav-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav-btn { width: auto; flex: 1; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .search { width: 100%; }
  .search-results { width: 100%; }
  .acct { margin-left: 0; width: 100%; justify-content: space-between; gap: 10px; }
  .stat b { font-size: 13px; }
  .demo-badge { display: none; }
  .view-trade.active { padding: 6px 0; grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "side" "bottom" "watch"; }
  .chartpanel { height: 520px; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .book { height: 480px; }
  .symbar { gap: 12px; }
  .sym-tools { margin-left: 0; }
  .page { padding: 16px; }
  .movers { grid-template-columns: 1fr; }
  .movers > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .h480, .h540 { height: 420px; }
  .attrib { display: none; }
  .toasts { bottom: 76px; }
}
