:root {
  --bg: #f4f5f7; --panel: #ffffff; --line: #e6e8eb; --line-2: #f0f1f3; --text: #22262b; --text-2: #5f6670; --text-3: #9aa1aa;
  --brand: #0f766e; --brand-2: #e6f4f2; --up: #0b9a5c; --dn: #e0413c; --up-bg: #e8f6ef; --dn-bg: #fdecec; --warn: #b7791f;
  --chip: #eef0f2; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #121417; --panel: #1b1e22; --line: #2a2e34; --line-2: #22262b; --text: #e6e8eb; --text-2: #a3aab3; --text-3: #6d7580;
  --brand: #2bb3a3; --brand-2: #173532; --up: #34c27a; --dn: #f0625c; --up-bg: #15302a; --dn-bg: #3a1d1d; --chip: #262a30; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417; --panel: #1b1e22; --line: #2a2e34; --line-2: #22262b; --text: #e6e8eb; --text-2: #a3aab3; --text-3: #6d7580;
    --brand: #2bb3a3; --brand-2: #173532; --up: #34c27a; --dn: #f0625c; --up-bg: #15302a; --dn-bg: #3a1d1d; --chip: #262a30; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.up { color: var(--up); } .dn { color: var(--dn); } .mut { color: var(--text-2); } .mut3 { color: var(--text-3); }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; letter-spacing: -.2px; min-width: 120px; }
.brand b { color: var(--brand); }
nav { display: flex; gap: 2px; height: 100%; }
nav a { display: flex; align-items: center; padding: 0 14px; color: var(--text-2); font-size: 13px; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text); }
nav a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.m-only { display: none !important; }
.acct { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.clock { font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.dot.ok { background: var(--up); } .dot.bad { background: var(--dn); }
.acct-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding: 4px 10px; border-radius: 6px; background: var(--brand-2); color: var(--brand); font-weight: 600; font-size: 12px; }
.acct-chip small { font-weight: 400; color: var(--text-2); font-size: 11px; }
.icon { border: 1px solid var(--line); background: var(--panel); color: var(--text-2); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; }

/* layout */
.wrap { display: flex; align-items: flex-start; }
.watch { position: sticky; top: 52px; width: 320px; flex: none; height: calc(100vh - 52px); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
.watch-head { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.wrow { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; }
.wrow:hover { background: var(--bg); }
.wrow.on { background: var(--brand-2); border-left-color: var(--brand); }
.wrow .n { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .s { font-size: 11px; color: var(--text-3); }
.wrow .l { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.wrow .c { font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* index cards (sidebar) + mobile strip */
.idx { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.ic { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.ic:nth-child(odd) { border-right: 1px solid var(--line-2); }
.ic .in { font-size: 11px; color: var(--text-2); font-weight: 600; letter-spacing: .3px; }
.ic .iv { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ic .iv small { font-size: 10px; }
.ic .id { font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.idx-m { display: none; }
.pnl-chip { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pnl-chip .mut { font-weight: 400; margin-right: 4px; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 360px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); animation: tin .25s ease-out; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast b { font-weight: 600; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* symbol page */
.sym-head { display: flex; gap: 14px; align-items: flex-start; }
.sym-head .icon { font-size: 18px; line-height: 1; }
.sh-t { font-size: 20px; font-weight: 600; }
.big-ex { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--chip); color: var(--text-2); margin-left: 8px; vertical-align: middle; }
.sh-s { font-size: 12px; margin-top: 2px; }
.sh-p { margin-top: 6px; font-variant-numeric: tabular-nums; }
.sh-l { font-size: 24px; font-weight: 600; margin-right: 6px; }
.tv { height: 360px; }
.ov { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px 16px; }
.ovv { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
table.depth td { position: relative; }
.bar { position: absolute; top: 6px; bottom: 6px; right: 0; opacity: .14; border-radius: 2px; }
.bar.b { background: var(--up); } .bar.a { background: var(--dn); left: 0; right: auto; }
.bs { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.bsbar { flex: 1; height: 4px; border-radius: 2px; background: var(--dn); overflow: hidden; }
.bsbar span { display: block; height: 100%; background: var(--up); }
tr.link { cursor: pointer; } tr.link:hover td { background: var(--bg); }
.clickable { display: block; } .clickable:hover { border-color: var(--brand); }
.arr { color: var(--text-3); }
.lnk { color: var(--brand); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty svg { display: block; margin: 0 auto 12px; }
.flash-up { animation: fu .7s; } .flash-dn { animation: fd .7s; }
@keyframes fu { from { background: var(--up-bg); } to { background: transparent; } }
@keyframes fd { from { background: var(--dn-bg); } to { background: transparent; } }
main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.empty { padding: 48px 16px; text-align: center; color: var(--text-3); }

/* blocks */
h2 { font-size: 18px; font-weight: 500; margin: 0 0 16px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.big { font-size: 26px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.lbl { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; }
.kv > div:nth-child(odd) { color: var(--text-2); }
.kv > div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.kv .tot { font-weight: 600; color: var(--text) !important; border-top: 1px solid var(--line); padding-top: 10px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .cnt { font-size: 11px; color: var(--text-3); margin-left: 4px; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th.num, td.num { text-align: right; }
tr.tot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
tr.closed td { color: var(--text-3); }
tr.closed td.pl { opacity: .85; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: .2px; }
.tag.BUY { background: var(--up-bg); color: var(--up); } .tag.SELL { background: var(--dn-bg); color: var(--dn); }
.st { font-size: 11px; font-weight: 600; letter-spacing: .3px; padding: 2px 7px; border-radius: 4px; background: var(--chip); color: var(--text-2); }
.st.COMPLETE { background: var(--up-bg); color: var(--up); } .st.CANCELLED { color: var(--text-3); } .st.REJECTED { background: var(--dn-bg); color: var(--dn); }
.st.OPEN, .st.TRIGGER { background: var(--brand-2); color: var(--brand); }
.ex { font-size: 10px; color: var(--text-3); margin-left: 5px; }
.prod { font-size: 11px; color: var(--text-2); background: var(--chip); padding: 1px 6px; border-radius: 3px; }

/* chart + calendar */
.chart svg { display: block; width: 100%; height: auto; }
.chart .ax { stroke: var(--line); } .chart .tx { fill: var(--text-3); font-size: 10px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dh { font-size: 11px; color: var(--text-3); text-align: center; }
.cal .d { min-height: 54px; border-radius: 6px; padding: 6px 7px; background: var(--chip); font-size: 11px; display: flex; flex-direction: column; justify-content: space-between; }
.cal .d.p { background: var(--up-bg); } .cal .d.n { background: var(--dn-bg); } .cal .d.x { background: transparent; }
.cal .d b { font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.btn { font: inherit; padding: 6px 14px; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 6px; cursor: pointer; }

/* login */
.login-page { min-height: 100vh; display: flex; }
.login-wrap { margin: auto; width: 100%; max-width: 380px; padding: 24px 16px; }
.login-card { padding: 28px 26px; display: flex; flex-direction: column; }
.login-brand { font-size: 22px; margin-bottom: 18px; }
.login-card h1 { font-size: 17px; font-weight: 500; margin: 0 0 18px; }
.login-card label { font-size: 12px; color: var(--text-2); margin: 10px 0 6px; }
.login-card input { font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); width: 100%; }
.login-card input:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
.pw { position: relative; }
.pw-t { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--brand); font: inherit; font-size: 12px; cursor: pointer; padding: 6px; }
.err { min-height: 18px; color: var(--dn); font-size: 12px; margin-top: 10px; }
.login-btn { margin-top: 8px; padding: 10px; font-size: 14px; }
.login-btn:disabled { opacity: .7; cursor: default; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); min-width: 150px; padding: 6px; display: none; z-index: 20; }
.menu.open .menu-pop { display: block; }
.menu-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-pop button:hover { background: var(--bg); }
.acct-chip { cursor: default; }
.menu .acct-chip { cursor: pointer; border: 0; font: inherit; }

@media (max-width: 1100px) { .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .watch { width: 270px; } .pnl-chip { display: none; } }
@media (max-width: 860px) {
  .watch { display: none; }
  body.p-watch .watch { display: block; position: static; width: 100%; height: auto; border-right: 0; }
  body.p-watch main { display: none; }
  .m-only { display: flex !important; }
  .top { gap: 10px; padding: 0 12px; height: auto; flex-wrap: wrap; }
  .brand { min-width: 0; height: 48px; }
  nav { order: 3; width: 100%; overflow-x: auto; height: 40px; border-top: 1px solid var(--line-2); }
  nav a { padding: 0 10px; white-space: nowrap; }
  .acct .clock { display: none; }
  main { padding: 14px 16px 32px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .big { font-size: 22px; }
  .watch { top: 0; }
  body.p-watch .idx { display: none; }
  .idx-m { display: flex; gap: 18px; overflow-x: auto; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .idx-m b { font-weight: 600; margin-right: 4px; }
  .acct-chip small { display: none; }
  .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; }
  .tv { height: 300px; }
}
