/* jamtis terminal (terminal.html). Tokens and base components come from ui.css; this file holds the
   app top bar (same as app.html), the toolbar, the three trenches columns and their cards. */

/* ---------- page: one screen on desktop, columns scroll inside ---------- */
html, body { height: 100%; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.priv-on .priv { color: transparent !important; background: var(--l4); border-radius: var(--r-in); user-select: none; }
.grow { flex: 1; }
.muted { color: var(--ink-3); }

/* ---------- status + top bar (copied from app.html) ---------- */
.status { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; height: 26px; padding: 0 12px; border-bottom: 1px solid var(--hair); font: var(--w5) var(--fs-11)/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.status.live { color: var(--ink-2); }
.status.live::before { background: var(--up); }
.status.warn { color: var(--warn); } .status.warn::before { background: var(--warn); }
.top { position: relative; flex: none; z-index: 20; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 20px; background: var(--glass); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border-bottom: 1px solid var(--hair); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--acc-line) 50%, transparent); transition: background var(--d3); pointer-events: none; }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs a { position: relative; display: flex; align-items: center; color: var(--ink-2); padding: 0 12px; font-weight: var(--w6); font-size: var(--fs-14); letter-spacing: -.01em; transition: color var(--d2); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--acc); }
.bal { display: flex; gap: 10px; align-items: center; height: 36px; padding: 0 12px; border: 1px solid var(--hair); border-radius: var(--r-ctl); font-size: var(--fs-13); }
.bal[hidden] { display: none; }
#connect { min-width: 92px; }

/* ---------- toolbar ---------- */
.tbar { flex: none; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 20px; border-bottom: 1px solid var(--hair); background: var(--bg); }
.tpair { position: relative; flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 2px; border-radius: var(--r-ctl); background: var(--l2); border: 1px solid var(--hair); }
.tpair .thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / 3); border-radius: var(--r-in); background: var(--acc); transition: transform var(--d3) var(--ease), background-color var(--d3); }
body[data-q="zec"] .tpair .thumb { transform: translateX(100%); }
body[data-q="wnear"] .tpair .thumb { transform: translateX(200%); }
.tpair button { position: relative; z-index: 1; border: 0; background: none; height: 32px; padding: 0 12px; min-width: 78px; font-weight: var(--w6); font-size: var(--fs-13); color: var(--ink-2); display: flex; gap: 7px; align-items: center; justify-content: center; border-radius: var(--r-in); transition: color var(--d2); }
.tpair button:hover { color: var(--ink); }
.tpair button[aria-pressed="true"] { color: var(--acc-ink); }
.tpair button i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tpair button[aria-pressed="true"] i { background: var(--acc-ink) !important; }

.tsearch { position: relative; display: flex; align-items: center; flex: 0 1 280px; min-width: 160px; height: 36px; border: 1px solid var(--hair-2); border-radius: var(--r-ctl); background: var(--l1); color: var(--ink-3); transition: border-color var(--d2); }
.tsearch:focus-within { border-color: var(--acc); }
.tsearch > span { display: grid; place-items: center; width: 34px; flex: none; }
.tsearch svg { width: 16px; height: 16px; }
.tsearch input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: 0; color: var(--ink); font-size: var(--fs-13); }
.tsearch input::placeholder { color: var(--ink-3); }
.tsearch input::-webkit-search-cancel-button { filter: grayscale(1); }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--hair-2); border-bottom-width: 2px; border-radius: var(--r-in); background: var(--l2); color: var(--ink-2); font: var(--w6) var(--fs-11)/1 var(--mono); }
.tsearch kbd { margin-right: 8px; }
.tsearch:focus-within kbd { display: none; }

.tpad { flex: none; }
.tpad[hidden] { display: none; }
.tpad select { height: 36px; max-width: 180px; padding: 0 28px 0 10px; border: 1px solid var(--hair-2); border-radius: var(--r-ctl); background: var(--l1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a90' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; color: var(--ink); font-size: var(--fs-13); appearance: none; -webkit-appearance: none; }
.tpad select:focus { border-color: var(--acc); outline: 0; }
.tpre { display: flex; align-items: center; gap: 8px; flex: none; }
.tpre .chips { align-items: center; }
.tpre .chip { min-width: 46px; }
.tpre .chip[aria-pressed="true"] { background: var(--acc); color: var(--acc-ink); }
.tpre .unit { padding: 0 6px 0 4px; font: var(--w6) var(--fs-11)/1 var(--mono); }
.ibtn.sm { width: 32px; height: 32px; }
.ibtn.sm svg { width: 16px; height: 16px; }
.tctl { display: flex; gap: 6px; flex: none; }

/* column picker: tablet (two columns) and phone (one) only */
.ttabs { display: none; }

/* ---------- columns ---------- */
.cols { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); outline: 0; }
.col { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--hair); }
.col:last-child { border-right: 0; }
.col[hidden] { display: none; }
.ch { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--hair); background: var(--l1); }
.ch h2 { margin: 0; font: var(--w6) var(--fs-14)/1 var(--display); letter-spacing: var(--track-tight); }
.ch .ct { color: var(--ink-3); font-size: var(--fs-12); }
.fon { font: var(--w6) 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 5px; border-radius: var(--r-in); color: var(--acc-t); background: var(--acc-soft); }
.fon[hidden] { display: none; }
.fbtn.on { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--l4) transparent; }

/* filter popover */
.fpop { position: absolute; z-index: 15; top: 44px; right: 8px; width: min(280px, calc(100% - 16px)); display: grid; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--hair-2); border-radius: var(--r-card); box-shadow: 0 18px 48px rgba(0,0,0,.45); animation: tm-pop var(--d2) var(--ease-out); }
.fpop[hidden] { display: none; }
.fl { display: grid; gap: 6px; }
.fl > span { font: var(--w5) var(--fs-11) var(--mono); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--ink-3); }
.fl input, .pre-grid input { height: 36px; padding: 0 10px; background: var(--bg); border: 1px solid var(--hair-2); border-radius: var(--r-ctl); color: var(--ink); font-family: var(--mono); outline: 0; }
.fl input:focus, .pre-grid input:focus { border-color: var(--acc); }
.ck { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: var(--fs-13); color: var(--ink-2); cursor: pointer; }
.ck input { width: 16px; height: 16px; accent-color: var(--acc); margin: 0; }
.fa { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes tm-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px 8px 14px; border-bottom: 1px solid var(--hair); cursor: pointer; outline: 0; transition: background-color var(--d2); }
.card:hover, .card.cur { background: var(--l2); }
.card.cur::before, .card:focus-visible::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--acc); }
.card:focus-visible { box-shadow: inset 0 0 0 1px var(--acc-line); }
.card.fresh { animation: tm-fresh 2.4s var(--ease-out); }
@keyframes tm-fresh { 0%, 30% { background: color-mix(in srgb, var(--acc) 22%, transparent); } 100% { background: transparent; } }
.av { width: 44px; height: 44px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--l3); border: 1px solid var(--hair-2); border-radius: var(--r-ctl); font: var(--w6) var(--fs-12) var(--sans); color: var(--ink-2); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.cm { display: grid; gap: 3px; min-width: 0; }
.r1, .r2, .r3 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--w6); font-size: var(--fs-14); }
.tk { flex: none; max-width: 10ch; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font: var(--fs-12) var(--mono); }
.age { flex: none; margin-left: auto; color: var(--ink-3); font-size: var(--fs-11); }
.tag { flex: none; font: var(--w6) 10px/1 var(--mono); letter-spacing: .06em; padding: 3px 5px; border-radius: var(--r-in); background: var(--l3); color: var(--ink-3); }
.tag.ours { color: var(--acc-t); background: var(--acc-soft); }
.tag.down { color: var(--down); background: var(--down-bg); }
.soc { display: flex; gap: 2px; margin-left: auto; }
.soc a { display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-in); color: var(--ink-3); transition: color var(--d2), background-color var(--d2); }
.soc a:hover { color: var(--ink); background: var(--l4); }
.soc svg { width: 14px; height: 14px; }
.r3 { gap: 10px; font-size: var(--fs-12); white-space: nowrap; overflow: hidden; }
.kv { display: inline-flex; align-items: baseline; gap: 4px; }
.kv small, .chg small { color: var(--ink-3); font: var(--w5) 10px/1 var(--mono); letter-spacing: .04em; }
.kv b { font-weight: var(--w6); font-size: var(--fs-12); }
.r3 .chg { gap: 4px; height: 18px; padding: 0 5px; }
.r3 .chg small { color: inherit; opacity: .7; }
.bond { display: flex; align-items: center; gap: 8px; font-size: var(--fs-11); color: var(--ink-2); }
.bond .bar { flex: 1; height: 4px; border-radius: 2px; background: var(--l4); overflow: hidden; }
.bond .bar i { display: block; height: 100%; border-radius: inherit; background: var(--acc); transition: width var(--d3) var(--ease); }
.bond.pool .bar i { background: var(--up); opacity: .6; }
.bond .n { min-width: 34px; text-align: right; }
.qb { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 34px; min-width: 70px; padding: 0 10px; border-radius: var(--r-ctl); border: 1px solid var(--acc-line); background: var(--acc-soft); color: var(--acc-t); font: var(--w6) var(--fs-12)/1 var(--sans); box-shadow: inset 0 1px 0 var(--tile-hi); transition: background-color var(--d2), color var(--d2), transform var(--d1); }
.qb svg { width: 14px; height: 14px; flex: none; }
.qb:hover, .card.cur .qb { background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 86%, #fff) 0%, var(--acc) 52%, color-mix(in srgb, var(--acc) 90%, #000) 100%); border-color: color-mix(in srgb, var(--acc) 68%, #000); box-shadow: inset 0 1px 0 var(--raise-hi), 0 1px 2px var(--raise-sh); color: var(--acc-ink); }
.qb:active { transform: translateY(1px); }
.qb[aria-busy="true"] { opacity: .6; pointer-events: none; }
.card.sk { grid-template-columns: 44px minmax(0, 1fr); }
.card.sk .av { border-color: var(--hair); }
.skel { display: block; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--l2), var(--l3), var(--l2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.list .empty-state { padding: 48px 20px; }

/* ---------- dialogs: presets editor, shortcuts (base .picker in ui.css) ---------- */
.tm-pre form { display: grid; gap: 12px; }
.pre-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px; }
.pre-grid label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.pre-grid input { width: 100%; }
.tm-pre .fa { padding: 0 16px 16px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; padding: 4px 16px 18px; align-items: center; font-size: var(--fs-13); color: var(--ink-2); }
.keys dt { justify-self: start; }
.keys dd { margin: 0; }

/* ---------- bottom tab bar (phones and small tablets) ---------- */
.tabbar { display: none; }

/* ---------- large tablet: header tabs stay, two columns ---------- */
@media (max-width: 1180px) {
  .top { gap: 12px; }
  .tabs a { padding: 0 9px; }
  .tsearch { flex-basis: 220px; }
  .ttabs { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 8px 16px; padding: 2px; border-radius: var(--r-ctl); background: var(--l2); border: 1px solid var(--hair); }
  .ttabs button { min-height: 36px; border: 0; border-radius: var(--r-in); background: none; color: var(--ink-2); font-weight: var(--w6); font-size: var(--fs-13); display: flex; align-items: center; justify-content: center; gap: 6px; }
  .ttabs button[aria-pressed="true"] { background: var(--l4); color: var(--ink); box-shadow: inset 0 -2px 0 var(--acc); }
  .ttabs .ct { color: var(--ink-3); font-size: var(--fs-11); }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--hair); }
  .col:not([hidden]) ~ .col:not([hidden]) { border-right: 0; }
  #keys { display: none; }
}
@media (max-width: 1180px) and (min-width: 981px) { .tpre .eyebrow { display: none; } }

/* ---------- small tablet + phone: app's mobile header and tab bar ---------- */
@media (max-width: 980px) {
  .tabs, .bal { display: none; }
  .top { gap: 8px; padding: 0 8px 0 14px; height: 52px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  #connect { height: 40px; min-width: 0; }
  .tbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .tbar > .grow { display: none; }
  .tsearch { order: 5; flex: 1 1 60%; height: var(--tap); }
  .tsearch kbd { display: none; }
  .tpad { order: 6; flex: 0 1 auto; } .tpad select { height: var(--tap); max-width: 150px; }
  .tpair button { height: 40px; }
  .tctl .ibtn { width: 40px; height: 40px; }
  .tpre .chip { height: 40px; }
  .ibtn.sm { width: 40px; height: 40px; }
  .qb { height: var(--tap); min-width: 76px; }
  .soc a { width: 30px; height: 30px; }
  .tabbar { flex: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; background: var(--glass-2); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-top: 1px solid var(--hair); padding: 0 4px env(safe-area-inset-bottom); z-index: 40; }
  .tabbar > a { min-width: 0; min-height: 56px; color: var(--ink-3); display: grid; justify-items: center; align-content: center; gap: 3px; padding: 6px 0; font-size: 10px; font-weight: var(--w6); letter-spacing: .01em; transition: color var(--d2), transform var(--d1) var(--ease); }
  .tabbar > a:active { transform: scale(.94); }
  .tabbar .gi { display: grid; width: 24px; height: 24px; }
  .tabbar .gi .g, .tabbar .gi > svg { grid-area: 1 / 1; width: 24px; height: 24px; transition: opacity var(--d2); }
  .tabbar .gi .gf { opacity: 0; }
  .tabbar > a[aria-current="page"] { color: var(--acc-t); }
}

/* ---------- phone: one column, segmented tabs, Quick Buy amounts pinned above the tab bar ---------- */
@media (max-width: 767px) {
  .tpair { flex: 1 1 auto; }
  .tpair button { min-width: 0; padding: 0 6px; }
  .tctl { gap: 4px; }
  .ttabs { margin: 0; border-radius: 0; border-width: 0 0 1px; padding: 4px 12px; background: var(--bg); }
  .ttabs button { min-height: 40px; }
  .ttabs button[aria-pressed="true"] { background: var(--l3); }
  .cols { grid-template-columns: minmax(0, 1fr); border-top: 0; }
  .col { border-right: 0; }
  .ch { height: 44px; padding-left: 12px; }
  .list { padding-bottom: 60px; }
  .tpre { position: fixed; z-index: 45; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); padding: 8px 12px; gap: 8px; background: var(--glass-2); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-top: 1px solid var(--hair); }
  .tpre .chips { flex: 1; }
  .tpre .chip { flex: 1; min-width: 0; }
  .card { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 10px 12px; gap: 10px; }
  .av { width: 40px; height: 40px; }
  .toast { bottom: calc(124px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) { .tpre .eyebrow { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .skel, .card.fresh, .fpop { animation: none; }
  .tpair .thumb, .bond .bar i { transition: none; }
}
