/* Last sheet (from the mock-up v5): the pieces shared by both forms that no other sheet owns, then the phone form. */
[hidden] { display: none !important; }

/* On a computer the phone bands stay out. */
.strip, .pkeys, .ptabs { display: none; }

/* Chart lines: the ticket's draft tags sit on the right, next to the price axis, so they never cover the position's tags. */
.ln[data-draft="1"] .ln-tag { left: auto; right: calc(var(--axis, 64px) + 10px); }
.ln-tag .i { width: 12px; height: 12px; }

/* Ticket */
.tk-hint { margin: 0; min-height: 1.4em; }
.tk-expo { flex: none; display: grid; grid-template-columns: auto minmax(40px, 1fr) auto; align-items: center; gap: 10px; color: var(--mute); font-size: 12px; }
.tk-expo .g-bar { grid-column: auto; }
/* What the typed size amounts to, inside the size box: it gives way before the number does. */
.tk-approx { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.tk-approx:empty { display: none; }
.ticketp .field input { min-width: 56px; }
.tk-check > span { color: var(--mute); }
.tk-check .tk-what { margin: 0; }

/* Rules of the account */
.g-rulesbox { display: grid; gap: 8px; }
.gaugep .g-rulesbox { display: none; }
.g-note { margin: 0; color: var(--dim); font-size: 11.5px; }
.g-rules { display: grid; margin: 0; padding: 0; list-style: none; }
.g-rules li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 12.5px; }
.g-rules li:last-child { border-bottom: 0; }
.g-rules span { color: var(--mute); }
.g-rules b { color: var(--text); font-weight: 500; text-align: right; }
.bot-pad { padding: 12px 14px; }
/* In the wide bottom panel the rules stand in two columns: each name stays near its value and the whole list shows
   without scrolling on a 768-pixel-high screen. The last rule of each column carries no hairline (the one before the
   last closes the other column, whether the list is even or odd). */
.term[data-form="desk"] .bot-pad .g-rules { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; }
.term[data-form="desk"] .bot-pad .g-rules li:nth-last-child(2) { border-bottom: 0; }
.tbl td[data-sym] { cursor: pointer; }

/* ---------- Phone form ---------- */
.term[data-form="phone"] { grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; grid-template-areas: "tbar" "banners" "strip" "main" "pkeys" "ptabs"; }
.strip { grid-area: strip; }
.pkeys { grid-area: pkeys; }
.ptabs { grid-area: ptabs; }
.term[data-form="phone"] .sbar,
.term[data-form="phone"] .stats,
.term[data-form="phone"] .acct-pill,
.term[data-form="phone"] #keysBtn,
.term[data-form="phone"] .brand-name,
.term[data-form="phone"] .mkt-fam,
.term[data-form="phone"] #palBtn span,
.term[data-form="phone"] #palBtn kbd,
.term[data-form="phone"] .w { display: none; }

/* Touch targets */
.term[data-form="phone"] .key,
.term[data-form="phone"] .seg-b,
.term[data-form="phone"] .chip,
.term[data-form="phone"] .field { min-height: 44px; }
.term[data-form="phone"] .seg-b { min-width: 44px; }
.term[data-form="phone"] .key-ico { width: 44px; }
.term[data-form="phone"] .field input { height: 42px; font-size: 16px; }

/* Top bar */
.term[data-form="phone"] .tbar { gap: 8px; min-height: 52px; padding: 0 10px; }
.term[data-form="phone"] .tbar .app-back { min-width: 44px; min-height: 44px; }   /* a finger's key, as every key of the phone */
.term[data-form="phone"] .menu-btn > .i { display: none; }        /* the initial alone is the menu's key */
/* No status bar on a phone: its legal line (the firm, the demo note, the chart's licence) closes the menu. */
@media (max-width: 380px) { .term[data-form="phone"] .brandmark { display: none; } }   /* 360 px: the market and its price first */
.term[data-form="phone"] .quote { display: grid; justify-items: end; gap: 0; margin-left: auto; line-height: 1.15; }
.term[data-form="phone"] .quote-px { font-size: 15px; }
.term[data-form="phone"] .quote-ch { font-size: 11.5px; }
.term[data-form="phone"] .tbar-end { margin-left: 0; }
.term[data-form="phone"] #palBtn { width: 44px; padding: 0; justify-content: center; }

/* Account strip: equity, day, the account between its limit and its target. One tap opens the account tab. */
.term[data-form="phone"] .strip { display: grid; grid-template-columns: auto auto minmax(36px, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.st-eq { font-size: 13px; font-weight: 600; }
.st-day { font-size: 11.5px; }
.st-track { position: relative; height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--down-rail) 0 var(--start, 50%), var(--up-rail) var(--start, 50%) 100%); }
.st-track::before { content: ""; position: absolute; left: 0; top: -3px; width: 2px; height: 10px; background: var(--down); }   /* the limit's end red */
.st-track::after { content: ""; position: absolute; right: 0; top: -3px; width: 2px; height: 10px; background: var(--up); }    /* the target's end green */
.st-fill { position: absolute; top: 0; left: var(--from, 0%); width: var(--len, 0%); height: 100%; border-radius: 2px; background: var(--text); }
.st-track[data-tone="up"] .st-fill { background: var(--up); }
.st-track[data-tone="down"] .st-fill { background: var(--down); }
.st-mark { position: absolute; left: var(--at, 0%); top: 50%; width: 2px; height: 10px; margin: -5px 0 0 -1px; border-radius: 1px; background: var(--text); }
.st-goal { color: var(--mute); font-size: 11.5px; white-space: nowrap; }
.strip:focus-visible, .ptab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Every plate fills the phone's width: no corner marks at the window's edges. */
.term[data-form="phone"] .plate::before { display: none; }

/* One panel at a time, chosen by the tab. */
.term[data-form="phone"] .tgrid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: none; gap: 0; padding: 0; }
.term[data-form="phone"] .side { display: contents; }
.term[data-form="phone"] .chartp,
.term[data-form="phone"] .bookp,
.term[data-form="phone"] .botp,
.term[data-form="phone"] .gaugep,
.term[data-form="phone"] .marketsp { display: none; grid-area: 1 / 1; min-width: 0; min-height: 0; border-radius: 0; box-shadow: none; }
.term[data-form="phone"][data-tab="chart"] .chartp,
.term[data-form="phone"][data-tab="book"] .bookp,
.term[data-form="phone"][data-tab="positions"] .botp,
.term[data-form="phone"][data-tab="account"] .gaugep,
.term[data-form="phone"][data-tab="markets"] .marketsp { display: flex; flex-direction: column; }
.term[data-form="phone"] .gaugep { overflow-y: auto; padding-bottom: 20px; }
.term[data-form="phone"] .gaugep .g-rulesbox { display: grid; margin-top: 6px; }
.term[data-form="phone"] .marketsp { position: static; width: auto; max-height: none; visibility: visible; opacity: 1; transform: none; background: var(--surface); }
.term[data-form="phone"] .mk-row { grid-template-columns: 44px minmax(0, 1fr) auto 68px 44px; min-height: 48px; }
.term[data-form="phone"] .mk-star { width: 44px; height: 48px; }
.term[data-form="phone"] .ctool { gap: 8px; min-height: 48px; overflow-x: auto; scrollbar-width: none; }
.term[data-form="phone"] .ctool::-webkit-scrollbar { display: none; }
/* Chart bar: two icon keys; the drawing tools open as a list. */
.term[data-form="phone"] #indBtn span, .term[data-form="phone"] #drawBtn span { display: none; }
.term[data-form="phone"] .ct-open { position: relative; width: 44px; padding: 0; justify-content: center; }
.term[data-form="phone"] .ct-bar { display: none; }
.term[data-form="phone"] #drawBtn { display: inline-flex; }
.term[data-form="phone"] .ctool-n { position: absolute; top: 5px; right: 3px; }
.term[data-form="phone"] .cpop { width: calc(100% - 16px); }
.term[data-form="phone"] .ct-item { min-height: 44px; font-size: 14px; }

/* The ticket is a sheet that rises over the chart. */
.term[data-form="phone"] .ticketp { position: absolute; left: 0; right: 0; bottom: 0; z-index: 45; max-height: 92%; gap: 8px; padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); border-radius: 14px 14px 0 0; background: var(--surface-2); box-shadow: var(--shadow-pop); visibility: hidden; transform: translateY(100%); transition: transform var(--t) var(--ease), visibility 0s linear var(--t); }
.term[data-form="phone"][data-sheet="open"] .ticketp { visibility: visible; transform: none; transition: transform var(--t) var(--ease), visibility 0s; }
.term[data-form="phone"] .tk-body { gap: 8px; }
.term[data-form="phone"] .tk-close { display: inline-flex; }
.term[data-form="phone"] .tk-go { min-height: 50px; font-size: 14.5px; }

/* Sell and Buy under the chart, then the five tabs. */
.term[data-form="phone"][data-tab="chart"] .pkeys,
.term[data-form="phone"][data-tab="book"] .pkeys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--hair); background: var(--surface); }
.pkeys .key { min-height: 46px; font-size: 14px; }
.pkeys .key-buy { order: -1; }
.term[data-form="phone"] .ptabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--hair); background: var(--surface); }
.ptab { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; padding: 6px 2px; border: 0; background: none; color: var(--mute); font-size: 10.5px; font-weight: 600; cursor: pointer; }
.ptab[aria-pressed="true"] { color: var(--text); }
.ptab[aria-pressed="true"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--acc); }

/* Notes (toasts) on a phone: one line in the account strip's place for its time, the last one only (the activity tab
   keeps all): over no candle, no label of the chart, no row, no key. A longer sentence goes down over the panel's top. */
.term[data-form="phone"] > .toasts { grid-area: strip; inset: 0 0 auto; gap: 0; justify-items: stretch; min-height: 100%; }
.term[data-form="phone"] .toast { max-width: none; align-items: center; padding: 6px 12px; border-radius: 0; box-shadow: inset 0 1px 0 var(--hair-2), inset 0 -1px 0 var(--hair-2);
  line-height: 1.35; animation-name: toast-fade; }
.term[data-form="phone"] .toast:not(:last-child) { display: none; }
.term[data-form="phone"] .toast .i { margin-top: 0; }
.term[data-form="phone"] .toast[data-out="1"] { transform: none; }
.term[data-form="phone"] .toast[data-kind="bad"] { box-shadow: inset 0 1px 0 var(--down), inset 0 -1px 0 var(--down); }
.term[data-form="phone"] .toast[data-kind="bad"] .i { color: var(--down); }
/* a visitor has no strip: the note is one line at the chart's foot, over its time axis, under the chart's focus key */
body[data-visitor="true"] .term[data-form="phone"] > .toasts { grid-area: main; inset: auto 0 0; min-height: 0; }
body[data-visitor="true"] .term[data-form="phone"] .toast { padding: 5px 12px; font-size: 12px; }

@media (hover: hover) {
  .ptab:hover { color: var(--text); }
  .strip:hover .st-goal { color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
  .term[data-form="phone"] .ticketp { transition: none; }
}

/* ---- the bottom panel on a phone: a position is a card (its figures named on their cells), every key 44 px and
   inside the window; the quick key of the tab on screen under the tabs; the toasts above the bottom bands ---- */
.term[data-form="phone"] #botTabs { flex-wrap: wrap; justify-content: space-between; overflow: visible; padding: 0 4px; }
/* the five tabs on one line down to 360 px in every language (Spanish is the longest): the letters at the font's
   normal width (100 %, not the screen's 108 %), same size, and a tighter padding */
.term[data-form="phone"] #botTabs .tab { padding: 0 5px; font-stretch: 100%; }
.term[data-form="phone"] .ptabs-in .tab { min-height: 44px; padding: 0 8px; }
.term[data-form="phone"] .tab-toasts { display: none; }
.term[data-form="phone"] .tab-acts { flex: 1 0 100%; justify-content: flex-end; margin: 0; padding: 0 6px 8px; }
.term[data-form="phone"] .botp:not([data-bt="positions"]) .tab-acts .key:last-child,
.term[data-form="phone"] .botp:not([data-bt="orders"]) .tab-acts .key:first-child { display: none; }
.term[data-form="phone"] .botp:not([data-bt="positions"]):not([data-bt="orders"]) .tab-acts { display: none; }
.term[data-form="phone"] .bot-body { padding-bottom: 64px; }
.term[data-form="phone"] #posBody { display: block; }
.term[data-form="phone"] .tbl:has(#posBody) thead { display: none; }
.term[data-form="phone"] #posBody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "sym side size pnl" "entry entry px px" "sl sl tp tp" "acts acts acts acts";
  gap: 6px 10px; padding: 12px; border-top: 1px solid var(--hair); }
.term[data-form="phone"] #posBody td { display: block; height: auto; padding: 0; border: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term[data-form="phone"] #posBody td:nth-child(1) { grid-area: sym; padding: 0; align-self: center; font-size: 14px; }
.term[data-form="phone"] #posBody td:nth-child(2) { grid-area: side; align-self: center; }
.term[data-form="phone"] #posBody td:nth-child(3) { grid-area: size; align-self: center; }
.term[data-form="phone"] #posBody td:nth-child(4) { grid-area: entry; }
.term[data-form="phone"] #posBody td:nth-child(5) { grid-area: px; }
.term[data-form="phone"] #posBody td:nth-child(6) { grid-area: sl; }
.term[data-form="phone"] #posBody td:nth-child(7) { grid-area: tp; }
.term[data-form="phone"] #posBody td:nth-child(8) { grid-area: pnl; align-self: center; text-align: right; font-size: 13px; }
.term[data-form="phone"] #posBody td.acts { grid-area: acts; overflow: visible; }
.term[data-form="phone"] #posBody td:nth-child(n+4):nth-child(-n+7)::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--dim); font-family: var(--font-ui); font-size: 11px; }
.term[data-form="phone"] #posBody .acts > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.term[data-form="phone"] #posBody .acts .key { width: 100%; min-width: 0; }
.term[data-form="phone"] #posBody .part.w { display: inline-flex; }
.term[data-form="phone"] #posBody .mini { width: 100%; }
.term[data-form="phone"] #posBody .mini input { height: 42px; font-size: 16px; text-align: left; }
/* a working order as a card, like a position: its market, its type and its Cancel key, then its size and its price (a
   stop-limit's two prices one under the other), then the SL / TP it carries, a row that leaves when it carries none */
.term[data-form="phone"] .tbl:has(#ordBody) thead { display: none; }
.term[data-form="phone"] #ordBody { display: block; }
.term[data-form="phone"] #ordBody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "sym type type acts" "size size px px" "sl sl tp tp";
  gap: 6px 10px; padding: 12px; border-top: 1px solid var(--hair); }
.term[data-form="phone"] #ordBody tr[data-legs="0"] { grid-template-areas: "sym type type acts" "size size px px"; }
.term[data-form="phone"] #ordBody td { display: block; height: auto; padding: 0; border: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term[data-form="phone"] #ordBody td:nth-child(1) { grid-area: sym; align-self: center; font-size: 14px; }
.term[data-form="phone"] #ordBody td:nth-child(2) { grid-area: type; align-self: center; }
.term[data-form="phone"] #ordBody td:nth-child(3) { grid-area: size; }
.term[data-form="phone"] #ordBody td:nth-child(4) { grid-area: px; white-space: normal; }
.term[data-form="phone"] #ordBody td:nth-child(5) { grid-area: sl; white-space: normal; }
.term[data-form="phone"] #ordBody td:nth-child(6) { grid-area: tp; }
.term[data-form="phone"] #ordBody td:nth-child(7), .term[data-form="phone"] #ordBody tr[data-legs="0"] td[data-o-leg] { display: none; }
.term[data-form="phone"] #ordBody td.acts { grid-area: acts; justify-self: end; overflow: visible; }
.term[data-form="phone"] #ordBody td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--dim); font-family: var(--font-ui); font-size: 11px; }
.term[data-form="phone"] #ordBody .acts .key { min-width: 64px; }
.term[data-form="phone"] #ordBody .px-lim { display: block; }
.term[data-form="phone"] #ordBody td[data-o-leg] .tag-demo { display: table; margin: 3px 0 0; }

/* ---- the ticket's sheet whole, its most loaded form included (a stop-limit, SL, TP, the trailing stop), down to
   375 x 667: it may rise to the top of the screen and its gaps give a little; the trailing stop's distance stands
   beside "Reduce only" (the two never speak together: reduce-only switches the trailing stop off); under 760 px of
   height the sentence under a stop-limit's two prices leaves (the order key says the same, both prices in it); under
   700 px the detail of the check leaves too (its sentence stays: what the order does to the account) ---- */
.term[data-form="phone"] .ticketp { max-height: 100%; gap: 6px; padding-top: 10px; }
.term[data-form="phone"] .tk-body { gap: 6px; }
.term[data-form="phone"] .tk-group { gap: 4px; }
.term[data-form="phone"] .tk-two .tk-row { min-height: 0; }
/* the trailing switch beside the stop loss's label: both labels as tall as it, so the two fields stay level */
.term[data-form="phone"] .tk-two[data-trail] .tk-row { min-height: 44px; }
.term[data-form="phone"] #posBody td.leg[data-trail] { white-space: normal; }
.term[data-form="phone"] #posBody td.leg[data-trail] .mini { display: flex; }
.term[data-form="phone"] #posBody td.leg[data-trail] .tag-demo { display: inline-block; margin: 6px 0 0; min-height: 44px; }
.term[data-form="phone"] .tk-hint:empty { display: none; }
.term[data-form="phone"] .tk-legs { grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; }
.term[data-form="phone"] .tk-legs > * { grid-column: 1 / -1; }
.term[data-form="phone"] .tk-legs > #tkTrailHint:not([hidden]) { grid-column: 1; align-self: center; min-height: 0; line-height: 1.35; }
.term[data-form="phone"] .tk-legs > #tkTrailHint:not([hidden]) + .tk-row { grid-column: 2; }
.term[data-form="phone"] .tk-check { gap: 4px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; }
@media (max-height: 760px) {
  .term[data-form="phone"] .tk-body { gap: 4px; }
  .term[data-form="phone"] .tk-group { gap: 3px; }
  .term[data-form="phone"] .tk-group:not(.tk-legs) > .tk-two:not([data-one]) + .tk-hint { display: none; }
}
@media (max-height: 700px) {
  .term[data-form="phone"] .tk-what { display: none !important; }
  .term[data-form="phone"] .tk-check { padding: 6px 10px; }
  .term[data-form="phone"] .tk-go { min-height: 46px; }
}
/* A wide window in the phone form (a tablet upright, a narrow window on a computer): the sheet keeps a phone's width. */
@media (min-width: 760px) {
  .term[data-form="phone"] .ticketp { width: min(100%, 520px); margin-inline: auto; }
}
.term[data-form="phone"] > .toasts .toast:nth-last-child(n+3) { display: none; }   /* two at most over the panel (the activity tab keeps all) */
