/* ARRIVALS · the board (app). Same hard limits as arrivals.css: flap white on night, signal yellow for status
   faces, the selected row and the main action; green/red only for the 24 h change. Antonio + Encode Sans Semi
   Condensed, the lit flap module as the only motif. Everything you can press answers: hover, press, selected. */

.app { min-height: 100vh }
.bar-app { position: sticky; background: var(--night); border-bottom: 1px solid var(--t-06); box-shadow: none; pointer-events: auto; height: 64px }
.bar-app .nav { margin-right: auto; margin-left: 40px }
.acct { display: flex; align-items: center; gap: 14px }
.practice-t { font: 500 15px/1 var(--ui); color: var(--t-60); padding: 10px 2px; transition: color .15s ease }
@media (hover: hover) { .practice-t:hover { color: var(--flap) } }
.practice-t[aria-pressed="true"] { color: var(--flap); text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 2px; text-decoration-color: var(--signal) }
.chip { display: inline-flex; align-items: center; gap: 12px; height: 38px; padding: 0 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--t-25); font: 600 15px/1 var(--ui); transition: box-shadow .15s ease }
@media (hover: hover) { .chip:hover { box-shadow: inset 0 0 0 1px var(--t-60) } }
.chip-addr { color: var(--t-60); font-weight: 500 }
.practice-bar { display: flex; gap: 16px; align-items: center; padding: 10px var(--m); font-size: 14px; color: var(--t-80); border-bottom: 1px solid var(--t-06); background: #111113 }
.link { color: var(--flap); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-size: inherit }

.app-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; padding: 28px var(--m) 80px; align-items: start }
.board-col { min-width: 0 }
.board-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px }
.filters { display: flex; gap: 2px; flex-wrap: wrap }
.filters button { font: 600 15px/1 var(--ui); color: var(--t-60); padding: 11px 14px; border-radius: 6px; transition: color .15s ease, background-color .15s ease, transform .16s var(--ease-out) }
.filters button:active { transform: scale(.96) }
@media (hover: hover) { .filters button:hover { color: var(--flap); background: var(--t-06) } }
.filters button[aria-selected="true"] { color: var(--night); background: var(--flap) }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--t-12); color: var(--t-45); transition: box-shadow .15s ease }
.search:focus-within { box-shadow: inset 0 0 0 1px var(--t-45) }
.search input { background: none; border: 0; outline: 0; width: 150px; font-size: 15px; color: var(--flap) }
.search input::placeholder { color: var(--t-45) }

/* board rows: flap groups sized from --cw (set in board.js from the column width) */
.board { --cw: 16px; --gapc: 12px; position: relative }
.board-head { display: flex; gap: var(--gapc); padding: 0 10px 8px; font: 500 12px/1 var(--ui); color: var(--t-45) }
.board-head span { flex: none }
.board-head .r { text-align: right }
.rows { position: relative }
.brow { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--cw) / .64 + var(--cw) * .44); display: flex; align-items: center; gap: var(--gapc); padding: 0 10px; border-radius: 5px; text-align: left; transition: background-color .15s ease, box-shadow .15s ease, scale .16s var(--ease-out); -webkit-tap-highlight-color: transparent }
.brow:active { scale: .995 }
.vn { flex: none; font: 500 max(10px, calc(var(--cw) * .74))/1 var(--ui); color: var(--t-60); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.vn[hidden] { display: none }
@media (hover: hover) { .brow:hover { background: var(--t-06); box-shadow: inset 3px 0 0 var(--t-45) } }
/* the selected row lights up: a warm wash from the left edge, a signal-yellow rail, a hairline ring */
.brow.on, .brow.on:hover { background: linear-gradient(90deg, rgba(255,194,26,.17), rgba(255,194,26,.05) 45%, rgba(255,194,26,.03)); box-shadow: inset 3px 0 0 var(--signal), inset 0 0 0 1px rgba(255,194,26,.32) }
.brow.on .vn { color: var(--flap) }
.brow:focus-visible { outline-offset: 0 }
.board-empty { padding: 40px 10px; color: var(--t-60) }



/* ticket */
.ticket { position: sticky; top: 84px; display: grid; gap: 14px; padding: 4px 0 0; max-height: calc(100vh - 96px); overflow: auto; scrollbar-width: none }
.sheet-x, .sheet-back { display: none }
.t-head h2 { font: 700 32px/1.05 var(--ui); letter-spacing: -.012em }
.t-sub { margin-top: 8px; font-size: 15px; color: var(--t-60); line-height: 1.45 }
/* a new row: the ticket turns over into place, top to bottom, like a flap landing */
.ticket.flip > :is(.t-head, .t-px, .chart, .side, .ml, .kv) { animation: tin .26s var(--ease-out) both; transform-origin: 50% 0 }
.ticket.flip > .t-px { animation-delay: .03s } .ticket.flip > .chart { animation-delay: .06s } .ticket.flip > .side { animation-delay: .09s } .ticket.flip > .ml { animation-delay: .11s } .ticket.flip > .kv { animation-delay: .13s }
@keyframes tin { from { opacity: 0; transform: perspective(700px) rotateX(-16deg) translateY(-8px) } }
@media (prefers-reduced-motion: reduce) { .ticket.flip > * { animation: none } }
.t-px { display: flex; align-items: center; gap: 14px }
.fl-big { --cw: 26px }
.t-ch { font-size: 15px; color: var(--t-60) }
.chart { position: relative }
.chart canvas { width: 100%; height: 128px }
.intervals { display: flex; gap: 2px; margin-top: 8px }
.intervals button, .side button { font: 600 14px/1 var(--ui); color: var(--t-60); padding: 8px 11px; border-radius: 5px; transition: color .15s ease, background-color .15s ease, transform .16s var(--ease-out) }
.intervals button:active { transform: scale(.95) }
@media (hover: hover) { .intervals button:not(.on):hover { color: var(--flap); background: var(--t-06) } }
.intervals button.on { color: var(--flap); background: var(--t-12) }
/* long / short: one thumb that slides between the two */
.side { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 4px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--t-12); isolation: isolate }
.side::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 5px; background: var(--flap); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 8px rgba(0,0,0,.4); transition: transform .22s var(--press) }
.side[data-side="short"]::before { transform: translateX(100%) }
.side button { height: 46px; font-size: 17px; font-weight: 700; background: none !important }
.side button:active { transform: scale(.97) }
.side button.on { color: var(--night) }
@media (hover: hover) { .side button:not(.on):hover { color: var(--flap) } }
@media (prefers-reduced-motion: reduce) { .side::before { transition: none } }
.field { display: grid; gap: 8px }
.field-label { font-size: 14px; font-weight: 500; color: var(--t-80) }
.faint { color: var(--t-45); font-weight: 400 }
.input-wrap { display: flex; align-items: center; height: 52px; padding: 0 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--t-25); transition: box-shadow .15s ease }
.input-wrap:focus-within { box-shadow: inset 0 0 0 1px var(--flap) }
.input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font: 600 22px/1 var(--flapface); letter-spacing: .02em; color: var(--flap) }
.input::placeholder { color: var(--t-25) }
.suffix { font-weight: 600; color: var(--t-60) }
.field-sub { font-size: 13px; color: var(--t-45); min-height: 18px }
.ml { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 12px; align-items: start }
.ml > * { min-width: 0 }
.input-wrap .input { width: 100% }
.stepper { display: flex; align-items: center; height: 52px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--t-25); transition: box-shadow .15s ease }
.stepper:focus-within { box-shadow: inset 0 0 0 1px var(--flap) }
.stepper button { width: 36px; height: 100%; display: grid; place-items: center; color: var(--t-60); transition: color .15s ease }
@media (hover: hover) { .stepper button:hover { color: var(--flap) } }
.stepper .input { width: 100%; text-align: right; -moz-appearance: textfield; padding: 0 }
.stepper .input::-webkit-inner-spin-button, .stepper .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0 }
.stepper .suffix { padding: 0 2px 0 1px }
.kv { display: grid; gap: 0 }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--t-06); font-size: 16px }
.kv-row > span:first-child { color: var(--t-60) }
.kv-row > span:last-child { text-align: right }
.btn-block { width: 100% }
.btn-xs { height: 30px; padding: 0 12px; font-size: 14px }
.fine { font-size: 14px; color: var(--t-45); line-height: 1.5 }
.btn-block { height: 60px; font-size: 19px }

/* positions + history */
.acct-sec { margin-top: 52px }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px }
.sec-head h2 { font: 600 19px/1 var(--ui) }
.sec-note { font-size: 14px; color: var(--t-45) }
.empty { color: var(--t-45); font-size: 15px; padding: 14px 0; border-top: 1px solid var(--t-06) }
.tbl-wrap { overflow-x: auto }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px }
.tbl th { text-align: left; font: 500 12px/1 var(--ui); color: var(--t-45); padding: 0 12px 10px 0 }
.tbl td { padding: 12px 12px 12px 0; border-top: 1px solid var(--t-06); white-space: nowrap }
.tbl td:last-child, .tbl th:last-child { text-align: right; padding-right: 0 }
.neg { color: var(--down) }
.pos { color: var(--up) }

/* modal + toast */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(5,5,6,.72); display: grid; place-items: center; padding: 16px; animation: fade .18s ease-out }
.modal-back.out { animation: fade .14s ease-in reverse forwards }
.modal { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #121214; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--t-12), 0 30px 80px rgba(0,0,0,.6); padding: 22px; animation: rise .22s var(--ease-out) }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px }
.modal-head h2 { font: 600 20px/1 var(--ui) }
.x { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 4px; color: var(--t-60); transition: color .15s ease }
@media (hover: hover) { .x:hover { color: var(--flap) } }
.stack { display: grid; gap: 16px }
.muted { color: var(--t-60); font-size: 15px; line-height: 1.5 }
.err { color: var(--flap); font-size: 14px; min-height: 0 }
.err:empty { display: none }
.wallets { display: grid; gap: 8px }
.wallet-opt { display: flex; justify-content: space-between; align-items: center; height: 54px; padding: 0 16px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--t-12); font-weight: 600; transition: box-shadow .15s ease }
@media (hover: hover) { .wallet-opt:hover { box-shadow: inset 0 0 0 1px var(--t-45) } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.toast { position: fixed; z-index: 70; right: 20px; bottom: 20px; max-width: 380px; display: flex; gap: 14px; align-items: flex-start; padding: 14px 14px 14px 18px; border-radius: 8px; background: #17171a; box-shadow: inset 0 0 0 1px var(--t-12), 0 20px 50px rgba(0,0,0,.5); animation: rise .22s var(--ease-out) }
.toast div { display: grid; gap: 3px; font-size: 14px }
.toast span { color: var(--t-60) }
.toast button { color: var(--t-45); padding: 2px }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.98) } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-back, .toast { animation: none } }

@media (max-width: 1100px) { .app-main { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px } }
@media (max-width: 860px) {
  .app-main { grid-template-columns: 1fr; padding-top: 18px }
  .ticket { position: fixed; inset: auto 0 0 0; z-index: 40; max-height: 88vh; overflow: auto; background: #111113; border-radius: 12px 12px 0 0; box-shadow: 0 -20px 60px rgba(0,0,0,.6), inset 0 1px 0 var(--t-12); padding: 22px var(--m) calc(22px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .3s var(--ease-out) }
  .sheet-open .ticket { transform: none }
  .sheet-back { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(5,5,6,.6); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out) }
  .sheet-open .sheet-back { opacity: 1; pointer-events: auto }
  .ticket [data-go] { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -18px 18px #111113, 0 48px 0 0 #111113 }
  .chart canvas { height: 104px }
  .sheet-x { display: grid; place-items: center; position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; color: var(--t-60) }
  .board-tools { flex-direction: column; align-items: stretch }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--m) * -1); padding: 0 var(--m) }
  .filters button { flex: none }
  .search input { width: 100% }
  .bar-app .nav { display: none }
  .practice-bar { flex-wrap: wrap; gap: 6px 14px }
}
@media (prefers-reduced-motion: reduce) { .ticket, .sheet-back { transition: none } }
@media (pointer: coarse) {
  .filters button, .intervals button { min-height: 44px; padding-left: 14px; padding-right: 14px }
  .practice-t { min-height: 44px }
  .search { height: 44px }
}

/* phones: the positions table keeps market, side, mark, PnL and the close button */
@media (max-width: 720px) {
  [data-positions] .tbl th:nth-child(3), [data-positions] .tbl td:nth-child(3),
  [data-positions] .tbl th:nth-child(4), [data-positions] .tbl td:nth-child(4),
  [data-positions] .tbl th:nth-child(7), [data-positions] .tbl td:nth-child(7),
  [data-history] .tbl th:nth-child(4), [data-history] .tbl td:nth-child(4) { display: none }
}
