/* ============================================================
   Trading Community — trading terminal UI
   Design system: 4/8/12/16/24 spacing scale, strict type steps,
   one brand accent (blue #2F80FF). Green/red reserved strictly
   for direction: buy/up/profit vs sell/down/loss.
   Dark = near-black navy. Light = clean paper white.
   Apple font stack for words, system mono for numbers.
   EVERYTHING is a demo: simulated prices, fills, brokers.
   ============================================================ */

/* hidden attribute must always win over display rules (modals, sheets) */
[hidden]{ display:none !important; }

/* ---------- theme tokens ---------- */
:root, [data-theme="dark"]{
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* surfaces */
  --bg:        #060A13;
  --bg-soft:   #0A0F1C;
  --surface:   #0E1526;
  --surface-2: #141C31;
  --surface-3: #1B2540;
  --border:    rgba(255,255,255,.09);
  --border-soft: rgba(255,255,255,.055);

  /* text */
  --text:   #F2F5FA;
  --muted:  #8A94A8;
  --faint:  #5F687E;

  /* brand + signals — green/red are directional ONLY */
  --blue:  #2F80FF;
  --blue-deep: #1B5FD6;
  --blue-soft: rgba(47,128,255,.13);
  --green: #22C55E;
  --green-deep: #159A47;
  --green-soft: rgba(34,197,94,.12);
  --red:   #F04452;
  --red-deep: #C92A38;
  --red-soft: rgba(240,68,82,.12);

  /* spacing scale */
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp6: 24px;

  /* type scale */
  --fs-hero: 28px;
  --fs-h2: 20px;
  --fs-h3: 15px;
  --fs-body: 14px;
  --fs-small: 12.5px;
  --fs-micro: 11px;

  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
}
[data-theme="light"]{
  --bg:        #F1F4F9;
  --bg-soft:   #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #ECEFF5;
  --surface-3: #E0E5EE;
  --border:    rgba(15,23,42,.10);
  --border-soft: rgba(15,23,42,.065);

  --text:   #0F172A;
  --muted:  #5B6478;
  --faint:  #93A0B4;

  --blue-soft: rgba(47,128,255,.10);
  --green-soft: rgba(34,197,94,.12);
  --red-soft: rgba(240,68,82,.10);

  --shadow: 0 10px 28px rgba(15,23,42,.10);
}

/* ---------- base ---------- */
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
body{
  margin:0; font-family:var(--font); background:var(--bg); color:var(--text);
  font-size:15px; line-height:1.45; overscroll-behavior-y:none;
  -webkit-font-smoothing:antialiased;
}
button{ font-family:var(--font); color:inherit; background:none; border:0; padding:0; cursor:pointer; min-height:44px; }
input,select{ font-family:var(--font); }
h1,h2,h3{ margin:0; font-weight:700; letter-spacing:-.01em; }
h3{ font-size:var(--fs-h3); }
p{ margin:0; }
.num{ font-family:var(--mono); font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.view{ display:none; height:100dvh; }
.view.active{ display:block; }
.fine{ font-size:var(--fs-small); color:var(--faint); }
.demo-tag{
  display:inline-block; font-size:10.5px; font-weight:700; letter-spacing:.06em;
  color:var(--blue); background:var(--blue-soft); border-radius:6px; padding:3px 8px;
  text-transform:uppercase; vertical-align:middle;
}

/* icons */
.ic{ display:inline-flex; align-items:center; justify-content:center; }
.ic svg{ width:22px; height:22px; }
.ic.sm svg{ width:16px; height:16px; }
.ic.xs svg{ width:14px; height:14px; }

/* ---------- app shell ---------- */
.app-shell{ display:flex; height:100dvh; }
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.content{ flex:1; overflow-y:auto; padding:var(--sp4) var(--sp4) 104px; -webkit-overflow-scrolling:touch; }
.screen{ display:none; max-width:1460px; margin:0 auto; }
.screen.active{ display:block; animation:fadein .18s ease; }
@keyframes fadein{ from{ opacity:0; transform:translateY(4px);} to{ opacity:1; transform:none;} }

/* ---------- sidebar (desktop) ---------- */
.sidebar{ display:none; }
@media (min-width:1024px){
  .sidebar{
    display:flex; flex-direction:column; width:236px; flex-shrink:0;
    background:var(--bg-soft); border-right:1px solid var(--border-soft); padding:20px var(--sp3);
  }
  .side-brand{ display:flex; gap:10px; align-items:center; padding:4px 8px 18px; }
  .side-brand b{ display:block; font-size:14.5px; }
  .side-brand span{ font-size:12px; color:var(--faint); }
  .side-nav{ display:flex; flex-direction:column; gap:2px; }
  .snav{
    display:flex; align-items:center; gap:12px; padding:0 12px; border-radius:var(--r-md);
    font-size:14.5px; font-weight:600; color:var(--muted); min-height:48px; position:relative; text-align:left;
  }
  .snav.active{ color:var(--text); background:var(--surface-2); }
  .snav.active .ic{ color:var(--blue); }
  .side-foot{ margin-top:auto; display:flex; flex-direction:column; gap:2px; }
  .side-row{
    display:flex; align-items:center; gap:12px; padding:0 12px; min-height:48px;
    border-radius:var(--r-md); font-size:14px; font-weight:600; color:var(--muted); text-align:left;
  }
  .side-row b{ margin-left:auto; font-size:12.5px; color:var(--faint); font-weight:600; }
  .side-user{ display:flex; gap:10px; align-items:center; padding:12px 8px 0; border-top:1px solid var(--border-soft); margin-top:8px; }
  .side-user b{ display:block; font-size:13.5px; }
  .side-user span{ font-size:12px; color:var(--faint); }
  .content{ padding:24px 24px 48px; }
}

/* ---------- appbar ---------- */
.appbar{
  display:flex; align-items:center; gap:8px; padding:8px var(--sp4);
  background:var(--bg-soft); border-bottom:1px solid var(--border-soft);
  position:sticky; top:0; z-index:20;
}
.brand-mark{
  width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:15px; color:#fff; background:var(--blue);
  flex-shrink:0;
}
.brand-mark.sm-only{ display:flex; }
@media (min-width:1024px){ .brand-mark.sm-only{ display:none; } }
.sym-picker{
  display:flex; align-items:center; gap:6px; font-size:17px; font-weight:700;
  padding:6px 10px; border-radius:var(--r-md); min-height:44px; letter-spacing:-.01em;
}
.sym-picker:active{ background:var(--surface-2); }
.px-block{ display:flex; align-items:baseline; gap:8px; min-width:0; }
.px{ font-size:18px; font-weight:700; transition:color .15s; }
.chg-pill{ font-size:13px; font-weight:700; padding:4px 10px; border-radius:20px; }
.chg-pill.up{ color:var(--green); background:var(--green-soft); }
.chg-pill.down{ color:var(--red); background:var(--red-soft); }
.appbar-sp{ flex:1; }
@media (max-width:640px){
  /* mobile: controls on line 1, big clear price on line 2 — nothing overlaps */
  .appbar{ flex-wrap:wrap; gap:6px; row-gap:2px; padding:8px 12px; }
  .px-block{ order:10; flex:1 1 100%; align-items:center; padding:2px 2px 6px; }
  .px{ font-size:21px; }
  .chg-pill{ font-size:13px; }
  .sym-picker{ font-size:16px; padding:6px 8px; }
}
.icon-btn{
  width:44px; height:44px; border-radius:12px; display:inline-flex; align-items:center; justify-content:center;
  color:var(--muted); position:relative; flex-shrink:0;
}
.icon-btn:active{ background:var(--surface-2); color:var(--text); }
.icon-btn.primary{ background:var(--blue); color:#fff; }
.icon-btn .dot{
  position:absolute; top:10px; right:11px; width:8px; height:8px; border-radius:50%;
  background:var(--red); border:2px solid var(--bg-soft);
}
.avatar-btn{
  width:38px; height:38px; border-radius:50%; background:var(--blue);
  color:#fff; font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.avatar{ border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; background:var(--blue); }
.avatar.sm{ width:34px; height:34px; font-size:12px; }
.avatar.lg{ width:64px; height:64px; font-size:20px; }

/* ---------- bottom nav (mobile) ---------- */
.bottomnav{
  position:fixed; left:0; right:0; bottom:0; z-index:30;
  display:flex; background:var(--bg-soft); border-top:1px solid var(--border-soft);
  padding-bottom:env(safe-area-inset-bottom);
}
.tab{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  min-height:66px; font-size:10.5px; font-weight:600; color:var(--faint); position:relative;
}
.tab .ic{ color:var(--faint); }
.tab.active{ color:var(--blue); font-weight:700; }
.tab.active .ic{ color:var(--blue); }
.tab-badge{
  position:absolute; top:8px; right:calc(50% - 20px); min-width:18px; height:18px; border-radius:9px;
  background:var(--red); color:#fff; font-size:10.5px; font-weight:700; font-style:normal;
  display:flex; align-items:center; justify-content:center; padding:0 5px;
}
.live-dot{
  position:absolute; top:10px; right:calc(50% - 18px); width:8px; height:8px; border-radius:50%;
  background:var(--red); box-shadow:0 0 0 3px var(--red-soft);
}
/* desktop uses the sidebar — the mobile tab bar must stay hidden there.
   Placed AFTER the base .bottomnav rule so it wins at equal specificity. */
@media (min-width:1024px){
  .bottomnav{ display:none; }
}

/* ---------- shared controls ---------- */
.field{
  width:100%; min-height:48px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); color:var(--text); font-size:15px; padding:0 14px; outline:none;
}
.field:focus{ border-color:var(--blue); }
select.field{ appearance:none; }
.primary-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--blue); color:#fff; font-weight:700; font-size:15px;
  border-radius:var(--r-md); padding:0 20px; min-height:48px;
}
.primary-btn:active{ background:var(--blue-deep); }
.primary-btn.sm{ min-height:44px; font-size:14px; }
.primary-btn:disabled{ opacity:.6; }
.ghost-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--surface-2); color:var(--text); font-weight:600; font-size:14px;
  border-radius:var(--r-md); padding:0 18px; min-height:44px; border:1px solid var(--border);
}
.ghost-btn.wide{ width:100%; margin-top:10px; }
.link-btn{
  display:inline-flex; align-items:center; gap:6px; color:var(--blue);
  font-weight:700; font-size:13.5px; min-height:44px; padding:0 4px;
}
.sec-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:20px 2px 12px; }
.sec-head:first-child{ margin-top:2px; }
.card{
  background:var(--surface); border:1px solid var(--border-soft);
  border-radius:var(--r-lg); padding:var(--sp4); margin-bottom:var(--sp3);
}
.fld{ margin-bottom:var(--sp3); }
.fld label, .fld-label{ display:block; font-size:var(--fs-small); font-weight:600; color:var(--muted); margin-bottom:7px; }
.fld-label .field{ margin-top:7px; }
.fld-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.form-row{ display:flex; gap:10px; margin-top:4px; }
.form-row .primary-btn{ flex:1; }

/* tick flash — the heartbeat */
@keyframes tickUp{ 0%{ background:var(--green-soft);} 100%{ background:transparent;} }
@keyframes tickDown{ 0%{ background:var(--red-soft);} 100%{ background:transparent;} }
.flash-up{ animation:tickUp .15s ease-out; border-radius:6px; }
.flash-down{ animation:tickDown .15s ease-out; border-radius:6px; }

/* toast */
.toast{
  position:fixed; left:50%; bottom:96px; transform:translateX(-50%); z-index:100;
  pointer-events:none; /* toasts must never swallow taps on buttons beneath them */
  background:var(--surface-3); color:var(--text); font-size:13.5px; font-weight:600;
  padding:12px 18px; border-radius:24px; border:1px solid var(--border);
  box-shadow:var(--shadow); max-width:92vw; text-align:center;
}
@media (min-width:1024px){ .toast{ bottom:32px; } }

/* ---------- account strip ---------- */
.acct-strip{
  display:flex; gap:8px; overflow-x:auto; padding:2px 2px var(--sp3);
  scroll-snap-type:x mandatory; scrollbar-width:none;
}
.acct-strip::-webkit-scrollbar{ display:none; }
.acct{
  flex:1 0 auto; min-width:120px; scroll-snap-align:start;
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--r-md);
  padding:11px 13px;
}
.acct span{ display:block; font-size:10.5px; font-weight:700; color:var(--faint); text-transform:uppercase; letter-spacing:.07em; margin-bottom:5px; }
.acct b{ font-size:15px; font-weight:700; }
.acct b.warn{ color:var(--red); }

/* ---------- symbol header ---------- */
.sym-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:4px 2px var(--sp4);
}
.sym-title h2{ font-size:var(--fs-h2); letter-spacing:-.02em; }
.sym-title span{ font-size:var(--fs-small); color:var(--faint); }
.sym-px{ text-align:right; }
.sym-px .big{ font-size:var(--fs-hero); font-weight:700; letter-spacing:-.02em; }
.spread-tag{ font-size:12px; color:var(--faint); margin-top:3px; }
.spread-tag b{ color:var(--muted); font-weight:600; }

/* ---------- trade grid ----------
   Mobile flow: watchlist → chart → ticket → market data.
   Desktop: watchlist | chart / data | ticket (ticket spans). */
.trade-grid{ display:flex; flex-direction:column; gap:var(--sp4); }
.col-watch{ order:1; }
.col-chart{ order:2; }
.col-ticket{ order:3; display:flex; flex-direction:column; gap:var(--sp4); }
.col-data{ order:4; }
@media (min-width:1024px){
  .trade-grid{
    display:grid; grid-template-columns:232px minmax(0,1fr) 340px;
    gap:var(--sp4); align-items:start;
  }
  .col-watch{ grid-column:1; grid-row:1 / span 2; order:0; }
  .col-chart{ grid-column:2; grid-row:1; order:0; }
  .col-ticket{ grid-column:3; grid-row:1 / span 2; order:0; }
  .col-data{ grid-column:2; grid-row:2; order:0; }
}

/* ---------- watchlist ---------- */
.watchlist{
  display:flex; gap:8px; overflow-x:auto; padding:2px 2px 4px;
  scrollbar-width:none;
}
.watchlist::-webkit-scrollbar{ display:none; }
.wl-item{
  flex:0 0 auto; min-width:132px; text-align:left;
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--r-md);
  padding:11px 13px; min-height:68px; display:flex; flex-direction:column; justify-content:center; gap:3px;
}
.wl-item b{ font-size:13.5px; font-weight:700; letter-spacing:-.01em; }
.wl-item .num{ font-size:13.5px; font-weight:600; }
.wl-item .chg{ font-size:12px; font-weight:700; font-family:var(--mono); }
.wl-item .chg.up{ color:var(--green); } .wl-item .chg.down{ color:var(--red); }
.wl-item.current{ border:1.5px solid var(--blue); background:var(--blue-soft); }
@media (min-width:1024px){
  .watchlist{ flex-direction:column; overflow:visible; }
  .wl-item{ min-width:0; width:100%; flex-direction:row; align-items:center; justify-content:space-between; min-height:58px; }
  .wl-item .wl-px{ text-align:right; display:flex; flex-direction:column; gap:2px; }
}

/* ---------- chart ---------- */
.tf-bar{ display:flex; gap:2px; margin-bottom:10px; overflow-x:auto; scrollbar-width:none; }
.tf-bar::-webkit-scrollbar{ display:none; }
.tf{
  padding:6px 14px; border-radius:9px; font-size:13px; font-weight:600; color:var(--muted);
  min-height:40px; white-space:nowrap; font-family:var(--mono);
}
.tf.active{ color:var(--blue); background:var(--blue-soft); font-weight:700; }
.chart-wrap{
  position:relative; height:340px; background:var(--bg-soft);
  border:1px solid var(--border-soft); border-radius:var(--r-lg); overflow:hidden;
}
@media (min-width:1024px){ .chart-wrap{ height:440px; } }
.tv-host{ position:absolute; inset:0; }
.lw-legend{
  position:absolute; top:10px; left:12px; z-index:5; display:flex; gap:10px; align-items:baseline;
  font-size:11px; color:var(--muted); pointer-events:none; white-space:nowrap;
}
.lw-legend b{ color:var(--text); font-size:12px; }
.lw-legend .lg-tf{ color:var(--blue); font-weight:700; }
.lw-legend i{ font-style:normal; color:var(--text); }
.lw-legend .up{ color:var(--green); }
.lw-legend .down{ color:var(--red); }
.lw-err{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  text-align:center; color:var(--muted); font-size:13px; line-height:1.7; padding:20px;
}

/* ---------- market data: depth + tape ---------- */
.md-card{
  background:var(--surface); border:1px solid var(--border-soft);
  border-radius:var(--r-lg); overflow:hidden;
}
.md-tabs{ display:flex; border-bottom:1px solid var(--border-soft); }
.md-tab{
  flex:1; min-height:48px; font-size:13.5px; font-weight:600; color:var(--muted);
  border-bottom:2px solid transparent;
}
.md-tab.active{ color:var(--text); border-bottom-color:var(--blue); font-weight:700; }
.md-body{ padding:8px 0 10px; }
.ob-head, .ob-row{
  display:grid; grid-template-columns:1fr 1fr 1fr; padding:6px 16px;
  font-size:12.5px;
}
.ob-head{ color:var(--faint); font-weight:700; font-size:10.5px; text-transform:uppercase; letter-spacing:.07em; }
.ob-head span:nth-child(n+2), .ob-row span:nth-child(n+2){ text-align:right; }
.ob-row{ position:relative; font-family:var(--mono); min-height:34px; align-items:center; font-weight:500; }
.ob-row span{ position:relative; z-index:1; }
.ob-row .bar{ position:absolute; top:3px; bottom:3px; right:4px; border-radius:4px; z-index:0; }
.ob-row.ask .bar{ background:var(--red-soft); }
.ob-row.bid .bar{ background:var(--green-soft); }
.ob-row.ask span:first-child{ color:var(--red); font-weight:600; }
.ob-row.bid span:first-child{ color:var(--green); font-weight:600; }
.ob-spread{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; border-top:1px solid var(--border-soft); border-bottom:1px solid var(--border-soft);
  margin:6px 0; background:var(--bg-soft);
}
.ob-spread .num{ font-size:16px; font-weight:700; }
.ob-spread-lbl{ font-size:12px; color:var(--faint); }
.ob-spread-lbl b{ color:var(--muted); }
#tapeBody .ob-row span:first-child{ color:var(--faint); font-size:11.5px; }

/* ---------- order ticket ---------- */
.ticket{
  background:var(--surface); border:1px solid var(--border-soft);
  border-radius:var(--r-lg); padding:var(--sp4);
}
.ttype-tabs{
  display:grid; grid-template-columns:1fr 1fr 1fr; background:var(--surface-2);
  border-radius:var(--r-md); padding:3px; margin-bottom:var(--sp3);
}
.ttype{ min-height:44px; font-size:13.5px; font-weight:600; color:var(--muted); border-radius:9px; }
.ttype.active{ background:var(--surface-3); color:var(--text); font-weight:700; }
.dir-toggle{
  display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:var(--sp4);
}
.dir-btn{
  min-height:48px; border-radius:var(--r-md); font-size:15px; font-weight:700;
  background:var(--surface-2); color:var(--muted); border:1px solid var(--border);
}
.dir-btn.buy.active{ background:var(--green); border-color:var(--green); color:#fff; }
.dir-btn.sell.active{ background:var(--red); border-color:var(--red); color:#fff; }
.stepper{
  display:flex; align-items:center; justify-content:space-between;
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md);
  min-height:52px; padding:0 6px;
}
.stepper button{
  width:48px; height:44px; border-radius:9px; display:flex; align-items:center; justify-content:center;
  color:var(--muted);
}
.stepper button:active{ background:var(--surface-3); color:var(--text); }
.stepper .num{ font-size:16px; font-weight:700; }
.switch-row{
  display:flex; align-items:center; justify-content:space-between; width:100%;
  font-size:var(--fs-body); font-weight:600; padding:8px 0; margin-bottom:4px;
}
.switch{
  width:48px; height:29px; border-radius:15px; background:var(--surface-3);
  position:relative; transition:background .18s; flex-shrink:0; border:1px solid var(--border);
}
.switch i{
  position:absolute; top:3px; left:3px; width:21px; height:21px; border-radius:50%;
  background:#fff; transition:left .18s; box-shadow:0 1px 3px rgba(0,0,0,.25);
}
.switch-row[aria-pressed="true"] .switch{ background:var(--blue); border-color:var(--blue); }
.switch-row[aria-pressed="true"] .switch i{ left:22px; }
.tpsl-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.risk-line{
  font-size:var(--fs-small); color:var(--muted); padding:12px 2px;
  display:flex; gap:6px; align-items:center; flex-wrap:wrap;
}
.risk-line b{ color:var(--text); }
.risk-line .sep{ color:var(--faint); }
.exec-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:2px; }
.exec{
  border-radius:14px; min-height:66px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:3px; color:#fff;
  transition:transform .08s ease;
}
.exec span{ font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; opacity:.92; }
.exec b{ font-size:17px; font-weight:700; }
.exec.buy{ background:var(--green); }
.exec.buy:active{ background:var(--green-deep); transform:scale(.98); }
.exec.sell{ background:var(--red); }
.exec.sell:active{ background:var(--red-deep); transform:scale(.98); }
.ticket .fine{ margin-top:12px; text-align:center; }

/* ---------- alerts ---------- */
.alerts-card{
  background:var(--surface); border:1px solid var(--border-soft);
  border-radius:var(--r-lg); padding:var(--sp4);
}
.alert-form{ background:var(--surface-2); border-radius:var(--r-md); padding:14px; margin-bottom:12px; }
.alert-row{
  display:flex; align-items:center; gap:10px; padding:12px 2px;
  border-bottom:1px solid var(--border-soft); min-height:58px;
}
.alert-row:last-child{ border-bottom:0; }
.alert-row .ic{ color:var(--blue); flex-shrink:0; }
.alert-row.triggered .ic{ color:var(--green); }
.alert-row div{ flex:1; min-width:0; }
.alert-row b{ display:block; font-size:14px; }
.alert-row span{ font-size:12px; color:var(--faint); }
.alert-row .del{ color:var(--faint); width:44px; height:44px; display:flex; align-items:center; justify-content:center; }
.alert-row .del:active{ color:var(--red); }
.alerts-empty{ padding:16px 4px; }

/* ---------- positions ---------- */
.subtabs{
  display:grid; grid-template-columns:1fr 1fr 1fr; background:var(--surface-2);
  border-radius:var(--r-md); padding:3px; margin-bottom:var(--sp3);
}
.subtab{
  min-height:44px; font-size:13.5px; font-weight:600; color:var(--muted);
  border-radius:9px; display:flex; align-items:center; justify-content:center; gap:6px;
}
.subtab.active{ background:var(--surface-3); color:var(--text); font-weight:700; }
.subtab .cnt{
  font-size:11px; font-weight:700; background:var(--blue-soft); color:var(--blue);
  border-radius:10px; padding:2px 8px; font-family:var(--mono);
}
.eq-chip{
  font-size:var(--fs-small); color:var(--muted); background:var(--surface);
  border:1px solid var(--border-soft); border-radius:20px; padding:7px 14px; font-weight:600;
}
.eq-chip b{ color:var(--text); margin-left:4px; }
.pos-card{
  background:var(--surface); border:1px solid var(--border-soft);
  border-radius:var(--r-lg); padding:var(--sp4); margin-bottom:10px;
}
.pos-top{ display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.pos-sym{ font-weight:700; font-size:15px; letter-spacing:-.01em; }
.dir{ font-size:11px; font-weight:800; letter-spacing:.06em; border-radius:6px; padding:4px 9px; }
.dir.buy{ color:var(--green); background:var(--green-soft); }
.dir.sell{ color:var(--red); background:var(--red-soft); }
.pos-lots{ font-size:12.5px; color:var(--muted); font-family:var(--mono); }
.pos-close{
  margin-left:auto; width:44px; height:44px; border-radius:11px; color:var(--faint);
  font-size:20px; line-height:1; display:flex; align-items:center; justify-content:center;
}
.pos-close:active{ background:var(--red-soft); color:var(--red); }
.pos-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.pos-col span{ display:block; font-size:10.5px; font-weight:700; color:var(--faint); text-transform:uppercase; letter-spacing:.07em; margin-bottom:4px; }
.pos-col b{ font-size:14px; font-weight:700; font-family:var(--mono); }
.pl-pos{ color:var(--green) !important; } .pl-neg{ color:var(--red) !important; }
.pos-tpsl{ display:flex; gap:14px; margin-top:12px; font-size:12.5px; color:var(--muted); }
.pos-tpsl b{ font-family:var(--mono); color:var(--text); font-weight:600; }
.mirror-badge{
  display:inline-flex; align-items:center; gap:6px; margin-top:12px;
  font-size:11.5px; font-weight:600; color:var(--green);
  background:var(--green-soft); border-radius:6px; padding:5px 10px; font-family:var(--mono);
}
.mirror-badge.demo{ color:var(--muted); background:var(--surface-2); font-family:var(--font); }
.mdot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.empty{ text-align:center; color:var(--faint); font-size:13.5px; padding:40px 16px; line-height:1.6; }

/* ---------- live ---------- */
.live-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:4px 2px var(--sp4);
}
.live-id{ display:flex; gap:12px; align-items:center; min-width:0; }
.live-id .avatar{ width:46px; height:46px; font-size:15px; flex-shrink:0; }
.live-id b{ display:block; font-size:15px; }
.handle{ color:var(--faint); font-weight:500; font-size:13px; }
.live-sub{ display:block; font-size:12.5px; color:var(--muted); margin-top:1px; }
.live-meta{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.live-pill{
  display:inline-flex; align-items:center; gap:6px; background:var(--red); color:#fff;
  font-size:11.5px; font-weight:800; letter-spacing:.07em; border-radius:7px; padding:6px 11px;
}
.live-pill i{ width:7px; height:7px; border-radius:50%; background:#fff; animation:blink 1.4s infinite; }
@keyframes blink{ 50%{ opacity:.35; } }
#viewerCount{ font-size:13px; color:var(--muted); font-weight:600; }
.chart-wrap.live-chart{ height:300px; }
@media (min-width:1024px){ .chart-wrap.live-chart{ height:420px; } }

/* UNMISSABLE Go Live entry point */
.go-live-btn{
  width:100%; min-height:64px; margin:0 0 var(--sp4); border-radius:var(--r-lg);
  background:var(--red); color:#fff;
  display:flex; align-items:center; justify-content:center; gap:12px;
  box-shadow:0 10px 28px rgba(240,68,82,.35);
  transition:transform .08s ease;
}
.go-live-btn:active{ transform:scale(.98); background:var(--red-deep); }
.golive-dot{
  width:13px; height:13px; border-radius:50%; background:#fff; flex-shrink:0;
  animation:blink 1.4s infinite;
}
.golive-txt{ display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left; }
.golive-txt b{ font-size:16.5px; font-weight:800; letter-spacing:.01em; }
.golive-txt small{ font-size:12.5px; font-weight:600; opacity:.88; }

.face-cam{
  position:absolute; width:124px; height:156px; right:12px; bottom:12px;
  border-radius:14px; background:var(--surface-2);
  border:1px solid var(--border); display:flex; align-items:center; justify-content:center;
  touch-action:none; cursor:move;
  box-shadow:var(--shadow); z-index:5; overflow:hidden;
}
.fc-resize{
  position:absolute; right:3px; bottom:3px; width:26px; height:26px; cursor:nwse-resize;
  border-right:3px solid var(--faint); border-bottom:3px solid var(--faint);
  border-bottom-right-radius:12px; opacity:.7; z-index:6;
}
#faceCamVideo{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; background:#000; }
.fc-empty{
  position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:9px; padding:12px; text-align:center;
}
.fc-cam-ic{ color:var(--faint); }
.fc-cam-ic svg{ width:30px; height:30px; }
.fc-label{ font-size:12px; font-weight:700; color:var(--muted); }
.fc-cam-btn{
  font-size:12px; font-weight:700; color:#fff; background:var(--blue);
  border-radius:9px; padding:9px 14px; min-height:38px;
}
.fc-cam-btn:active{ background:var(--blue-deep); }

.live-grid{ display:flex; flex-direction:column; gap:var(--sp4); margin-top:var(--sp4); }
@media (min-width:1024px){ .live-grid{ display:grid; grid-template-columns:1fr 1fr; } }
.feed{ display:flex; flex-direction:column; gap:8px; }
.feed-item{
  display:flex; align-items:center; gap:10px; background:var(--surface);
  border:1px solid var(--border-soft); border-radius:var(--r-md); padding:12px 14px; font-size:13.5px;
}
.feed-item b{ font-family:var(--mono); font-weight:600; }
.feed-item .t{ margin-left:auto; color:var(--faint); font-size:12px; font-family:var(--mono); }
.copy-switch{
  display:inline-flex; align-items:center; gap:8px; font-size:13px; font-weight:600; color:var(--muted);
  background:var(--surface); border:1px solid var(--border-soft); border-radius:20px; padding:6px 14px 6px 6px; min-height:44px;
}
.copy-switch i{
  width:36px; height:23px; border-radius:12px; background:var(--surface-3); position:relative; transition:background .18s;
}
.copy-switch i::after{
  content:""; position:absolute; top:3px; left:3px; width:17px; height:17px; border-radius:50%;
  background:#fff; transition:left .18s; box-shadow:0 1px 3px rgba(0,0,0,.25);
}
.copy-switch.on{ color:var(--green); border-color:var(--green-soft); }
.copy-switch.on i{ background:var(--green); }
.copy-switch.on i::after{ left:16px; }
.chat-scroll{
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--r-lg);
  height:260px; overflow-y:auto; padding:12px 14px; margin-bottom:10px;
}
.chat-msg{ font-size:13.5px; padding:5px 0; color:var(--text); }
.chat-msg b{ color:var(--blue); font-weight:700; margin-right:6px; }
.chat-msg.me b{ color:var(--green); }
.chat-bar{ display:flex; gap:8px; }
.chat-bar .field{ flex:1; }

/* ---------- community ---------- */
.trader-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:6px; }
.trader-card{
  display:flex; align-items:center; gap:12px; background:var(--surface);
  border:1px solid var(--border-soft); border-radius:var(--r-lg); padding:14px 16px; min-height:78px;
}
.trader-card .avatar{ width:46px; height:46px; font-size:15px; flex-shrink:0; position:relative; }
.trader-card > div{ flex:1; min-width:0; }
.trader-card b{ display:block; font-size:14.5px; letter-spacing:-.01em; }
.trader-card .tstat{ font-size:12.5px; color:var(--muted); font-family:var(--mono); margin-top:2px; display:block; }
.follow-btn{
  min-height:44px; padding:0 20px; border-radius:22px; font-size:13.5px; font-weight:700;
  background:var(--blue-soft); color:var(--blue); flex-shrink:0;
}
.follow-btn.following{ background:var(--surface-2); color:var(--muted); }
.trader-live{
  position:absolute; bottom:-5px; left:50%; transform:translateX(-50%);
  background:var(--red); color:#fff; font-size:9px; font-weight:800; letter-spacing:.06em;
  border-radius:5px; padding:2px 7px;
}
.poll-q{ font-size:14.5px; font-weight:600; margin-bottom:14px; }
.poll-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; font-size:13px; }
.poll-row > span{ width:56px; color:var(--muted); font-weight:600; flex-shrink:0; }
.poll-track{ flex:1; height:10px; border-radius:5px; background:var(--surface-2); overflow:hidden; }
.poll-track i{ display:block; height:100%; border-radius:5px; transition:width .5s ease; }
#pollBuyFill{ background:var(--green); } #pollSellFill{ background:var(--red); }
.poll-row b{ width:48px; text-align:right; font-size:13px; }
.poll-btns{ display:flex; gap:10px; margin-top:8px; }
.poll-btns .primary-btn, .poll-btns .ghost-btn{ flex:1; }
.poll-btns.voted .btn{ opacity:.45; pointer-events:none; }
.post-head{ display:flex; gap:10px; align-items:center; margin-bottom:10px; }
.post-head .avatar{ width:40px; height:40px; font-size:13px; flex-shrink:0; }
.post-head b{ display:block; font-size:14px; }
.post-head span{ font-size:12px; color:var(--faint); }
.post-body{ font-size:14px; line-height:1.55; margin-bottom:12px; }
.post-actions{ display:flex; gap:8px; }
.like-btn{
  display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600;
  color:var(--muted); min-height:44px; padding:0 14px; border-radius:20px; background:var(--surface-2);
}
.like-btn.liked{ color:var(--red); }

/* ---------- profile ---------- */
.prof-head{ display:flex; gap:14px; align-items:center; padding:8px 2px 18px; }
.prof-head h3{ font-size:19px; letter-spacing:-.02em; }
.prof-head .handle{ display:block; margin:3px 0 8px; }
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:6px; }
.stat{
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--r-md);
  padding:13px 8px; text-align:center;
}
.stat b{ display:block; font-size:16.5px; font-weight:700; font-family:var(--mono); letter-spacing:-.01em; }
.stat span{ font-size:10.5px; color:var(--faint); font-weight:700; text-transform:uppercase; letter-spacing:.06em; display:block; margin-top:4px; }
.broker-row{
  display:flex; align-items:center; gap:12px; background:var(--surface);
  border:1px solid var(--border-soft); border-radius:var(--r-lg); padding:14px 16px; margin-bottom:10px; min-height:78px;
}
.broker-ic{
  width:46px; height:46px; border-radius:14px; display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:14px; color:#fff; flex-shrink:0;
  background:linear-gradient(135deg, var(--g1), var(--g2));
}
.broker-ic.lg{ width:64px; height:64px; font-size:19px; border-radius:18px; margin:0 auto 12px; }
.broker-row > div{ flex:1; min-width:0; }
.broker-row b{ display:block; font-size:14.5px; }
.broker-row span{ font-size:12.5px; color:var(--muted); }
.conn-btn{
  min-height:44px; padding:0 20px; border-radius:22px; font-size:13.5px; font-weight:700;
  background:var(--blue-soft); color:var(--blue); flex-shrink:0;
  display:inline-flex; align-items:center; gap:8px;
}
.conn-btn.connected{ background:var(--green-soft); color:var(--green); }
.conn-dot{ width:7px; height:7px; border-radius:50%; background:currentColor; }

/* ---------- modal / sheet ---------- */
/* ---------- go-live setup sheet ---------- */
#liveSetupSheet{ z-index:70; }
.ls-body{ padding:2px 18px 6px; overflow-y:auto; }
.ls-cam{ position:relative; height:168px; border-radius:14px; overflow:hidden; background:var(--surface-2); margin-bottom:14px; }
.ls-cam video{ width:100%; height:100%; object-fit:cover; }
.ls-cam-empty{ position:absolute; inset:0; display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; color:var(--muted); font-size:13px; }
.ls-cam-empty .ic{ width:30px; height:30px; opacity:.7; }
.chip-row{ display:flex; gap:8px; flex-wrap:wrap; margin-top:2px; }
.ls-chip{ padding:9px 15px; border-radius:999px; border:1px solid var(--border); background:var(--surface); font-weight:700; font-size:13px; color:var(--text); }
.ls-chip.on{ background:var(--blue); border-color:var(--blue); color:#fff; }
.sheet-foot{ display:flex; gap:10px; padding:12px 18px calc(16px + env(safe-area-inset-bottom)); }
.sheet-foot .primary-btn, .sheet-foot .ghost-btn{ flex:1; min-height:48px; }
/* "what now" hint shown when the stream starts */
.live-hint{ margin:10px 14px 0; padding:12px 14px; }
.live-hint ol{ margin:8px 0 10px 20px; font-size:13px; color:var(--muted); display:grid; gap:5px; }
.live-hint ol b{ color:var(--text); }
.modal-wrap{
  position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; padding:20px;
}
.modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.6); }
[data-theme="light"] .modal-backdrop{ background:rgba(15,23,42,.45); }
.modal{
  position:relative; width:100%; max-width:400px; background:var(--bg-soft);
  border:1px solid var(--border); border-radius:18px; padding:24px 20px;
  box-shadow:var(--shadow); text-align:center; max-height:92dvh; overflow-y:auto;
}
.modal h3{ font-size:18px; margin-bottom:4px; letter-spacing:-.02em; }
.modal-sub{ font-size:13.5px; color:var(--muted); margin-bottom:18px; }
.modal-x{ position:absolute; top:10px; right:10px; width:44px; height:44px; border-radius:11px; color:var(--muted); display:flex; align-items:center; justify-content:center; }
.modal-x:active{ background:var(--surface-2); }
.modal .field{ text-align:left; margin-bottom:2px; }
.modal .primary-btn{ width:100%; margin-top:16px; }
.auth-fine{ font-size:12px; color:var(--faint); margin-top:14px; }
.backdrop{ position:fixed; inset:0; z-index:55; background:rgba(0,0,0,.55); }
.sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:56; background:var(--bg-soft);
  border-top-left-radius:18px; border-top-right-radius:18px;
  border-top:1px solid var(--border); max-height:75dvh; display:flex; flex-direction:column;
  padding-bottom:env(safe-area-inset-bottom);
}
.sheet-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px 8px; }
#symbolList{ overflow-y:auto; padding:2px 10px 14px; }

/* asset picker: search + category tabs + rows with star toggles */
.sheet-search{
  display:flex; align-items:center; gap:8px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:var(--r-md);
  margin:4px 18px 10px; padding:0 12px;
}
.sheet-search .ic{ color:var(--faint); flex-shrink:0; }
.sheet-search .field{ background:none; border:0; padding:0; min-height:48px; }
.sheet-search .field:focus{ border:0; }
.sheet-cats{
  display:flex; gap:6px; overflow-x:auto; padding:0 18px 10px;
  scrollbar-width:none;
}
.sheet-cats::-webkit-scrollbar{ display:none; }
.scat{
  flex:0 0 auto; min-height:40px; padding:0 16px; border-radius:20px;
  font-size:13px; font-weight:600; color:var(--muted);
  background:var(--surface-2); border:1px solid var(--border-soft); white-space:nowrap;
}
.scat.active{ color:#fff; background:var(--blue); border-color:var(--blue); font-weight:700; }
.sym-row{
  display:flex; align-items:center; gap:12px; width:100%; text-align:left;
  padding:10px 12px; border-radius:var(--r-md); min-height:68px; cursor:pointer;
}
.sym-row:active{ background:var(--surface-2); }
.sym-row.current{ background:var(--blue-soft); }
.fav-star{
  width:44px; height:44px; display:flex; align-items:center; justify-content:center;
  color:var(--faint); flex-shrink:0; border-radius:11px;
}
.fav-star:active{ background:var(--surface-2); }
.fav-star.on{ color:#F5A623; }
.fav-star.on svg{ fill:currentColor; }
.sym-id{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.sym-id b{ font-size:15px; letter-spacing:-.01em; }
.sym-id i{ font-style:normal; font-size:12px; color:var(--faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sym-px{ display:flex; flex-direction:column; align-items:flex-end; gap:2px; flex-shrink:0; }
.sym-px .num{ font-size:14.5px; font-weight:700; }
.sym-px .chg{ font-size:12px; font-weight:700; }
.sym-px .chg.up{ color:var(--green); } .sym-px .chg.down{ color:var(--red); }

/* watchlist: favorite marker + favorites pinned first */
.wl-sym{ display:flex; align-items:center; gap:6px; min-width:0; }
.wl-star{ color:#F5A623; flex-shrink:0; display:inline-flex; }
.wl-star svg{ width:12px; height:12px; fill:currentColor; }
@media (min-width:1024px){
  .watchlist{ max-height:660px; overflow-y:auto; }
}

/* ---------- real camera + go live ---------- */
.you-live-bar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:var(--red-soft); border:1px solid rgba(240,68,82,.45);
  border-radius:14px; padding:12px 14px; margin-bottom:var(--sp4);
}
.yl-stat{ font-size:12.5px; color:var(--muted); font-weight:600; }
.yl-stat b{ font-size:13.5px; }
.you-live-bar .danger-btn{ margin-left:auto; }
.danger-btn{
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--red); color:#fff; border:0; border-radius:11px; font-weight:700;
}
.danger-btn:active{ background:var(--red-deep); }
.danger-btn.sm{ min-height:44px; padding:0 20px; font-size:14px; }
.you-live-card{ border:1px solid rgba(240,68,82,.45); }
.yl-top{ display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.pair-badge{ font-size:11px; font-weight:800; letter-spacing:.05em; color:var(--blue); background:var(--blue-soft); border-radius:6px; padding:4px 9px; }
.yl-viewers{ margin-left:auto; font-size:12.5px; color:var(--muted); font-weight:600; }
.yl-main{ display:flex; align-items:center; gap:10px; }
.yl-main .avatar{ width:44px; height:44px; font-size:15px; flex-shrink:0; background:var(--blue); }
.yl-main b{ display:block; font-size:14.5px; }
.yl-main .tstat{ font-size:12.5px; color:var(--muted); }
.yl-main .primary-btn{ margin-left:auto; flex-shrink:0; }
.you-live-card .fine{ margin:12px 0 0; }

/* ---------- spinner (modal / busy states) ---------- */
.spinner{
  width:16px; height:16px; border:2px solid rgba(255,255,255,.35); border-top-color:#fff;
  border-radius:50%; display:inline-block; vertical-align:-3px; margin-right:8px;
  animation:spin .7s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ---------- small screens ---------- */
@media (max-width:380px){
  .pos-grid{ grid-template-columns:repeat(2,1fr); }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .exec b{ font-size:15px; }
  .sym-px .big{ font-size:24px; }
}

/* ================= SOCIAL COMMUNITY (Part A) ================= */
/* your presence card */
.you-card{
  display:flex; align-items:center; gap:12px; background:var(--surface);
  border:1px solid var(--border-soft); border-radius:var(--r-lg); padding:14px 16px; margin-bottom:4px;
}
.you-card .avatar{ width:46px; height:46px; font-size:13px; flex-shrink:0; background:var(--blue); color:#fff; }
.you-info{ flex:1; min-width:0; }
.you-info b{ display:block; font-size:14.5px; letter-spacing:-.01em; }
.you-stats{ font-size:12.5px; color:var(--muted); margin-top:2px; display:block; }
/* leaderboard tabs */
.lb-tabs{ display:flex; gap:8px; margin:2px 0 12px; }
.lb-tab{
  flex:1; min-height:44px; border-radius:22px; font-size:13.5px; font-weight:700;
  background:var(--surface-2); color:var(--muted);
}
.lb-tab.active{ background:var(--blue-soft); color:var(--blue); }
/* rank badges */
.rank{
  width:34px; height:34px; border-radius:50%; flex-shrink:0;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:800; font-family:var(--mono);
  background:var(--surface-2); color:var(--muted);
}
.rank.r1{ background:linear-gradient(135deg,#FFD76A,#C9930A); color:#3d2b00; }
.rank.r2{ background:linear-gradient(135deg,#E8EDF3,#9AA7B5); color:#2b3644; }
.rank.r3{ background:linear-gradient(135deg,#F0B27A,#A8641F); color:#3d2200; }
.lb-row{ cursor:pointer; }
.lb-info{ flex:1; min-width:0; cursor:pointer; }
.lb-stat{ text-align:right; flex-shrink:0; margin-right:4px; }
.lb-stat b{ display:block; font-size:14.5px; }
.lb-stat span{ font-size:10.5px; color:var(--faint); text-transform:uppercase; letter-spacing:.06em; font-weight:700; }
/* trader profile overlay */
body.lock-scroll{ overflow:hidden; }
.tprof-view{
  position:fixed; inset:0; z-index:90; background:var(--bg);
  display:flex; flex-direction:column;
}
.tprof-view[hidden]{ display:none !important; }
.tprof-top{
  display:flex; align-items:center; gap:10px; padding:12px 16px;
  border-bottom:1px solid var(--border-soft); background:var(--surface); flex-shrink:0;
}
.tprof-top b{ flex:1; font-size:16px; letter-spacing:-.01em; }
.tprof-back-ic{ display:inline-block; transform:rotate(90deg); }
.tprof-scroll{ flex:1; overflow-y:auto; padding:16px 16px 40px; }
.tprof-head{ display:flex; gap:14px; align-items:flex-start; margin-bottom:16px; }
.avatar.xl{ width:68px; height:68px; font-size:22px; flex-shrink:0; position:relative; }
.tprof-id{ flex:1; min-width:0; }
.tprof-id b{ font-size:18px; letter-spacing:-.02em; display:block; }
.tprof-bio{ font-size:13px; color:var(--muted); margin-top:6px; line-height:1.5; }
.watch-live-btn{
  width:100%; min-height:56px; border-radius:var(--r-md); margin-bottom:16px;
  background:var(--red-soft); color:var(--red); font-weight:700; font-size:14.5px;
  display:flex; align-items:center; justify-content:center; gap:10px;
  border:1px solid color-mix(in srgb, var(--red) 30%, transparent);
}
.tprof-stats{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:20px; }
.tstat-cell{
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--r-md);
  padding:12px 6px; text-align:center;
}
.tstat-cell b{ display:block; font-size:15.5px; font-weight:700; }
.tstat-cell span{ font-size:10px; color:var(--faint); font-weight:700; text-transform:uppercase; letter-spacing:.06em; display:block; margin-top:4px; }
/* monthly P/L bars */
.mchart{ display:flex; align-items:flex-end; gap:5px; height:88px; padding:8px 4px 0; }
.mb{ flex:1; display:flex; align-items:flex-end; justify-content:center; height:100%; }
.mb i{ display:block; width:100%; max-width:22px; border-radius:4px 4px 2px 2px; min-height:6px; }
.mb i.pos{ background:var(--green); }
.mb i.neg{ background:var(--red); }
.mchart-x{ display:flex; justify-content:space-between; font-size:11px; color:var(--faint); padding:6px 4px 2px; font-weight:600; }
/* profile recent trades */
.ttrades{ padding:6px 16px; }
.ttrade{ display:flex; align-items:center; gap:10px; padding:12px 0; border-bottom:1px solid var(--border-soft); }
.ttrade:last-child{ border-bottom:0; }
.ttrade b:first-child{ font-size:14px; }
.ttrade .dir{ font-size:11px; font-weight:800; padding:3px 8px; border-radius:6px; letter-spacing:.04em; }
.ttrade .dir.buy{ background:var(--green-soft); color:var(--green); }
.ttrade .dir.sell{ background:var(--red-soft); color:var(--red); }
.ttrade .num{ margin-left:auto; font-size:14px; font-weight:700; }
/* composer */
.composer{ display:flex; gap:10px; align-items:center; margin-bottom:12px; }
.composer .avatar{ width:40px; height:40px; font-size:11px; flex-shrink:0; background:var(--blue); color:#fff; }
.composer .field{ flex:1; min-height:48px; }
.composer .primary-btn{ flex-shrink:0; }
/* post card */
.post{ margin-bottom:12px; }
.post-head .follow-btn{ margin-left:auto; }
.follow-btn.xs{ min-height:36px; padding:0 14px; font-size:12.5px; }
.post-actions{ display:flex; gap:8px; }
.post-actions .ic.xs{ width:16px; height:16px; }
@keyframes heartPop{ 0%{transform:scale(1);} 40%{transform:scale(1.45);} 100%{transform:scale(1);} }
.like-btn.pop .heart{ display:inline-block; animation:heartPop .35s ease; }
.like-btn .heart{ font-style:normal; }
/* comments */
.comments{ margin:4px 0 10px; border-top:1px solid var(--border-soft); padding-top:6px; }
.comment{ padding:8px 0; border-bottom:1px solid var(--border-soft); }
.comment:last-child{ border-bottom:0; }
.comment b{ font-size:13px; }
.comment .ctime{ font-size:11.5px; color:var(--faint); margin-left:8px; }
.comment p{ font-size:13.5px; margin:3px 0 0; line-height:1.5; color:var(--text); }
.comment-bar{ display:flex; gap:8px; margin-top:4px; }
.comment-bar .field{ flex:1; min-height:44px; }

/* ================= UX DIRECTOR AUDIT (Part B) ================= */
/* 150ms press feedback on interactive controls */
button{ -webkit-tap-highlight-color:transparent; transition:transform .12s ease, opacity .12s ease, background-color .15s ease; }
button:active{ transform:scale(.965); }
.tab:active, .lb-tab:active, .tf:active, .subtab:active, .md-tab:active{ transform:scale(.94); }
.icon-btn:active{ transform:scale(.9); }
/* beautiful empty states */
.empty{
  text-align:center; color:var(--faint); font-size:13.5px; padding:44px 20px; line-height:1.65;
  background:var(--surface); border:1px dashed var(--border); border-radius:var(--r-lg);
}
.empty::before{
  content:"◌"; display:block; font-size:30px; margin-bottom:10px; opacity:.55;
}
/* premium toast: dark pill, centered, subtle lift */
.toast{
  background:#101828; color:#fff; border:1px solid rgba(255,255,255,.14);
  box-shadow:0 12px 32px rgba(0,0,0,.35); font-weight:600; letter-spacing:-.01em;
  animation:toastIn .22s ease-out;
}
@keyframes toastIn{ from{ opacity:0; transform:translate(-50%,8px);} to{ opacity:1; transform:translate(-50%,0);} }
/* tabular numerals on every financial value */
.tstat, .you-stats, .poll-row b, .acct b, .ob-spread b, .feed-item .t{ font-variant-numeric:tabular-nums; }
/* focus visibility for keyboard / accessibility */
button:focus-visible, input:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }
/* consistent card breathing on community */
#screen-community .card{ margin-bottom:12px; }
#screen-community .sec-head{ margin:20px 0 10px; }
#screen-community .sec-head:first-child{ margin-top:0; }

/* ---------- temporary demo password gate ---------- */
.tc-lock{
  position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(120% 120% at 50% 0%, #16233d 0%, #0b1220 70%);
  padding:24px;
}
.tc-lock[hidden]{ display:none; }
.tc-lock-card{ width:100%; max-width:340px; text-align:center; }
.tc-lock-logo{
  width:64px; height:64px; margin:0 auto 14px; border-radius:18px;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#2F80FF,#22C55E); color:#fff;
  font-weight:800; font-size:24px;
}
.tc-lock-card h2{ margin:0 0 6px; font-size:22px; }
.tc-lock-sub{ color:var(--muted); font-size:14px; margin:0 0 18px; }
.tc-lock-input{ text-align:center; font-size:20px; letter-spacing:6px; margin-bottom:12px; }
.tc-lock-go{ width:100%; }
.tc-lock-err{ color:#f87171; font-size:13px; margin:10px 0 0; }

/* ================= v15: brand logo, IG profiles, copy, accounts, KYC, LMS, hearts ================= */
.brand-logo{ width:34px; height:34px; flex:none; }
.brand-logo svg{ width:100%; height:100%; display:block; }
.brand-logo.lg{ width:64px; height:64px; margin:0 auto 12px; }
.brand-logo.sm-only{ display:none; }
@media (max-width:900px){ .brand-logo.sm-only{ display:block; } }

/* --- account switcher --- */
.acct-switch{ display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:8px 12px; margin-bottom:8px; color:var(--text); font:inherit; cursor:pointer; width:100%; text-align:left; }
.acct-switch > span:nth-child(2){ display:flex; flex-direction:column; line-height:1.25; flex:1; }
.acct-switch b{ font-size:13px; }
.acct-type{ font-size:11px; color:var(--muted); }
.acct-dot{ width:9px; height:9px; border-radius:50%; background:var(--green); flex:none; }
.acct-dot.live{ background:var(--green); box-shadow:0 0 8px rgba(34,197,94,.7); }
.acct-dot.demo{ background:var(--blue); }
.acct-row{ display:flex; align-items:center; gap:12px; padding:12px; border:1px solid var(--border); border-radius:var(--r-md); margin-bottom:8px; background:var(--surface); }
.acct-row.active{ border-color:var(--blue); }
.acct-row .a-info{ flex:1; line-height:1.35; }
.acct-row .a-info b{ font-size:14px; }
.acct-row .a-info span{ display:block; font-size:12px; color:var(--muted); }
.acct-type-pill{ font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:20px; letter-spacing:.4px; }
.acct-type-pill.demo{ background:var(--blue-soft); color:var(--blue); }
.acct-type-pill.live{ background:var(--green-soft); color:var(--green); }
.sheet-fine{ text-align:center; padding:4px 18px 18px; }

/* --- segmented control --- */
.seg{ display:flex; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); padding:4px; gap:4px; }
.seg-btn{ flex:1; border:0; background:transparent; color:var(--muted); font:inherit; font-weight:600; padding:9px; border-radius:8px; cursor:pointer; }
.seg-btn.active{ background:var(--blue); color:#fff; }

/* --- broker wordmark logos --- */
.broker-logo{ width:52px; height:52px; border-radius:14px; flex:none; display:flex; flex-direction:column; align-items:center; justify-content:center; background:linear-gradient(135deg,var(--g1),var(--g2)); color:#fff; line-height:1.1; }
.broker-logo b{ font-size:11px; font-weight:800; letter-spacing:.2px; }
.broker-logo span{ font-size:8.5px; opacity:.85; font-weight:600; }
.broker-logo.lg{ width:72px; height:72px; border-radius:20px; margin:0 auto 12px; }
.broker-logo.lg b{ font-size:14px; }
.broker-name{ font-size:15px; font-weight:700; }

/* --- IG-style trader profile --- */
.ig-head{ display:flex; gap:14px; align-items:center; padding:4px 0 12px; }
.ig-head .avatar.xl{ width:76px; height:76px; font-size:24px; flex:none; position:relative; }
.ig-id{ flex:1; min-width:0; }
.ig-id b{ font-size:16px; display:block; }
.ig-id .handle{ font-size:13px; color:var(--muted); }
.ig-bio{ font-size:13px; color:var(--text); margin-top:6px; line-height:1.45; }
.ig-actions{ display:flex; gap:8px; margin:2px 0 12px; }
.ig-actions .primary-btn, .ig-actions .ghost-btn{ flex:1; min-height:40px; }
.ig-stats{ display:flex; border-top:1px solid var(--border-soft); border-bottom:1px solid var(--border-soft); margin-bottom:4px; }
.ig-stat{ flex:1; text-align:center; padding:10px 4px; }
.ig-stat b{ display:block; font-size:15px; }
.ig-stat span{ font-size:11.5px; color:var(--muted); }
.ig-tabs{ display:flex; border-bottom:1px solid var(--border); margin:4px 0 12px; position:sticky; top:0; background:var(--bg); z-index:2; }
.ig-tab{ flex:1; border:0; background:none; color:var(--muted); font:inherit; font-size:13px; font-weight:600; padding:12px 4px; cursor:pointer; border-bottom:2px solid transparent; }
.ig-tab.active{ color:var(--text); border-bottom-color:var(--blue); }
.post-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:3px; }
.post-tile{ position:relative; aspect-ratio:1; border-radius:6px; overflow:hidden; background:var(--surface-2); border:0; padding:0; cursor:pointer; }
.post-tile canvas{ width:100%; height:100%; display:block; }
.post-tile .pt-meta{ position:absolute; left:0; right:0; bottom:0; padding:14px 8px 7px; background:linear-gradient(transparent,rgba(0,0,0,.72)); color:#fff; text-align:left; }
.post-tile .pt-meta b{ font-size:12px; display:block; }
.post-tile .pt-meta span{ font-size:11px; font-weight:700; }
.post-tile .pt-meta span.up{ color:#4ADE80; } .post-tile .pt-meta span.dn{ color:#F87171; }
.reel-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:3px; }
.reel-tile{ position:relative; aspect-ratio:9/14; border-radius:8px; overflow:hidden; border:0; padding:0; cursor:pointer; background:linear-gradient(160deg,var(--g1),var(--g2)); }
.reel-tile .rt-play{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.reel-tile .rt-play i{ width:40px; height:40px; border-radius:50%; background:rgba(0,0,0,.45); color:#fff; display:flex; align-items:center; justify-content:center; font-style:normal; font-size:16px; }
.reel-tile .rt-meta{ position:absolute; left:0; right:0; bottom:0; padding:16px 8px 8px; background:linear-gradient(transparent,rgba(0,0,0,.75)); color:#fff; text-align:left; }
.reel-tile .rt-meta b{ font-size:11.5px; display:block; line-height:1.3; }
.reel-tile .rt-meta span{ font-size:11px; opacity:.9; }
.copying-chip{ display:inline-flex; align-items:center; gap:6px; background:var(--green-soft); color:var(--green); font-size:12px; font-weight:700; padding:6px 12px; border-radius:20px; margin:8px 0; }
.eq-canvas{ width:100%; height:120px; display:block; }

/* --- reel viewer --- */
.reel-view{ position:fixed; inset:0; z-index:200; background:#000; display:flex; align-items:center; justify-content:center; }
.reel-view[hidden]{ display:none !important; }
#reelCanvas{ width:100%; height:100%; object-fit:cover; }
.reel-top{ position:absolute; top:0; left:0; right:0; display:flex; align-items:center; gap:12px; padding:calc(10px + env(safe-area-inset-top)) 14px 10px; }
.reel-prog{ flex:1; height:3px; background:rgba(255,255,255,.25); border-radius:2px; overflow:hidden; }
.reel-prog i{ display:block; height:100%; width:0; background:#fff; }
.reel-top .icon-btn{ background:rgba(0,0,0,.45); color:#fff; }
.reel-side{ position:absolute; right:10px; bottom:120px; display:flex; flex-direction:column; gap:14px; }
.reel-act{ background:rgba(0,0,0,.45); border:0; color:#fff; width:52px; height:52px; border-radius:50%; font-size:20px; cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.reel-act b{ font-size:10px; font-weight:700; }
.reel-act.liked{ color:#F04452; }
.reel-cap{ position:absolute; left:14px; right:90px; bottom:calc(20px + env(safe-area-inset-bottom)); color:#fff; }
.reel-cap b{ font-size:14px; } .reel-cap p{ font-size:13px; margin:4px 0 0; line-height:1.4; }

/* --- copy trading --- */
.warn-ic{ width:52px; height:52px; border-radius:50%; background:var(--red-soft); color:var(--red); font-size:26px; font-weight:800; display:flex; align-items:center; justify-content:center; margin:0 auto 12px; }
.copy-modal h3{ text-align:center; } .copy-modal .modal-sub{ text-align:center; }
.warn-body{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); padding:12px 14px; margin:12px 0; font-size:13.5px; line-height:1.5; }
.warn-body ul{ margin:8px 0 0; padding-left:18px; } .warn-body li{ margin:4px 0; color:var(--muted); }
.copy-chip{ background:var(--green-soft); color:var(--green); font-size:11px; font-weight:700; padding:4px 10px; border-radius:20px; }
.copy-switch.on{ background:var(--green-soft); border-color:var(--green); color:var(--green); }
.copy-badge{ display:inline-flex; align-items:center; gap:6px; background:var(--green-soft); color:var(--green); font-size:11px; font-weight:700; padding:4px 10px; border-radius:14px; margin-top:8px; }
.copy-status{ border-color:var(--green); }
.copy-status b{ color:var(--green); }

/* --- KYC --- */
.kyc-btn{ justify-content:flex-start; gap:8px; }
.kyc-status{ margin-left:auto; font-size:11.5px; padding:3px 10px; border-radius:12px; background:var(--surface-3); color:var(--muted); }
.kyc-status.pending{ background:rgba(245,166,35,.15); color:#F5A623; }
.kyc-status.verified{ background:var(--green-soft); color:var(--green); }
.kyc-step{ display:flex; gap:12px; align-items:flex-start; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:14px; margin-bottom:10px; }
.kyc-step.done{ border-color:var(--green); }
.kyc-n{ width:28px; height:28px; border-radius:50%; background:var(--surface-3); color:var(--muted); font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; flex:none; }
.kyc-step.done .kyc-n{ background:var(--green); color:#fff; }
.kyc-step .k-info{ flex:1; } .kyc-step b{ font-size:14px; } .kyc-step p{ font-size:12.5px; color:var(--muted); margin:4px 0 8px; }
.doc-upload{ display:flex; gap:8px; }
.doc-btn{ flex:1; border:1.5px dashed var(--border); border-radius:var(--r-md); background:var(--surface-2); color:var(--muted); padding:16px 8px; font:inherit; font-size:12.5px; cursor:pointer; text-align:center; }
.doc-btn.has{ border-style:solid; border-color:var(--green); color:var(--green); }

/* --- classes / LMS --- */
.course-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:6px; }
.course-card{ display:flex; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); padding:12px; cursor:pointer; text-align:left; width:100%; color:var(--text); font:inherit; }
.course-thumb{ width:76px; height:76px; border-radius:12px; flex:none; display:flex; align-items:center; justify-content:center; font-size:28px; background:linear-gradient(135deg,var(--g1),var(--g2)); }
.course-card .c-info{ flex:1; min-width:0; }
.course-card b{ font-size:14px; display:block; }
.course-card .c-sub{ font-size:12px; color:var(--muted); display:block; margin:3px 0 8px; }
.prog{ height:6px; background:var(--surface-3); border-radius:3px; overflow:hidden; }
.prog i{ display:block; height:100%; background:linear-gradient(90deg,var(--blue),var(--green)); border-radius:3px; }
.prog-lbl{ font-size:11px; color:var(--muted); margin-top:4px; display:block; }
.lesson-row{ display:flex; align-items:center; gap:12px; width:100%; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); padding:12px; margin-bottom:8px; color:var(--text); font:inherit; cursor:pointer; text-align:left; }
.lesson-row.done{ opacity:.75; }
.lesson-n{ width:34px; height:34px; border-radius:50%; background:var(--surface-3); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex:none; }
.lesson-row.done .lesson-n{ background:var(--green-soft); color:var(--green); }
.lesson-row .l-info{ flex:1; } .lesson-row b{ font-size:13.5px; display:block; }
.lesson-row span{ font-size:12px; color:var(--muted); }
.lesson-body{ font-size:14px; line-height:1.65; }
.lesson-body h4{ margin:16px 0 8px; font-size:15px; }
.lesson-video{ aspect-ratio:16/9; border-radius:var(--r-md); background:linear-gradient(135deg,#0E1526,#1B2540); display:flex; align-items:center; justify-content:center; margin-bottom:14px; position:relative; overflow:hidden; }
.lesson-video i{ width:60px; height:60px; border-radius:50%; background:var(--blue); color:#fff; display:flex; align-items:center; justify-content:center; font-style:normal; font-size:22px; }

/* --- live hearts (tiktok-style) --- */
.live-hearts{ position:absolute; inset:0; pointer-events:none; overflow:hidden; z-index:5; }
.f-heart{ position:absolute; bottom:70px; font-size:22px; animation:floatUp 2.2s ease-out forwards; }
@keyframes floatUp{ 0%{ transform:translateY(0) scale(.6); opacity:0; } 15%{ opacity:1; } 100%{ transform:translateY(-260px) translateX(var(--dx,20px)) scale(1.25); opacity:0; } }
.icon-btn.heart{ color:#F04452; font-size:19px; }

/* --- own profile --- */
.prof-id{ flex:1; } .prof-bio{ font-size:13px; color:var(--muted); margin-top:4px; line-height:1.45; }
.prof-actions{ display:flex; gap:8px; margin:12px 0; }
.prof-actions .ghost-btn{ flex:1; min-height:42px; }
.prof-tabs{ display:flex; border-bottom:1px solid var(--border); margin:6px 0 12px; }
.ptab{ flex:1; border:0; background:none; color:var(--muted); font:inherit; font-size:13.5px; font-weight:600; padding:12px 4px; cursor:pointer; border-bottom:2px solid transparent; }
.ptab.active{ color:var(--text); border-bottom-color:var(--blue); }
.new-reel-btn{ width:100%; margin-bottom:10px; }

/* ================= v15b: quick trade, idea sheet, watch mode, idea posts ================= */
.chart-wrap{ position:relative; }
.chart-toprow{ display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.chart-toprow .tf-bar{ flex:1; min-width:0; margin-bottom:0; }
.idea-fab{ position:static; flex-shrink:0; z-index:6; display:flex; align-items:center; gap:6px; white-space:nowrap;
  background:rgba(10,15,28,.82); border:1px solid var(--border); color:var(--text);
  font:inherit; font-size:12px; font-weight:600; padding:8px 12px; border-radius:20px; cursor:pointer; backdrop-filter:blur(6px); }
.idea-fab:active{ transform:scale(.96); }
.quick-trade{ position:absolute; right:10px; bottom:12px; z-index:6; display:flex; gap:8px; }
.qt{ border:0; border-radius:12px; padding:12px 18px; font:inherit; font-size:13px; font-weight:800; letter-spacing:.5px; color:#fff; cursor:pointer; box-shadow:var(--shadow); }
.qt:active{ transform:scale(.94); }
.qt.buy{ background:linear-gradient(135deg,#22C55E,#159A47); }
.qt.sell{ background:linear-gradient(135deg,#F04452,#C92A38); }
.watch-bar{ display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--blue);
  border-radius:var(--r-md); padding:10px 14px; margin-bottom:10px; font-size:13.5px; }
.watch-bar .ghost-btn{ margin-left:auto; }
.fc-tag{ position:absolute; top:6px; left:8px; z-index:3; background:rgba(0,0,0,.55); color:#fff;
  font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:10px; }
.face-cam.viewer{ cursor:default; }
.face-cam.viewer .fc-resize{ display:none; }
.sheet-body{ padding:4px 18px calc(20px + env(safe-area-inset-bottom)); display:flex; flex-direction:column; gap:12px; }
.idea-meta{ display:flex; align-items:center; gap:10px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); padding:10px 14px; font-size:14px; }
.idea-meta span{ color:var(--muted); font-size:13px; }
.bt-row{ display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.bt-inputs{ display:flex; gap:10px; }
.bt-inputs .fld-label{ flex:1; }
.idea-block{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); padding:12px; margin-bottom:10px; }
.idea-top{ display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.idea-top b{ font-size:15px; }
.idea-tf{ font-size:11.5px; color:var(--muted); background:var(--surface-3); padding:3px 8px; border-radius:8px; }
.idea-grid{ display:flex; gap:18px; margin-bottom:8px; }
.idea-grid div span{ display:block; font-size:11px; color:var(--muted); }
.idea-grid div b{ font-size:14px; }
.comment-list{ max-height:40vh; overflow-y:auto; padding:4px 18px; display:flex; flex-direction:column; gap:8px; }
.back-btn{ margin-bottom:10px; align-self:flex-start; }
.trader-mini{ display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r-md); padding:10px 12px; margin-bottom:12px; width:100%; color:var(--text); font:inherit; cursor:pointer; text-align:left; }
.trader-mini span:last-child{ display:flex; flex-direction:column; line-height:1.3; }
.trader-mini .handle{ font-size:12px; color:var(--muted); }
