/* trade.css: the KORE terminal. Neutral near-black, dense and numeric; longs green, shorts red. */
body.term {
  /* the landing palette, a step lighter: forest glass panels over the mint radial, mint signal, coral shorts */
  --ink: #03110D; --bg: #072019; --panel: rgba(5, 25, 20, 0.74); --panel-solid: #06201A;
  --surface: #0A2A22; --surface-2: #0E342A; --surface-3: #164536;
  --line: rgba(156, 232, 199, 0.11); --line-2: rgba(156, 232, 199, 0.18); --line-3: rgba(156, 232, 199, 0.34);
  --text: #EAFFF5; --text-2: #A8D5C4; --text-3: #6F9D8D;
  --mint-wash: rgba(156, 232, 199, 0.08); --chart-dot: rgba(156, 232, 199, 0.17);
  --page-bg: radial-gradient(90% 70% at 70% 0%, #0E3A2F 0%, #082820 38%, #051914 72%, #04130F 100%);
  background: var(--bg); background-image: var(--page-bg); background-attachment: fixed; font-size: var(--fs-sm);
}

/* top bar */
.tbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1.25rem; height: 56px; padding: 0 1rem; border-bottom: 1px solid var(--line); background: rgba(6, 30, 24, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tbar .lock { flex: none; }
.tbar .lock img { width: 22px; }
.tbar .lock span { font-size: .9375rem; }
.mkt-wrap { position: relative; }
.mkt { display: flex; align-items: center; gap: .5rem; height: 38px; padding: 0 .75rem 0 .5rem; border: 1px solid var(--line-2); border-radius: var(--r-md); transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.mkt:hover, .mkt[aria-expanded="true"] { border-color: var(--line-3); background: var(--surface-2); }
.mkt b { font-weight: 600; font-size: var(--fs-md); }
.mkt-u { color: var(--text-3); font-size: var(--fs-xs); }
.chev { width: 8px; height: 8px; border-right: 1.5px solid var(--text-2); border-bottom: 1.5px solid var(--text-2); transform: translateY(-2px) rotate(45deg); margin-left: .25rem; }
.picker { position: absolute; top: calc(100% + 6px); left: 0; width: min(560px, calc(100vw - 2rem)); background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 24px 60px -20px var(--ink); z-index: 50; overflow: hidden; }
.pq { display: flex; align-items: center; gap: .5rem; padding: .75rem; border-bottom: 1px solid var(--line); }
.pq input { flex: 1; min-width: 0; height: 36px; padding: 0 .75rem; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); outline: 0; }
.pq input:focus { border-color: var(--mint); }
kbd { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 4px; padding: .125rem .375rem; }
.pf { padding: 0 .75rem; }
.phead, .prow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .9fr); gap: .75rem; align-items: center; padding: .5rem .75rem; }
.phead { color: var(--text-3); font-size: var(--fs-xs); border-bottom: 1px solid var(--line); }
.phead span:not(:first-child), .prow > span:not(:first-child) { text-align: right; }
.plist { max-height: min(60vh, 460px); overflow-y: auto; }
.prow { width: 100%; text-align: left; font-family: var(--font-mono); font-size: var(--fs-xs); border-bottom: 1px solid var(--line); transition: background-color var(--t-fast) var(--ease); }
.prow:hover, .prow:focus-visible, .prow.on { background: var(--mint-wash); }
.pm { display: flex; align-items: center; gap: .5rem; font-family: var(--font); font-size: var(--fs-sm); min-width: 0; }
.pm b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm i:not(.mono) { font-style: normal; font-family: var(--font-mono); color: var(--text-3); font-size: .6875rem; }
.pm .tag { padding: .1875rem .375rem; font-size: .6875rem; }
.pnone { padding: 1.5rem .75rem; color: var(--text-2); }

.stats { display: flex; gap: 1.5rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.stats::-webkit-scrollbar { display: none; }
.stats > div { display: grid; gap: 0; white-space: nowrap; }
.stats span { font-size: .6875rem; color: var(--text-3); }
.stats b { font-weight: 500; font-size: var(--fs-sm); }
.stats em { font-style: normal; font-size: .6875rem; color: var(--text-3); }
.stats .px { font-size: var(--fs-md); }
.px.fu { color: var(--up); } .px.fd { color: var(--down); }
.tbar-r { margin-left: auto; position: relative; flex: none; }
.wbtn.on { border-color: var(--mint); }
.wmenu { position: absolute; right: 0; top: calc(100% + 6px); display: grid; min-width: 160px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: .25rem; z-index: 50; }
.wmenu button { text-align: left; padding: .5rem .625rem; border-radius: var(--r-sm); }
.wmenu button:hover { background: var(--mint-wash); }

/* grid */
.tgrid { display: grid; gap: 1px; min-height: calc(100dvh - 56px);
  grid-template-columns: minmax(0, 1fr) 290px 320px; grid-template-rows: minmax(480px, 1fr) minmax(220px, 27vh);
  grid-template-areas: "chart book ticket" "lower lower acct"; }
.panel { background: var(--panel); outline: 1px solid var(--line); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chart-p { position: relative; z-index: 1; }
.chart-p::before, .chart-p::after { content: ""; position: absolute; right: -7px; width: 13px; height: 13px; pointer-events: none; z-index: 3;
  background: linear-gradient(var(--line-3), var(--line-3)) center / 1px 100% no-repeat, linear-gradient(var(--line-3), var(--line-3)) center / 100% 1px no-repeat; }
.chart-p::before { top: -7px; } .chart-p::after { bottom: -7px; }
.chart-p { grid-area: chart; } .book-p { grid-area: book; } .ticket { grid-area: ticket; } .acct { grid-area: acct; } .lower { grid-area: lower; }
@media (max-width: 1180px) {
  .tgrid { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(420px, 56vh) auto auto auto; grid-template-areas: "chart ticket" "book ticket" "lower lower" "acct acct"; }
  .book-p { min-height: 320px; }
}
@media (max-width: 760px) {
  .tgrid { grid-template-columns: minmax(0, 1fr); grid-template-rows: 380px auto 360px auto auto; grid-template-areas: "chart" "ticket" "book" "lower" "acct"; }
  .stats { display: none; }
  .mkt-u { display: none; }
  .tbar { gap: .75rem; } .tbar .lock span { display: none; }
}

/* tabs */
.ptabs { display: flex; gap: 1rem; padding: 0 .875rem; border-bottom: 1px solid var(--line); flex: none; }
.ptabs button { height: 40px; color: var(--text-3); font-size: var(--fs-sm); border-bottom: 1.5px solid transparent; margin-bottom: -1px; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.ptabs button:hover { color: var(--text-2); }
.ptabs button.on { color: var(--text); border-bottom-color: var(--mint); }
.ptabs i { font-style: normal; font-family: var(--font-mono); font-size: .6875rem; color: var(--mint); }

/* chart */
.ivals { display: flex; align-items: center; gap: .125rem; height: 38px; padding: 0 .5rem; border-bottom: 1px solid var(--line); flex: none; position: relative; z-index: 5; }
.ivfav { display: flex; align-items: center; gap: .125rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ivfav::-webkit-scrollbar { display: none; }
.ivfav button { height: 26px; padding: 0 .5rem; border-radius: var(--r-sm); color: var(--text-3); font: 500 var(--fs-xs)/1 var(--font-mono); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.ivfav button:hover { color: var(--text); }
.ivfav button.on { background: var(--mint-wash); color: var(--mint); box-shadow: inset 0 0 0 1px var(--line-2); }
.ivmore-w { position: relative; flex: none; }
.ivmore { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-3); }
.ivmore:hover, .ivmore[aria-expanded="true"] { background: var(--surface-2); }
.ivmore .chev { margin: 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--t-fast) var(--ease); }
.ivmore[aria-expanded="true"] .chev { transform: translateY(2px) rotate(225deg); }
.ivmenu { position: absolute; top: calc(100% + 6px); left: 0; width: 210px; max-height: min(70vh, 560px); overflow-y: auto; padding: .25rem 0; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .8); z-index: 60; }
.ivh { padding: .625rem .875rem .375rem; font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); border-top: 1px solid var(--line); }
.ivh:first-child { border-top: 0; }
.ivr { display: flex; align-items: center; }
.ivr:hover { background: var(--mint-wash); }
.ivr.on { background: var(--chrome); }
.ivr.on .ivp { color: var(--ink); }
.ivp { flex: 1; text-align: left; padding: .4375rem .875rem; color: var(--text); font-size: var(--fs-sm); }
.ivs { display: grid; place-items: center; width: 34px; height: 30px; color: var(--text-3); }
.ivs svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.ivs.on { color: #F5B83D; } .ivs.on svg { fill: currentColor; }
.ivr.on .ivs:not(.on) { color: var(--surface-3); }
.ivs:hover { color: #F5B83D; }
.ohlc { margin-left: auto; padding-left: .75rem; display: flex; gap: .375rem; font-size: .6875rem; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.ohlc b { font-weight: 400; color: var(--text-2); margin-right: .375rem; }
.ohlc .up { color: var(--up); } .ohlc .dn { color: var(--down); }
#chart { flex: 1; width: 100%; min-height: 0; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }

/* book + trades */
.bhd, .lv, .spr, .tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 .875rem; }
.bhd { color: var(--text-3); font-size: .6875rem; padding-top: .5rem; padding-bottom: .375rem; flex: none; }
.bhd span:not(:first-child), .lv span:not(:first-child), .spr span:not(:first-child), .tr span:not(:first-child) { text-align: right; }
.book, .trades { flex: 1; overflow: hidden; font-size: var(--fs-xs); }
.trades { overflow-y: auto; }
.lv { position: relative; height: 21px; align-items: center; cursor: pointer; }
.lv::before { content: ""; position: absolute; inset: 1px 0 1px auto; width: var(--w); opacity: .16; pointer-events: none; }
.lv.a::before { background: var(--down); } .lv.b::before { background: var(--up); }
.lv.a span:first-child { color: var(--down); } .lv.b span:first-child { color: var(--up); }
.lv:hover { background: var(--surface-2); }
.spr { height: 30px; align-items: center; border-block: 1px solid var(--line); color: var(--text-2); margin: 2px 0; }
.spr span:first-child { color: var(--text); font-weight: 500; }
.tr { height: 21px; align-items: center; }
.tr.b span:first-child { color: var(--up); } .tr.a span:first-child { color: var(--down); }
.tr.new { animation: flash .6s var(--ease); }
@keyframes flash { from { background: var(--mint-wash); } }

/* ticket */
.ticket { padding: .875rem; gap: .875rem; overflow-y: auto; }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface-2); }
.side button { height: 36px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.side button[data-s="long"].on { background: var(--chrome); color: var(--ink); }
.side button[data-s="short"].on { background: var(--down); color: var(--ink); }
.otype { display: flex; align-items: center; gap: 1rem; }
.otype button { color: var(--text-3); padding: .25rem 0; border-bottom: 1.5px solid transparent; }
.otype button.on { color: var(--text); border-bottom-color: var(--mint); }
.mmode { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: .125rem .5rem; }
.fld { display: flex; align-items: center; gap: .5rem; height: 44px; padding: 0 .75rem; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); transition: border-color var(--t-fast) var(--ease); }
.fld:focus-within { border-color: var(--mint); }
.fld > span { color: var(--text-3); font-size: var(--fs-xs); width: 3.75rem; flex: none; }
.fld input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; text-align: right; font-size: var(--fs-md); }
.fld em { font-style: normal; color: var(--text-3); font-size: var(--fs-xs); }
.pcts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .375rem; }
.pcts button { height: 28px; border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-xs); transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.pcts button:hover { border-color: var(--line-3); color: var(--text); }
.lev { display: grid; gap: .25rem; }
.lev-h { display: flex; justify-content: space-between; color: var(--text-3); font-size: var(--fs-xs); }
.lev-h b { color: var(--text); font-weight: 500; }
.lev-s { display: flex; justify-content: space-between; color: var(--text-3); font-size: .6875rem; }
input[type="range"] { --f: 25%; appearance: none; -webkit-appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--mint) var(--f), var(--line-2) var(--f)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--mint) var(--f), var(--line-2) var(--f)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--mint-hi); border: 3px solid var(--ink); box-shadow: 0 0 0 1px var(--mint); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--mint-hi); border: 3px solid var(--ink); box-shadow: 0 0 0 1px var(--mint); }
.sum { margin: 0; display: grid; gap: .375rem; padding: .75rem 0; border-block: 1px solid var(--line); }
.sum div { display: flex; justify-content: space-between; }
.sum dt { color: var(--text-3); font-size: var(--fs-xs); }
.sum dd { margin: 0; font-size: var(--fs-xs); }
.go { --h: 46px; width: 100%; font-size: var(--fs-sm); }
.go.long { background: var(--chrome); color: var(--ink); border-color: transparent; box-shadow: 0 8px 28px -10px var(--mint-glow); }
.go.short { background: var(--down); color: var(--ink); border-color: transparent; }
.go.long:hover, .go.short:hover { filter: brightness(1.08); }
.tnote { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }

/* account */
.acct { padding: .875rem; gap: .75rem; overflow-y: auto; }
.ac-rows { display: grid; gap: .375rem; }
.ac-rows div { display: flex; justify-content: space-between; }
.ac-rows span { color: var(--text-3); font-size: var(--fs-xs); }
.ac-rows b { font-weight: 500; font-size: var(--fs-xs); }
.ac-key { display: flex; gap: .625rem; align-items: flex-start; padding: .625rem .75rem; border: 1px solid var(--line); border-radius: var(--r-md); }
.ac-key > i { width: 8px; height: 8px; border-radius: 50%; margin-top: .35rem; flex: none; border: 1.5px solid var(--text-3); }
.ac-key.on > i { background: var(--mint); border-color: var(--mint); box-shadow: 0 0 10px var(--mint-glow); }
.ac-key b { display: block; font-weight: 500; font-size: var(--fs-xs); }
.ac-key span { font-size: .6875rem; color: var(--text-3); font-family: var(--font-mono); word-break: break-all; }
.ac-empty { font-size: var(--fs-xs); color: var(--text-2); }
.ac-empty a { color: var(--mint); }
.acct .truth { font-size: .6875rem; }

/* lower */
.lpane { flex: 1; overflow: auto; }
.empty { padding: 1.25rem .875rem; color: var(--text-3); }
.lower .tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.lower .tbl th { text-align: left; font-weight: 400; color: var(--text-3); padding: .5rem .875rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); white-space: nowrap; }
.lower .tbl td { padding: .5rem .875rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); white-space: nowrap; }
.lower .tbl td b { font-family: var(--font); font-weight: 500; }
.lower .tbl td em { font-style: normal; color: var(--text-3); margin-left: .5rem; font-family: var(--font); }

/* seals */
.seals:not([hidden]) { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.seal-art { padding: .875rem; border-right: 1px solid var(--line); display: grid; gap: .625rem; align-content: start; }
#sealCv { width: 100%; aspect-ratio: 1; }
.seal-cap { font-size: .6875rem; color: var(--text-3); font-family: var(--font-mono); line-height: 1.5; }
.seal-cap b { display: block; color: var(--text); font-family: var(--font); font-size: var(--fs-xs); font-weight: 500; }
.seal-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.seal-top { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .625rem .875rem; border-bottom: 1px solid var(--line); }
#sRes { font-size: var(--fs-xs); color: var(--text-2); }
#sRes.ok { color: var(--up); } #sRes.bad { color: var(--down); }
.seal-list { overflow-y: auto; flex: 1; }
.srow { display: grid; grid-template-columns: 3.5rem 4.5rem minmax(0, 1fr) auto; gap: .75rem; width: 100%; text-align: left; padding: .5rem .875rem; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); transition: background-color var(--t-fast) var(--ease); }
.srow:hover, .srow.on { background: var(--mint-wash); }
.srow .si { font-family: var(--font-mono); color: var(--mint); }
.srow .st { font-family: var(--font-mono); color: var(--text-3); }
.srow .sx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .sr { color: var(--text-2); } .srow .sr.bad { color: var(--down); }
@media (max-width: 760px) { .seals:not([hidden]) { grid-template-columns: minmax(0, 1fr); } .seal-art { grid-template-columns: 120px minmax(0, 1fr); border-right: 0; border-bottom: 1px solid var(--line); } }
