body.app { min-height: 100vh; display: flex; flex-direction: column; }
.acct-select { width: auto; max-width: 260px; padding: 6px 10px; font-size: 13px; }
.top-stats { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.top-stat { display: flex; flex-direction: column; line-height: 1.15; }
.top-stat .label { font-size: 11px; }
.top-stat .num { font-size: 14px; }

.banner { margin: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); padding: 10px 14px; border-radius: 9px; font-size: 14px; border: 1px solid var(--line-2); background: var(--panel); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.ok { background: var(--up-soft); border-color: rgba(62, 207, 142, 0.35); }
.banner.bad { background: var(--down-soft); border-color: rgba(255, 107, 107, 0.35); }
.banner.warn { background: var(--warn-soft); border-color: rgba(240, 166, 64, 0.35); }
.banner strong { font-family: var(--display); }

/* Challenge progress strip */
.progress { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.meter { background: var(--panel); padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.meter .top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.meter .label { font-size: 11.5px; }
.meter .val { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brass); border-radius: 3px; }
.bar.good i { background: var(--up); }
.bar.risk i { background: var(--warn); }
.bar.danger i { background: var(--down); }

/* Terminal layout */
.terminal { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); min-height: 0; }
.feed { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.feed-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { display: flex; gap: 6px; flex: 1; min-width: 220px; max-width: 520px; position: relative; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 4px; max-height: 360px; overflow-y: auto; }
.sr-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.sr-row:hover, .sr-row.on { background: var(--panel-2); }
.sr-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-side { color: var(--muted); font-size: 12px; }
.sr-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.search .input { padding: 7px 10px; font-size: 12.5px; }
.feed-meta { font-size: 12px; margin-left: auto; }

.seg { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); padding: 3px; border-radius: 9px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--panel-2); color: var(--ink); }
.seg.small button { padding: 5px 10px; }
#seg { display: none; }

.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-height: 0; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; max-height: calc(100vh - 330px); min-height: 360px; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.col-head h2 { margin: 0; font-family: var(--display); font-size: 15px; letter-spacing: -0.01em; }
.col-head span { font-size: 11.5px; }
.col-body { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.col-empty { padding: 18px 10px; color: var(--faint); font-size: 13px; text-align: center; }

.card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px; border-radius: 8px; border: 1px solid transparent; background: transparent; text-align: left; cursor: pointer; width: 100%; }
.card:hover { background: var(--panel-2); }
.card.sel { border-color: var(--brass); background: var(--panel-2); }
.card .img { grid-row: span 3; align-self: start; }
.card .name-row { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.card .sym { font-weight: 700; font-size: 14px; white-space: nowrap; }
.card .nm { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .age { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }
.card .stats { grid-column: 2 / 4; display: flex; gap: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.card .stats b { color: var(--ink); font-weight: 500; }
.card .foot { grid-column: 2 / 4; display: flex; gap: 4px 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.card .foot .chip { white-space: nowrap; margin-left: auto; }
.card .chg { font-family: var(--mono); font-size: 11.5px; display: flex; gap: 8px; }
.bs { display: flex; height: 3px; width: 54px; border-radius: 2px; overflow: hidden; background: var(--down); }
.bs i { background: var(--up); display: block; }

/* Drawer */
.drawer { width: 440px; max-height: calc(100vh - 80px); overflow-y: auto; position: sticky; top: 64px; align-self: start; }
.dr-head { display: flex; gap: 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.dr-head .t { min-width: 0; flex: 1; }
.dr-head .sym { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.dr-head .mint { font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; }
.dr-section { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.dr-section:last-child { border-bottom: 0; }
.dr-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dr-price .p { font-family: var(--mono); font-size: 22px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.6); }
.live-dot.flash { animation: pulse 0.6s ease-out; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.7); } to { box-shadow: 0 0 0 7px rgba(62, 207, 142, 0); } }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; text-align: right; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .mark { font-family: var(--mono); width: 16px; flex: none; text-align: center; }
.checks .ok .mark { color: var(--up); }
.checks .no .mark { color: var(--down); }
.checks .unk .mark { color: var(--warn); }
.order { display: flex; flex-direction: column; gap: 10px; }
.quick { display: flex; gap: 6px; }
.quick .btn { flex: 1; }
.stop-row { display: flex; align-items: center; gap: 10px; }
.stop-row input[type="range"] { flex: 1; accent-color: var(--brass); }
.order-sum { font-size: 12.5px; color: var(--muted); display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; }
.order-sum span:nth-child(even) { font-family: var(--mono); text-align: right; color: var(--ink); }
.blockers { font-size: 12.5px; color: var(--warn); display: flex; flex-direction: column; gap: 3px; }

/* Bottom panel */
.bottom { margin: 12px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.bottom .t td .tok { display: flex; gap: 8px; align-items: center; }
.empty-row { padding: 18px 14px; color: var(--faint); font-size: 13px; }

.empty-wrap { position: fixed; inset: auto 0 0 0; display: grid; place-items: center; padding: 16px; pointer-events: none; z-index: 30; }
.empty-card { pointer-events: auto; padding: 18px 20px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: 720px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); }
.empty-card h2 { margin: 0; font-family: var(--display); font-size: 17px; }
.empty-card p { margin: 0; flex: 1; min-width: 200px; }

@media (max-width: 1180px) {
  .terminal { grid-template-columns: minmax(0, 1fr); }
  .drawer { width: auto; position: static; max-height: none; }
  .progress { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  #seg { display: inline-flex; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .col { display: none; max-height: 60vh; }
  .col.show { display: flex; }
  .progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-stats { gap: 12px; }
  .top-stat:nth-child(n+3) { display: none; }
  .topbar .brand span:last-child { display: none; }
}

/* Chart controls */
.chart-sec { gap: 8px; }
.chart-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-bar .spacer { flex: 1; }
.chart-bar .btn.ghost { min-width: 30px; padding: 4px 8px; }
.chart { width: 100%; height: clamp(190px, 29vh, 260px); display: block; cursor: crosshair; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }

/* Instant trade widget: docked under the chart, or popped out and draggable */
.quick-w { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.quick-w[hidden] { display: none; }
.quick-w.float { position: fixed; z-index: 60; width: 308px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6); border-color: var(--brass); }
.qw-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); background: var(--panel); }
.quick-w.float .qw-head { cursor: grab; user-select: none; touch-action: none; }
.qw-title { font-family: var(--display); font-weight: 700; font-size: 13.5px; }
.qw-sym { font-weight: 700; color: var(--brass); font-size: 13px; }
.qw-head .num { font-size: 12.5px; color: var(--muted); }
.qw-head .spacer { flex: 1; }
.qw-btn { border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 6px; width: 28px; height: 26px; cursor: pointer; font-size: 15px; line-height: 1; }
.qw-btn:hover { color: var(--ink); border-color: var(--muted); }
.qw-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.qw-note { margin: 0; font-size: 13px; }
.qw-row { display: flex; gap: 8px; align-items: center; }
.qw-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.qb { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 2px 7px; border-radius: 9px; border: 1px solid rgba(62, 207, 142, 0.45); background: var(--up-soft); color: var(--up); cursor: pointer; min-height: 52px; }
.qb b { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.qb i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.qb:hover:not(:disabled) { background: var(--up); color: #04150d; }
.qb:hover:not(:disabled) i { color: #04150d; }
.qb:disabled { opacity: 0.4; cursor: not-allowed; }
.qw-row .input { flex: 1; min-width: 0; padding: 8px 10px; }
.qw-row .btn.buy { min-width: 96px; }
.qw-stop { gap: 10px; }
.qw-stop label { font-size: 12.5px; color: var(--muted); }
.qw-stop input[type="range"] { flex: 1; accent-color: var(--brass); }
.qw-stop .num { font-size: 12.5px; width: 42px; text-align: right; }
.qw-sum { font-size: 11.5px; font-family: var(--mono); line-height: 1.35; min-height: 15px; }
.qw-sellrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 8px; align-items: stretch; }
.qw-pos { display: flex; justify-content: center; gap: 2px; font-size: 12px; padding: 6px 10px; background: var(--bg); border-radius: 8px; line-height: 1.25; }
.qw-sell { width: 100%; min-height: 48px; font-size: 14px; white-space: normal; line-height: 1.2; font-weight: 700; background: var(--down-soft); border-color: var(--down); }
.qw-sell:hover:not(:disabled) { background: var(--down); color: #1a0606; }
.qw-sell:disabled { opacity: 0.45; cursor: not-allowed; }
.qw-opt { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.qw-opt input { accent-color: var(--brass); }

/* Sell buttons, exits and limit orders inside the widget */
.qw-sells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.qs { padding: 9px 2px; border-radius: 8px; border: 1px solid rgba(255, 107, 107, 0.4); background: var(--down-soft); color: var(--down); cursor: pointer; font-weight: 700; font-size: 12.5px; min-height: 38px; }
.qs:hover:not(:disabled) { background: var(--down); color: #1a0606; }
.qs:disabled { opacity: 0.4; cursor: not-allowed; }
.qw-pos { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.qw-sec { border: 1px solid var(--line-2); border-radius: 9px; padding: 0 10px; background: var(--bg); }
.qw-sec > summary { cursor: pointer; padding: 9px 0; font-weight: 600; font-size: 13px; list-style: none; display: flex; gap: 8px; align-items: center; }
.qw-sec > summary::-webkit-details-marker { display: none; }
.qw-sec > summary::before { content: '▸'; color: var(--muted); font-size: 11px; transition: transform 0.12s; }
.qw-sec[open] > summary::before { transform: rotate(90deg); }
.qw-sec[open] { padding-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.qw-sec[open] > summary { padding-bottom: 2px; }
.qw-grid { display: grid; grid-template-columns: auto 1fr 1.25fr; gap: 6px 8px; align-items: center; }
.qw-lbl { font-size: 12px; color: var(--muted); }
.qw-in { display: flex; align-items: center; gap: 4px; min-width: 0; }
.qw-in i { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.qw-in .input { min-width: 0; width: 100%; padding: 6px 7px; font-size: 12.5px; }
.qw-hint { font-size: 11.5px; line-height: 1.35; }
.qw-chips { gap: 6px; flex-wrap: wrap; }
.chipbtn { border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-family: var(--mono); }
.chipbtn:hover { border-color: var(--brass); }
.qw-seg { align-self: flex-start; }
.qw-seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.qw-orders { display: flex; flex-direction: column; gap: 6px; }
.qw-order { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 8px; background: var(--panel); border-radius: 8px; }
.small-note { font-size: 11.5px; }
.pos-actions { white-space: nowrap; }
.pos-actions .btn + .btn { margin-left: 4px; }
.quick-w.float { max-height: calc(100vh - 24px); overflow-y: auto; }

/* Feed tools, quick-buy and watchlist */
.feed-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.feed-tools .spacer { flex: 1; }
.ft { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ft .input { width: auto; padding: 5px 8px; font-size: 12.5px; min-height: 0; }
.qbset .chipbtn[aria-pressed="true"], #fWatch[aria-pressed="true"], #fOnly[aria-pressed="true"] { border-color: var(--brass); background: var(--brass-soft); color: var(--brass); }
.card .age { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.card-star { cursor: pointer; color: var(--faint); font-size: 15px; line-height: 1; padding: 0 2px; }
.card-star:hover, .card-star.on { color: var(--brass); }
.card-qb { cursor: pointer; font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: #04150d; background: var(--up); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.card-qb:hover { filter: brightness(1.1); }
.card-qb.busy { opacity: 0.6; }
.col.watch { display: none; }
.cols.watch-mode .col { display: none; }
.cols.watch-mode .col.watch { display: flex; grid-column: 1 / -1; max-height: calc(100vh - 330px); }
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; align-content: start; }
.watch-grid .col-empty { grid-column: 1 / -1; }

/* Live trades and holders */
.tape-sec { gap: 8px; }
.tape { max-height: 230px; overflow-y: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.tp-sum { font-size: 11.5px; padding-bottom: 4px; }
.tp-head, .tp-row { display: grid; grid-template-columns: 62px 38px 1fr 1fr 16px; gap: 8px; align-items: center; padding: 2px 4px; }
.tp-head { font-size: 11px; position: sticky; top: 0; background: var(--panel); }
.tp-row:hover { background: var(--panel-2); border-radius: 4px; }
.tp-row .r, .tp-head .r { text-align: right; }
.tp-row a { text-decoration: none; }
.hd-row { display: grid; grid-template-columns: 18px 76px 44px 1fr 58px; gap: 8px; align-items: center; padding: 3px 4px; }
.hd-row a { text-decoration: none; color: var(--ink); }
.hd-row .r { text-align: right; }
.hd-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.hd-bar i { display: block; height: 100%; background: var(--brass); }
@media (max-width: 820px) { .cols.watch-mode .col.watch { display: flex; } }

/* results tab */
.stats-wrap { padding: 14px; }
.stats-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stats-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; grid-column: 1; }
.stat-tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.stat-tile b { font-size: 16px; font-weight: 500; }
.stats-chart { grid-column: 2; grid-row: 1 / span 2; }
.eq-canvas { width: 100%; height: 200px; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.stats-reasons { grid-column: 1; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } .stats-chart, .stats-reasons { grid-column: 1; grid-row: auto; } .stats-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* help overlay + tour */
.modal.help { max-width: 460px; display: flex; flex-direction: column; gap: 10px; }
.modal.help h2, .modal.help h3 { margin: 0; }
.kbs { display: grid; gap: 6px; }
.kb { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.kb kbd { min-width: 64px; text-align: center; font-family: var(--mono); font-size: 12px; padding: 3px 8px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--panel-2); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.tour-nav { display: flex; justify-content: space-between; align-items: center; }
#overlay.tour { align-items: flex-end; background: rgba(0,0,0,0.25); }
.tour-hi { outline: 2px solid var(--brass); outline-offset: -2px; position: relative; z-index: 1; }
.banner.live { background: var(--down-soft); border-color: rgba(255, 107, 107, 0.35); }
