/* Lot Q2, the trading flow: the ticket's chosen side and size mode, the summary over the key, what an order became
   (under the key and on its row), the sortable tables, the ladder's volumes. Loaded after the other sheets of desk/. */

/* ---- the side chosen: filled in its colour (buy green, sell red, the order key's own); the other one quiet ---- */
.tk-sides .key { transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.tk-sides .key[aria-pressed="false"] { background: none; box-shadow: inset 0 0 0 1px var(--hair); color: var(--dim); }
.tk-sides .key[aria-pressed="true"][data-side="1"] { background: linear-gradient(var(--buy-hi), var(--buy)); box-shadow: inset 0 1px 0 var(--key-shine), 0 1px 0 var(--key-edge); color: var(--key-ink); }
.tk-sides .key[aria-pressed="true"][data-side="-1"] { background: linear-gradient(var(--sell-hi), var(--sell)); box-shadow: inset 0 1px 0 var(--key-shine), 0 1px 0 var(--key-edge); color: var(--key-ink); }
/* the room the summary takes is given back by the side keys on a computer (32 -> 30 px) */
.term[data-form="desk"] .tk-sides .key { min-height: 30px; }
@media (max-height: 680px) { .term[data-form="desk"] .tk-sides .key { min-height: 28px; } }
@media (hover: hover) { .tk-sides .key[aria-pressed="false"]:not(:disabled):hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-3); filter: none; } }

/* ---- the size's mode: its label says it ($, coins, or the loss at the stop), the mode chosen stands out ---- */
.seg-unit .seg-b[aria-pressed="true"] { background: var(--surface-4); box-shadow: inset 0 0 0 1px var(--hair-3); color: var(--text); }
.term[data-form="desk"] .seg-unit .seg-b { min-height: 20px; padding: 0 8px; }

/* ---- the summary over the key, one line: the size, then the loss at the stop and the gain at the target after the
   chart's own words (SL, TP; the full words stay for a screen reader); a dash where there is none ---- */
.tk-sum { flex: none; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); margin: 0; border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
.tk-sum > div { display: flex; align-items: baseline; justify-content: center; gap: 5px; min-width: 0; padding: 2px 6px; }
.tk-sum > [data-k="qty"] > dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }   /* the size alone: its word for a screen reader only */
.tk-sum > div + div { border-inline-start: 1px solid var(--hair); }
.tk-sum dt { color: var(--dim); font-size: 0; }
.tk-sum dt::before { content: attr(data-short); font-size: var(--fs-xs); font-weight: 700; }
.tk-sum dd { margin: 0; color: var(--text); font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.tk-sum dd small { color: var(--dim); font-size: 10px; font-weight: 600; }

/* the check and the summary one block over the key: the summary is the check's foot */
.tk-verdict { flex: none; display: flex; flex-direction: column; min-height: 0; }
.tk-verdict > .tk-check { border-radius: var(--r) var(--r) 0 0; }
.tk-verdict > .tk-sum { margin-top: -1px; border-radius: 0 0 var(--r) var(--r); }

/* ---- what the order became, under the key: sent, placed, filled, refused (the word, then the reason). The colour
   reaches 4 px around the words without taking height (a ring of shadow): the column keeps Q1's height ---- */
.ticketp .tk-msg[data-news] { border-radius: 3px; color: var(--text); background: var(--surface-3); box-shadow: 0 0 0 4px var(--surface-3); }
.ticketp .tk-msg[data-news="filled"] { background: var(--up-soft); box-shadow: 0 0 0 4px var(--up-soft), -4px 0 0 4px var(--up); }
.ticketp .tk-msg[data-news="refused"] { background: var(--down-soft); box-shadow: 0 0 0 4px var(--down-soft), -4px 0 0 4px var(--down); color: var(--text); }
.ticketp .tk-msg[data-news="refused"]::before { content: attr(data-word) "\00a0"; color: var(--down); font-weight: 700; }
.ticketp .tk-msg[data-news="sent"] { animation: pstate-breathe 0.8s var(--ease) infinite alternate; }

/* ---- on its row: the position a fill reached, the order just placed, for a moment ---- */
.tbl tr[data-news="filled"] td { background: var(--up-soft); }
.tbl tr[data-news="placed"] td { background: var(--surface-3); }
.tbl tr[data-news] td:first-child { box-shadow: inset 3px 0 0 var(--up); }
.tbl tr[data-news="placed"] td:first-child { box-shadow: inset 3px 0 0 var(--silver); }
:root[dir="rtl"] .tbl tr[data-news] td:first-child { box-shadow: inset -3px 0 0 var(--up); }
:root[dir="rtl"] .tbl tr[data-news="placed"] td:first-child { box-shadow: inset -3px 0 0 var(--silver); }

/* ---- the tables: the P&L in the figures' face, bold; a header that sorts says its order ---- */
.tbl td[data-tone] { font-weight: 600; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.th-sort::after { content: ""; width: 0; height: 0; border-inline: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0; }
.tbl th[aria-sort="ascending"], .tbl th[aria-sort="descending"] { color: var(--text); }
.tbl th[aria-sort="ascending"] .th-sort::after { border-top: 0; border-bottom: 5px solid currentColor; opacity: 1; }
.tbl th[aria-sort="descending"] .th-sort::after { opacity: 1; }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
@media (hover: hover) { .th-sort:hover { color: var(--text); } .th-sort:hover::after { opacity: 0.5; } }
.term[data-form="phone"] .th-sort { min-height: 44px; }      /* a thumb's size where a table keeps its head (history) */

/* ---- the ladder: the price column in the middle (an end column as wide as the marks'), the book's sizes in their
   side's colour over stronger bars, the volume traded at each price in silver (its column's head says which side) ---- */
.ld-head, .ld-row { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1.45fr) 74px minmax(0, 1.45fr) minmax(0, 1fr) 28px; padding: 0 2px; }
.ld-head span, .ld-row > span { padding: 0 3px; }
.ld-head span { padding: 0 1px; font-size: 10px; text-overflow: ellipsis; }
.ld-row .ld-q .num { font-weight: 600; }
.ld-row .ld-q[data-side="b"] .num { color: var(--up); }
.ld-row .ld-q[data-side="a"] .num { color: var(--down); }
.ld-q[data-side="b"] .ld-bar { background: color-mix(in srgb, var(--up) 24%, transparent); }
.ld-q[data-side="a"] .ld-bar { background: color-mix(in srgb, var(--down) 24%, transparent); }
.ld-row > .num[data-tone] { color: var(--silver); }
.ld-head span:nth-child(2) { color: var(--down); }
.ld-head span:nth-child(6) { color: var(--up); }
.ld-row .ld-px { color: var(--text); }

/* a short window: the summary over the key carries the figures, the check's list of facts gives its height back */
@media (max-height: 760px) { .term[data-form="phone"] .tk-what { display: none !important; } }
/* a short phone: the check a little tighter */
@media (max-height: 700px) { .term[data-form="phone"] .tk-check { padding: 5px 10px; } }

@media (prefers-reduced-motion: reduce) { .ticketp .tk-msg[data-news="sent"] { animation: none; } }
