/* ═══ Perplo terminal — same ink-on-paper as the landing, tighter. ═══ */

body.term { font-size: 15px; background: #fff; }
.term .brand { font-size: 18px; }

.tbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 20px; border-bottom: 1px solid var(--rule);
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.tbar-tag { padding: 3px 10px; border-radius: 99px; background: rgba(31,32,37,.06); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tbar-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.tbar-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.tbar-status.live i { background: var(--up); animation: pulse 2s infinite; }
.tbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.acct { text-align: right; line-height: 1.15; }
.acct small { display: block; font-size: 11.5px; color: var(--ink-3); }
.acct b { font-size: 15px; font-variant-numeric: tabular-nums; }
.wbtn { height: 40px; padding: 0 18px; font-size: 14.5px; border: 0; cursor: pointer; font-family: inherit; }
.wbtn.on { background: rgba(31,32,37,.06); color: var(--ink); font-family: var(--mono); font-size: 13.5px; }

.tgrid { display: grid; grid-template-columns: 270px minmax(0, 1fr) 360px; min-height: calc(100vh - 64px); }

/* ─── left ─── */
.tlist { border-right: 1px solid var(--rule); padding: 16px 0; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; }
.tsearch { display: flex; align-items: center; gap: 8px; margin: 0 14px 12px; height: 40px; padding: 0 14px; border-radius: 99px; background: rgba(31,32,37,.05); color: var(--ink-3); }
.tsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14.5px; color: var(--ink); }
.tl-head { display: flex; justify-content: space-between; padding: 6px 20px 8px; font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.tl { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 10px 20px; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.tl:hover { background: rgba(31,32,37,.03); }
.tl.on { background: rgba(31,32,37,.06); }
.tl img { width: 32px; height: 32px; border-radius: 9px; }
.tl b { display: block; font-size: 14.5px; }
.tl small { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tl .r b { font-size: 14px; font-weight: 600; }
.tl .r small { font-weight: 600; }
.tl.dead { opacity: .45; }

/* ─── centre ─── */
.tmain { padding: 24px clamp(18px, 2.4vw, 36px) 60px; min-width: 0; }
.mhead { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.mhead img { width: 52px; height: 52px; border-radius: 14px; }
.mh-name h1 { font-size: 28px; letter-spacing: -0.03em; }
.mh-name small { display: block; margin-top: 4px; color: var(--ink-3); font-size: 14px; }
.mh-px { text-align: right; }
.mh-px b { display: block; font-size: 34px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mh-px small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.mstats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 22px 0 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.mstats div { padding: 12px 12px 12px 0; min-width: 0; }
.mstats dt { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.mstats dd { margin: 5px 0 0; font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart { margin-top: 22px; }
.chart-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-3); }
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: rgba(31,32,37,.05); }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 5px 11px; border-radius: 99px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chart-box { position: relative; height: 280px; margin-top: 10px; }
.chart-box svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.chart-tip { position: absolute; top: 0; padding: 6px 10px; border-radius: 10px; background: var(--dark); color: #fff; font-size: 12.5px; pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; transform: translateX(-50%); }

.tblock { margin-top: 38px; }
.tblock h2 { font-size: 20px; letter-spacing: -0.02em; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.tblock .prow { font-size: 14px; }
.tok-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; font-weight: 600; }
.tok-h a { font-family: var(--mono); font-size: 12.5px; font-weight: 400; color: var(--ink-3); }

.tfeed .th { padding: 16px 0; }
.tfeed .th-text { font-size: 15.5px; }
.tf-empty { padding: 30px 0; color: var(--ink-3); border-bottom: 1px solid var(--rule); }

/* ─── right ─── */
.tside { border-left: 1px solid var(--rule); padding: 18px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; }
.ticket { display: grid; gap: 12px; }
.tk-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 99px; background: rgba(31,32,37,.05); }
.tk-sides button { height: 38px; border: 0; border-radius: 99px; background: transparent; font: inherit; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.tk-sides button.on[data-side="L"] { background: #fff; color: var(--up); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tk-sides button.on[data-side="S"] { background: #fff; color: var(--down); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tk-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.tk-row label { font-size: 13.5px; color: var(--ink-3); }
.tk-row b { font-size: 18px; font-variant-numeric: tabular-nums; }
#lev { width: 100%; accent-color: #1f2025; margin: 0; }
.tk-ticks { display: flex; justify-content: space-between; margin-top: -6px; font-size: 11px; color: var(--ink-3); }
.tk-field { display: grid; gap: 7px; }
.tk-fl { display: flex; justify-content: space-between; align-items: baseline; }
.tk-fl label { font-size: 13.5px; color: var(--ink-3); }
.tk-fl small { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tk-in { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px 0 16px; border-radius: 16px; background: rgba(31,32,37,.045); }
.tk-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tk-in .tok { background: #fff; }
.tk-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tk-quick button { height: 30px; border: 0; border-radius: 99px; background: rgba(31,32,37,.05); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tk-quick button:hover { background: rgba(31,32,37,.09); }
.tk-kvs { margin: 0; display: grid; border-top: 1px solid var(--rule); }
.tk-kvs div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.tk-kvs dt { color: var(--ink-3); }
.tk-kvs dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
#thesis { width: 100%; resize: vertical; min-height: 96px; padding: 12px 14px; border: 0; outline: 0; border-radius: 16px; background: rgba(31,32,37,.045); font: inherit; font-size: 15px; line-height: 1.45; color: var(--ink); }
#thesis:focus, .tk-in:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tk-go { width: 100%; justify-content: center; height: 50px; border: 0; font-family: inherit; cursor: pointer; }
.tk-go:disabled { opacity: .5; cursor: default; transform: none; }
.tk-go.long { background: #15803d; }
.tk-go.short { background: #b91c1c; }
.tk-note { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.tk-note.err { color: var(--down); }
.tk-note.ok { color: var(--up); }
.tk-note a { text-decoration: underline; }

.mine { margin-top: 26px; }
.mine h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.mine p { padding: 12px 0; font-size: 14px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 14px; font-variant-numeric: tabular-nums; }
.pos .ph { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pos small { color: var(--ink-3); font-size: 12.5px; }
.pos .pr { text-align: right; font-weight: 600; }
.pos button { justify-self: end; height: 28px; padding: 0 12px; border: 0; border-radius: 99px; background: rgba(31,32,37,.07); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pos button:hover { background: var(--dark); color: #fff; }
.tside .reg { margin-top: 24px; }

/* wallet dialog + toast */
.wdlg { border: 0; border-radius: 26px; padding: 24px; width: min(380px, calc(100vw - 32px)); box-shadow: 0 40px 90px -30px rgba(31,32,37,.45); }
.wdlg::backdrop { background: rgba(20,21,24,.32); backdrop-filter: blur(4px); }
.wdlg h3 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 16px; }
.wlist { display: grid; gap: 8px; margin-bottom: 16px; }
.wlist button { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 14px; border: 0; border-radius: 16px; background: rgba(31,32,37,.05); font: inherit; font-weight: 600; font-size: 15.5px; cursor: pointer; }
.wlist button:hover { background: rgba(31,32,37,.09); }
.wlist img { width: 28px; height: 28px; border-radius: 8px; }
.wdlg .pill { width: 100%; justify-content: center; border: 0; cursor: pointer; font-family: inherit; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 90; padding: 12px 18px; border-radius: 99px; background: var(--dark); color: #fff; font-size: 14px; transition: all .35s cubic-bezier(.16,1,.3,1); pointer-events: none; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { text-decoration: underline; }

@media (max-width: 1180px) {
  .tgrid { grid-template-columns: 230px minmax(0, 1fr) 330px; }
  .mstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .tgrid { grid-template-columns: 1fr; }
  .tlist, .tside { position: static; height: auto; border: 0; }
  .tlist { border-bottom: 1px solid var(--rule); max-height: 300px; }
  .tside { border-top: 1px solid var(--rule); }
  .tbar-status { display: none; }
}
@media (max-width: 560px) {
  .acct { display: none; }
  .mhead { grid-template-columns: 44px minmax(0, 1fr); }
  .mhead img { width: 44px; height: 44px; }
  .mh-px { grid-column: 1 / -1; text-align: left; }
  .mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tblock .prow { grid-template-columns: minmax(0, 1.4fr) 1fr 0.8fr; }
  .tblock .prow > :nth-child(n+4) { display: none; }
}
.ticket, .tk-field { grid-template-columns: minmax(0, 1fr); }
.tside, .tmain, .tlist { min-width: 0; }
.tl .r small.up { color: var(--up); }
.tl .r small.down { color: var(--down); }

/* ═══ live program additions ═══ */
.prog { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 10px 14px; border-radius: 14px; background: rgba(31,32,37,.045); font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.prog i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.prog.live i { background: var(--up); animation: pulse 2s infinite; }
.prog.off i { background: #d97706; }
.prog a { text-decoration: underline; }
.lpbox .tk-kvs { margin-top: 2px; }
.lp-in { margin-top: 12px; height: 46px; }
.lp-in input { font-size: 18px; }
.lp-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.lp-btns .pill { justify-content: center; height: 42px; border: 0; font-family: inherit; cursor: pointer; font-size: 14.5px; }
.lp-btns .pill-light { box-shadow: inset 0 0 0 1.5px var(--ink); background: transparent; }
.lp-btns .pill:disabled { opacity: .45; cursor: default; }
.tside .tk-note { margin-top: 10px; }
.mk-src { display: inline-flex; gap: 6px; align-items: center; }
