/* ---- lot SRV2: several take profits (tk-tgts.js, tgt-edit.js, the chart's target lines) and the reversal of a position
   (rev.js). No blue key added (the order's key stays the one); no green nor violet: green and red stay Buy / Sell and P&L. */

/* ---------- the ticket: no row added. The TP's label becomes TP1 · TP2 · TP3; the selected one's share is a key at the
   head of the line under the TP's box (in the box on a phone) ---------- */
.tk-tgseg { display: inline-flex; gap: 2px; min-width: 0; padding: 0; }
.tk-tgseg[hidden] { display: none; }
.tk-tgseg > .tg-n { min-height: 18px; padding: 0 5px; border: 0; border-radius: var(--r-sm); background: none; color: var(--dim);
  font: inherit; font-size: 11px; font-weight: 700; line-height: 18px; cursor: pointer; }
.tk-tgseg > .tg-n[aria-pressed="true"] { color: var(--text); background: var(--surface-4); box-shadow: inset 0 0 0 1px var(--hair-3); }
.tk-tgseg[data-bad="1"] > .tg-n:nth-child(1), .tk-tgseg[data-bad="2"] > .tg-n:nth-child(2), .tk-tgseg[data-bad="3"] > .tg-n:nth-child(3) { color: var(--down); }
.tk-tgseg > .tg-n:focus-visible, .tg-sk:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tg-hrow { display: contents; }
.tg-hrow[data-on] { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tg-hrow > .tk-lh { flex: 1 1 auto; }
.tk-two:not([data-hint]) .tg-hrow > .tk-lh { display: none; }
.tg-sk { flex: none; display: inline-flex; align-items: center; gap: 3px; min-height: 0; padding: 0 4px; border: 0; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text); font: inherit; font-size: 11px; font-weight: 600; line-height: 14px; cursor: pointer; white-space: nowrap; }
.tg-sk[hidden] { display: none; }
.tg-sk:not([data-last])::after { content: ""; border: 3px solid transparent; border-top: 3.5px solid currentColor; border-bottom: 0; }
.tg-sk[data-last] { padding: 0; background: none; color: var(--mute); cursor: default; }
@media (hover: hover) { .tk-tgseg > .tg-n:hover, .tg-sk:not([data-last]):hover { color: var(--text); background: var(--surface-4); } }
.term[data-form="phone"] .tk-tgseg > .tg-n { min-height: 44px; min-width: 44px; line-height: 44px; margin-block: -13px; }
.term[data-form="phone"] .tg-sk { min-height: 44px; min-width: 44px; justify-content: center; margin-block: -4px; padding: 0 4px; font-size: 13px; }
.term[data-form="phone"] .tg-sk[data-last] { color: var(--dim); }
@media (pointer: coarse) {
  .term[data-form="desk"] .tk-tgseg > .tg-n { min-height: 44px; min-width: 44px; margin-block: -13px; }
  .term[data-form="desk"] .tg-sk { min-height: 44px; min-width: 44px; justify-content: center; margin-block: -15px; }
}

/* the TP's list: 1, 2 or 3 targets, under its default */
.lgm-tg { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hair); }
.lgm-tg > .lgm-q { padding-inline-start: 8px; }

/* ---------- a position's take profits: « 3 TP », « + » in the one TP's box (« + TP » in the focus) and their editor ---------- */
.tbl td.leg[data-tga] > .mini { display: inline-flex; align-items: center; vertical-align: middle; gap: 2px; padding-inline-end: 3px; }
.tbl td.leg[data-tga] > .mini input { min-width: 0; flex: 1 1 auto; }
.tbl .mini > .tg-in { flex: none; margin: 0; padding: 0 5px; min-height: 18px; font-size: 12px; line-height: 18px; }
.tbl td.leg[data-tgts] .tg-k { margin-inline-start: 0; min-width: 8ch; color: var(--text); font-size: 12px; }
.fp-line .fp-tg { margin-inline-start: auto; flex: none; min-height: 0; padding: 0 4px; font-size: 11px; line-height: 16px; }   /* the line keeps its 16 px */
.fp-line .fp-tg + .fp-pnl { margin-inline-start: 4px; }
.fp-line:has(> .fp-tg:not([hidden])) { gap: 4px; }                            /* the entry stays whole in a 272 px column */
.fp-line:has(> .fp-tg:not([hidden])) .fp-entry .fp-l { display: none; }   /* a narrow column: « 3 TP » in the word's place */
.cpop[data-kind="tged"] { z-index: 50; width: min(300px, calc(100% - 16px)); padding: 8px; gap: 6px; }
.tge-seg { padding: 0; flex-wrap: wrap; }
.tge-seg > .lgm-i { flex: 1 1 0; min-width: 40px; }
.tge-rows { display: grid; gap: 4px; }
.tge-r { display: grid; grid-template-columns: 32px minmax(0, 1fr) 76px; align-items: center; gap: 6px; }
.tge-n { color: var(--mute); font-size: 12px; font-weight: 700; }
.tge-r .field { min-height: 28px; }
.tge-r .field input { min-width: 0; width: 100%; }
.tge-rest { color: var(--dim); font-size: 11.5px; text-align: end; }
.tge-msg { margin: 0; min-height: 15px; color: var(--dim); font-size: 11.5px; line-height: 1.3; }
.tge-msg[data-tone="down"] { color: var(--down); }
.tge-k { display: flex; justify-content: flex-end; gap: 6px; }
.tge-k .key[data-armed="1"] { color: var(--down); box-shadow: inset 0 0 0 1px var(--down), 0 1px 0 var(--key-edge); }
.term[data-form="phone"] .tge-r .field, .term[data-form="phone"] .tge-k .key, .term[data-form="phone"] .tge-seg > .lgm-i { min-height: 44px; }
.term[data-form="phone"] #posBody td.leg[data-tgts] .tg-k { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.term[data-form="phone"] #posBody td.leg[data-tga] .mini { display: flex; }
.term[data-form="phone"] .tbl .mini > .tg-in { min-height: 44px; min-width: 44px; margin-block: -8px; }
@media (pointer: coarse) { .term[data-form="desk"] .tbl td.leg .tg-k, .term[data-form="desk"] .fp-tg { min-height: 44px; min-width: 44px; } .term[data-form="desk"] .fp-tg { margin-block: -14px; } }

/* ---------- the chart: a target's share on its tag ---------- */
.ln-tag > .ln-sh { color: var(--mute); font-size: 11px; }

/* ---------- reverse: the key, armed (its second press sends), and what it does beside it ---------- */
.rv-k { gap: 5px; }
.rv-k > .i { flex: none; width: 14px; height: 14px; }
.rv-k[data-armed="1"] { color: var(--text); box-shadow: inset 0 0 0 1px var(--warn), 0 1px 0 var(--key-edge); }
/* the mark alone where the row or the column is short of room: the word stays in its title and its name */
@media (max-width: 1599px) { .term[data-form="desk"] #posBody .rv-k > .rv-w { display: none; } }
.fp-keys .rv-k > .rv-w { display: none; }
.fp-keys .rv-k { flex: none; padding: 0 7px; }
.rv-k:disabled { opacity: 0.5; cursor: default; }
.cpop[data-kind="rev"] { z-index: 50; width: min(340px, calc(100% - 16px)); padding: 8px 10px; gap: 4px; }
.rv-l { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.rv-l > li { position: relative; padding-inline-start: 10px; color: var(--text); font-size: 12px; line-height: 1.35; }
.rv-l > li::before { content: ""; position: absolute; inset-inline-start: 0; top: 0.55em; width: 4px; height: 4px; border-radius: 50%; background: var(--dim); }
.rv-l > li[data-tone="warn"] { color: var(--warn); }
.rv-again { margin: 2px 0 0; color: var(--dim); font-size: 11px; }
.term[data-form="phone"] #posBody .acts .rv-k { grid-column: 1 / -1; order: 1; min-height: 44px; }
@media (pointer: coarse) { .term[data-form="desk"] .rv-k { min-height: 44px; } }
