/* App shell + views */
html, body.app { height: 100%; }
body.app { display: flex; flex-direction: column; overflow: hidden; }

.topbar { flex: none; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--bg); position: relative; z-index: 60; }
.tb-logo { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.tb-logo svg { width: 30px; height: 30px; }
.tb-mode { height: 19px; font-size: 10px; letter-spacing: .06em; }
.tb-nav { display: flex; align-items: center; gap: 1px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tb-nav::-webkit-scrollbar { display: none; }
.tb-nav > a, .tb-more-btn { height: 34px; padding: 0 11px; display: inline-flex; align-items: center; gap: 4px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; border: 0; background: transparent; cursor: pointer; white-space: nowrap; }
.tb-nav > a:hover, .tb-more-btn:hover { color: var(--text); background: var(--surface-2); }
.tb-nav > a.on { color: var(--text); background: var(--surface-2); }
.tb-more { position: relative; }
.tb-preset b { color: var(--lime); }
.tb-preset svg { color: var(--lime); }

.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 80; }
.tb-more .menu { left: 0; right: auto; position: fixed; top: 52px; }
.menu a, .menu button.mi { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text); border: 0; background: transparent; cursor: pointer; text-align: left; }
.menu a:hover, .menu button.mi:hover { background: var(--surface-2); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 2px; }
.tb-bell, .tb-wallet { position: relative; }
.badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.notif-menu { width: 340px; max-height: 460px; overflow: auto; padding: 0; }
.notif-menu .nh { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif.unread { background: rgba(184, 245, 60, .04); }
.wallet-pill { display: flex; align-items: center; gap: 8px; }

.view { flex: 1; min-height: 0; overflow: auto; position: relative; }
.view.fill { overflow: hidden; display: flex; flex-direction: column; }
.page { width: min(1240px, 100%); margin: 0 auto; padding: 18px 16px 40px; }
.page-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }

.statusbar { flex: none; height: 40px; display: flex; align-items: center; gap: 14px; padding: 0 12px; border-top: 1px solid var(--border); background: var(--bg); font-size: 12.5px; }
.sb-preset { height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(139, 123, 255, .4); background: rgba(139, 123, 255, .12); color: var(--violet); font-weight: 700; font-size: 11.5px; cursor: pointer; }
.sb-ic { color: var(--muted); display: grid; place-items: center; }
.sb-ic:hover { color: var(--text); }
.sb-price { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.sb-price .dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.dot.btc { background: #f7931a; }
.dot.eth { background: #8c8cff; }
.sb-live { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-weight: 600; }
.sb-live.off { color: var(--red); }
.sb-stop { height: 26px; padding: 0 12px; border-radius: 8px; border: 0; background: #e8603c; color: #1b0700; font-weight: 800; font-size: 11.5px; cursor: pointer; letter-spacing: .02em; }
.sb-stop:hover { background: #ff7a55; }

/* trenches view */
.tv { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px; gap: 12px; }
.tv-mob { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px; }
.tv-mob::-webkit-scrollbar { display: none; }
.mob { flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.mob .ring { width: 50px; height: 50px; border-radius: 50%; padding: 2.5px; background: conic-gradient(var(--lime), var(--violet), var(--lime)); }
.mob .ring.empty { background: var(--surface-2); border: 1.5px solid var(--border-2); padding: 0; }
.mob .ring .avatar { width: 100% !important; height: 100% !important; border: 2.5px solid var(--bg); }
.mob b { font-size: 11px; color: var(--text); max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mob .pnl { font-size: 10.5px; font-weight: 600; }
.tv-head { display: flex; align-items: center; gap: 10px; flex: none; flex-wrap: wrap; }
.tv-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.tv .trenches { flex: 1; min-height: 0; }

/* easy home */
.easy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ecard { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.ecard:hover { border-color: var(--border-2); }
.ecard .sym { font-weight: 700; font-size: 18px; }
.ecard .mc { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--dim); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .015); }
.tbl .r { text-align: right; }
.tbl-wrap { overflow: auto; }

/* token page */
.tk { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; padding: 12px; min-height: 100%; }
.tk-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tk-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.tk-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-title h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.tk-stat { display: flex; flex-direction: column; padding: 0 12px; border-left: 1px solid var(--border); }
.tk-stat .l { font-size: 11.5px; color: var(--dim); }
.tk-stat .v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.tk-chart { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tk-chart .chart { height: 400px; position: relative; }
.tk-tabs { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tk-tabs button { height: 30px; padding: 0 11px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tk-tabs button.on { background: var(--surface-3); color: var(--text); }
.tk-pane { max-height: 520px; overflow: auto; }
.tk-side { display: flex; flex-direction: column; gap: 12px; }
.tbox { padding: 14px; }
.tbox .bs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.tbox .bs button { height: 40px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--muted); font-weight: 700; font-size: 15px; cursor: pointer; }
.tbox .bs button.on.buy { background: rgba(63, 224, 139, .14); color: var(--green); border-color: rgba(63, 224, 139, .35); }
.tbox .bs button.on.sell { background: var(--red-bg); color: var(--red); border-color: rgba(255, 93, 108, .35); }
.amt { display: flex; align-items: center; height: 58px; padding: 0 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border-2); }
.amt input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.amt:focus-within { border-color: var(--lime); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 10px; }
.quick button { height: 32px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface-2); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.quick button:hover { border-color: #3a4256; }
.quick button.on { border-color: var(--violet); color: var(--violet); }
.tline { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
.tline b { color: var(--text); font-weight: 600; }
.go { width: 100%; height: 48px; margin-top: 10px; font-size: 15.5px; font-weight: 700; border-radius: 12px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: left; }
.statgrid .l { font-size: 11.5px; color: var(--dim); }
.statgrid .v { font-weight: 700; font-variant-numeric: tabular-nums; }

.chat { display: flex; flex-direction: column; height: 460px; }
.chat-list { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 9px; font-size: 13px; }
.msg .t { color: #d8dce3; word-wrap: break-word; overflow-wrap: anywhere; }
.chat-in { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }

/* social */
.social-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
.feed-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px; border-bottom: 1px solid var(--border); }
.feed-tabs button { height: 30px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.feed-tabs button.on { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.composer { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.composer .input { flex: 1; min-width: 160px; }
.call { padding: 14px; border-bottom: 1px solid var(--border); display: flex; gap: 11px; }
.call .who { display: flex; align-items: center; gap: 7px; font-size: 13px; flex-wrap: wrap; }
.call .txt { margin: 6px 0 9px; font-size: 14px; color: #d8dce3; overflow-wrap: anywhere; }
.call-tok { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); }
.call-tok:hover { border-color: var(--border-2); }
.call-tok .x { margin-left: auto; text-align: right; }
.call-tok .mult { font-size: 17px; font-weight: 700; }
.call-actions { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.call-actions .liked { color: var(--red); }
.trade-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.side-list .best { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.side-list .best:last-child { border-bottom: 0; }
.sec-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sec-h b { font-size: 14px; }

/* trader / leaderboard / rewards */
.prof { display: flex; gap: 16px; align-items: center; padding: 18px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { padding: 14px; }
.kpi .l { font-size: 12px; color: var(--dim); }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cup { padding: 22px; background: radial-gradient(ellipse at 0 0, rgba(184, 245, 60, .1), transparent 60%), var(--surface); border-color: rgba(184, 245, 60, .2); }
.rw-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rw-card { padding: 20px; }
.rw-card .big { font-size: 34px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.reflink { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px; }
.reflink code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; }

.pnl-card { width: 100%; aspect-ratio: 1200/675; border-radius: 14px; display: block; background: var(--bg-2); }

@media (max-width: 1100px) {
  .tk { grid-template-columns: 1fr; }
  .social-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 760px) {
  .topbar { gap: 6px; padding: 0 8px; }
  .tb-mode, .tb-mode-seg, .tb-preset #preset-amt { display: none; }
  .tb-nav { position: fixed; left: 0; right: 0; bottom: 40px; height: 50px; background: var(--bg); border-top: 1px solid var(--border); justify-content: space-around; padding: 0 4px; z-index: 55; }
  .tb-nav > a, .tb-more-btn { font-size: 12px; padding: 0 8px; }
  .tb-more .menu { top: auto; bottom: 96px; left: auto; right: 8px; }
  .view { margin-bottom: 50px; }
  .hide-sm { display: none !important; }
  .statusbar { gap: 10px; padding: 0 8px; }
  .statusbar .sb-ic { display: none; }
  .sb-preset, .sb-live, .sb-stop, .sb-price { white-space: nowrap; }
  .sb-stop { padding: 0 9px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .rw-cards { grid-template-columns: 1fr; }
  .tk-chart .chart { height: 300px; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .notif-menu { position: fixed; left: 8px; right: 8px; width: auto; top: 56px; }
}
