/* Spot trading screen: black panels separated by hairlines, like a pro exchange terminal. */
.term-page { overflow-x: hidden; }
.term-page main { padding-top: 56px; }
.term {
  --line: #1d1d1d; --mute: #8a8a8a; --up: #25a750; --down: #e0294a; --panel: #000;
  display: grid; gap: 1px; background: var(--line);
  grid-template-columns: minmax(0, 1fr) 310px 330px;
  grid-template-rows: 64px minmax(470px, 1fr) 270px 34px;
  grid-template-areas: "tick tick tick" "chart book form" "lower lower form" "fav fav fav";
  height: max(760px, calc(100vh - 56px)); font-size: 13px; color: #fff;
}
.term > * { background: var(--panel); min-width: 0; min-height: 0; }
.term .num { font-variant-numeric: tabular-nums; }
.term button { font: inherit; color: inherit; }
.t-tick { grid-area: tick; display: flex; align-items: center; gap: 22px; padding: 0 16px; position: relative; }
.t-chart { grid-area: chart; display: flex; flex-direction: column; }
.t-book { grid-area: book; display: flex; flex-direction: column; }
.t-form { grid-area: form; display: flex; flex-direction: column; overflow-y: auto; }
.t-lower { grid-area: lower; display: flex; flex-direction: column; }
.t-fav { grid-area: fav; display: flex; align-items: center; gap: 18px; padding: 0 16px; overflow-x: auto; white-space: nowrap; }

/* ticker bar */
.t-pair { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 6px 8px 6px 0; }
.t-pair .t-ic { width: 28px; height: 28px; }
.t-pair small { display: block; color: var(--mute); font-size: 11px; text-align: left; }
.t-pair strong { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.t-pair svg { color: var(--mute); }
.t-pairs { position: absolute; top: 60px; left: 12px; z-index: 30; width: 360px; padding: 8px; border-radius: 8px; background: #121212; border: 1px solid #262626; box-shadow: 0 16px 40px rgba(0,0,0,.6); display: none; }
.t-pairs.open { display: block; }
.t-pairs-h { margin: 4px 8px 8px; color: var(--mute); font-size: 12px; }
.t-pairs a { display: grid; grid-template-columns: 20px 1fr auto 64px; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 6px; color: #fff; text-decoration: none; }
.t-pairs a:hover, .t-pairs a[aria-selected="true"] { background: #1d1d1d; }
.t-pairs a span:last-child { text-align: right; }
.t-last { display: flex; flex-direction: column; }
.t-last strong { font-size: 18px; font-weight: 700; } .t-last span { font-size: 12px; }
.t-stats { display: flex; gap: 22px; margin: 0; overflow-x: auto; }
.t-stats div { white-space: nowrap; } .t-stats dt { color: var(--mute); font-size: 11px; } .t-stats dd { margin: 2px 0 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.t-mode { margin: 0 0 0 auto; max-width: 300px; font-size: 11.5px; color: #f2b33d; background: rgba(242,179,61,.1); border: 1px solid rgba(242,179,61,.25); padding: 6px 10px; border-radius: 6px; line-height: 1.35; }

/* panel heads and tabs */
.t-head { display: flex; align-items: center; height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.t-tabs { display: flex; gap: 20px; height: 100%; }
.t-tabs button { background: none; border: 0; padding: 0; height: 100%; color: var(--mute); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.t-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #fff; }
.t-tabs button:hover { color: #fff; }

/* chart */
.t-chart-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.t-ivs { display: flex; gap: 2px; padding: 8px 10px 2px; }
.t-ivs button { background: none; border: 0; color: var(--mute); padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; }
.t-ivs button[aria-pressed="true"] { background: #262626; color: #fff; }
.t-legend { padding: 4px 12px 0; font-size: 11.5px; color: var(--mute); min-height: 34px; }
.t-legend div { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.t-legend b { font-weight: 500; margin-right: 3px; color: var(--mute); }
.t-canvas { position: relative; flex: 1; min-height: 0; }
.t-canvas canvas { position: absolute; inset: 0; cursor: crosshair; }
.t-nochart { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--mute); padding: 20px; text-align: center; }
.t-info { flex: 1; overflow-y: auto; }
.t-info-in { max-width: 560px; padding: 28px; }
.t-info-in h2 { font-size: 22px; margin: 14px 0 8px; font-family: var(--ui); letter-spacing: 0; }
.t-info-in p { color: #c4c4c4; line-height: 1.6; }
.t-info-in dl { display: grid; gap: 10px; margin: 18px 0; } .t-info-in dt { color: var(--mute); font-size: 12px; } .t-info-in dd { margin: 2px 0 0; }
.t-info-in a { color: #fff; }

/* order book */
.t-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.t-tools { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 4px; }
.t-modes { display: flex; gap: 4px; }
.t-modes button { background: none; border: 0; padding: 4px; border-radius: 4px; cursor: pointer; opacity: .55; display: grid; }
.t-modes button[aria-pressed="true"] { opacity: 1; background: #1d1d1d; }
.t-group { color: var(--mute); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.t-group select { background: #1d1d1d; color: #fff; border: 0; border-radius: 4px; padding: 3px 6px; font: inherit; width: auto; }
.t-row { position: relative; display: grid; grid-template-columns: 1.1fr 1fr 1fr; height: 21px; align-items: center; padding: 0 12px; font-size: 12px; cursor: pointer; }
.t-row > span { position: relative; z-index: 1; } .t-row > span:not(:first-of-type) { text-align: right; }
.t-row i { position: absolute; right: 0; top: 1px; bottom: 1px; z-index: 0; }
.t-row.ask i { background: rgba(224,41,74,.14); } .t-row.bid i { background: rgba(37,167,80,.14); }
.t-row.ask .p { color: var(--down); } .t-row.bid .p { color: var(--up); }
.t-row:hover { background: #121212; }
.t-cols { color: var(--mute); font-size: 11px; cursor: default; height: 24px; } .t-cols:hover { background: none; }
.t-book-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.t-bside { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.t-bside.asks { justify-content: flex-end; }
.t-mid { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex: none; }
.t-mid strong { font-size: 18px; font-weight: 700; } .t-mid span { color: var(--mute); font-size: 12px; }
.t-ratio { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 11.5px; border-top: 1px solid var(--line); }
.t-ratio .b, .t-ratio .s { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; font-weight: 700; font-size: 11px; }
.t-ratio .b { border: 1px solid var(--up); color: var(--up); } .t-ratio .s { border: 1px solid var(--down); color: var(--down); }
.t-ratio .t-rbar { flex: 1; height: 4px; background: var(--down); border-radius: 2px; overflow: hidden; } .t-ratio .t-rbar i { display: block; height: 100%; background: var(--up); }
.t-trades { flex: 1; overflow-y: auto; }
.t-trades .t-row { cursor: default; }
.t-empty { color: var(--mute); padding: 24px 14px; text-align: center; }
.t-empty a { color: #fff; }

/* order form */
#tForm { padding: 14px 16px 18px; display: flex; flex-direction: column; }
.t-side { display: grid; grid-template-columns: 1fr 1fr; background: #1d1d1d; border-radius: 8px; padding: 3px; }
.t-side button { border: 0; background: none; padding: 8px; border-radius: 6px; font-weight: 600; cursor: pointer; color: var(--mute); }
.t-side button[data-side="buy"][aria-selected="true"] { background: var(--up); color: #fff; }
.t-side button[data-side="sell"][aria-selected="true"] { background: var(--down); color: #fff; }
.t-type { display: flex; gap: 18px; margin: 14px 0 4px; }
.t-type button { background: none; border: 0; padding: 4px 0; color: var(--mute); font-weight: 600; cursor: pointer; }
.t-type button[aria-selected="true"] { color: #fff; }
.t-lbl { color: var(--mute); font-size: 12px; margin: 12px 0 6px; display: block; }
.t-pricebox { display: grid; grid-template-columns: 1fr 84px; gap: 8px; }
.t-input { position: relative; display: flex; align-items: center; background: #1d1d1d; border: 1px solid transparent; border-radius: 8px; height: 42px; }
.t-input:focus-within { border-color: #fff; }
.t-input input { all: unset; flex: 1; min-width: 0; padding: 0 12px; font-size: 14px; font-variant-numeric: tabular-nums; color: #fff; }
.t-input input:disabled { color: var(--mute); }
.t-input input::placeholder { color: #5f5f5f; }
.t-steps { display: flex; flex-direction: column; padding-right: 4px; }
.t-steps button { background: none; border: 0; color: var(--mute); font-size: 9px; line-height: 1; padding: 3px 6px; cursor: pointer; } .t-steps button:hover { color: #fff; }
.t-bbo { background: #1d1d1d; border: 1px solid #2a2a2a; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.t-bbo:hover { border-color: #fff; }
.t-slider { position: relative; margin: 16px 2px 2px; height: 34px; }
.t-slider input { position: absolute; inset: 0 0 auto; width: 100%; height: 14px; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.t-slider::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: #333; }
.t-slider::after { content: ""; position: absolute; left: 0; top: 6px; height: 2px; width: var(--v, 0%); background: #fff; }
.t-dots { position: absolute; left: 0; right: 0; top: 2px; display: flex; justify-content: space-between; }
.t-dots i { width: 10px; height: 10px; border-radius: 50%; background: #000; border: 2px solid #444; box-sizing: border-box; z-index: 1; }
.t-dots i.on { border-color: #fff; background: #fff; }
.t-ticks { position: absolute; left: -4px; right: -8px; top: 16px; display: flex; justify-content: space-between; color: var(--mute); font-size: 11px; }
.t-kv { margin: 12px 0 0; display: grid; gap: 6px; } .t-kv div { display: flex; justify-content: space-between; }
.t-kv dt { color: var(--mute); } .t-kv dd { margin: 0; } .t-kv a { color: var(--mute); text-decoration: underline dotted; }
.t-submit { margin-top: 16px; height: 44px; border: 0; border-radius: 999px; font-weight: 700; font-size: 15px; cursor: pointer; color: #fff; }
.t-submit.buy { background: var(--up); } .t-submit.sell { background: var(--down); }
.t-submit:disabled { background: #2a2a2a; color: #9a9a9a; cursor: not-allowed; }
.t-err { color: var(--down); min-height: 1.2em; margin: 8px 0 0; font-size: 12px; }
.t-wait { text-align: center; color: #fff; font-weight: 600; font-size: 13px; padding: 10px; border: 1px solid #333; border-radius: 999px; text-decoration: none; }
.t-wait:hover { border-color: #fff; }
.t-wait[hidden] { display: none; }
.t-fee { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }

/* lower panel */
.t-lower-body { flex: 1; overflow-y: auto; }
.t-lrow { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1.2fr .8fr; gap: 8px; padding: 9px 14px; border-bottom: 1px solid #111; align-items: center; font-size: 12.5px; }
.t-lhead { color: var(--mute); font-size: 11.5px; }
.t-cancel { background: none; border: 1px solid #333; border-radius: 999px; padding: 3px 10px; cursor: pointer; } .t-cancel:hover { border-color: #fff; }
.t-cta { display: inline-block; margin-top: 8px; padding: 8px 16px; border-radius: 999px; background: #fff; color: #000 !important; font-weight: 600; text-decoration: none; }

/* favourites bar */
.t-fav-h { color: var(--mute); font-size: 12px; }
.t-fav a { display: flex; gap: 8px; color: #fff; text-decoration: none; font-size: 12px; }
.t-fav a[aria-current="true"] span:first-child { font-weight: 700; }
.t-errbar { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); background: #2a1215; color: #ffb3c0; border: 1px solid #5a1f2a; padding: 8px 14px; border-radius: 8px; z-index: 40; }
.t-toast { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); background: #fff; color: #000; padding: 10px 18px; border-radius: 8px; font-weight: 600; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.t-toast.bad { background: var(--down); color: #fff; }

/* tablets and phones: stack like a mobile exchange */
@media (max-width: 1180px) {
  .term { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 460px 560px auto 34px;
    grid-template-areas: "tick tick" "chart chart" "book form" "lower lower" "fav fav"; height: auto; }
  .t-tick { flex-wrap: wrap; padding: 10px 16px; row-gap: 8px; }
  .t-mode { margin-left: 0; max-width: none; flex-basis: 100%; }
  .t-lower { min-height: 260px; }
}
@media (max-width: 720px) {
  .term { grid-template-columns: 1fr; grid-template-rows: auto 380px 520px auto auto 34px;
    grid-template-areas: "tick" "chart" "book" "form" "lower" "fav"; }
  .t-stats { gap: 16px; flex-basis: 100%; }
  .t-pairs { width: calc(100vw - 24px); }
  .t-lrow { grid-template-columns: 1.3fr 1fr 1fr 1fr; } .t-lrow > span:nth-child(5), .t-lrow > span:nth-child(6) { display: none; }
}
.term [hidden] { display: none !important; }
.t-pricebox .t-input { min-width: 0; }
.t-ticks span { cursor: pointer; } .t-ticks span:hover { color: #fff; }
