/* Lot S1: the stop loss and take profit in a unit of the trader's (the unit's key in each box and its list, the leg in the
   other units under it, R:R in the summary), the legs made by a drag of the entry on the chart, « Stop à l'entrée ».
   No row added to the ticket when nothing is typed; no blue key added (the order's key stays the one). */

/* ---------- the unit's key, inside the field's box ---------- */
.field:has(> .tk-unit) { gap: 4px; padding-inline-end: 4px; }
.ticketp .field:has(> .tk-unit) input { min-width: 40px; }   /* a narrow ticket keeps the unit's word whole (phone.css: 56) */
.tk-unit { flex: none; display: inline-flex; align-items: center; gap: 2px; min-height: 22px; padding: 0 3px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--dim); font-family: inherit; cursor: pointer; }
.tk-unit::after { content: ""; border: 3.5px solid transparent; border-top: 4px solid currentColor; border-bottom: 0; }
.tk-unit[data-u]:not([data-u="px"]) { color: var(--text); background: var(--surface-3); }
.tk-unit[aria-expanded="true"] { color: var(--text); background: var(--surface-4); }
.tk-unit:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (hover: hover) { .tk-unit:hover { color: var(--text); background: var(--surface-4); } }
.field[data-def="1"] .tk-unit::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.field[data-off="1"] .tk-unit { pointer-events: none; opacity: 0.45; }

/* ---------- the leg in the other units, under its box: only when one of the two legs has some ---------- */
.tk-lh { margin: 0; min-width: 0; color: var(--dim); font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-lh[data-tone="down"] { color: var(--down); }
.tk-two:not([data-hint]) > div > .tk-lh { display: none; }
.term[data-form="desk"] .tk-legs .tk-two > div { row-gap: 2px; }

/* ---------- the list of a leg's units (PP.cpop) ---------- */
.cpop[data-kind="legu"] { z-index: 50; width: min(250px, calc(100% - 16px)); padding: 6px; gap: 2px; }
.lgm-h { margin: 2px 6px 4px; color: var(--dim); font-size: 11px; font-weight: 600; }
.lgm-i { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--mute); font: inherit; font-size: 12px; text-align: start; cursor: pointer; }
.lgm-f { color: var(--dim); font-weight: 700; }
.lgm-i[aria-checked="true"] { background: var(--surface-4); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-3); }
.lgm-i[aria-checked="true"] .lgm-f { color: var(--text); }
.lgm-i:disabled { cursor: default; opacity: 0.45; }
.lgm-i:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (hover: hover) { .lgm-i:not(:disabled):hover { background: var(--surface-3); color: var(--text); } }
.lgm-q { display: flex; gap: 4px; padding: 2px 8px 4px 48px; }
.lgm-q > .lgm-i { display: inline-flex; justify-content: center; width: auto; min-width: 44px; min-height: 26px; padding: 0 8px; box-shadow: inset 0 0 0 1px var(--hair-2); }
.lgm-i.lgm-def { display: block; margin-top: 4px; padding: 6px 8px; border-top: 1px solid var(--hair); border-radius: 0 0 var(--r-sm) var(--r-sm); white-space: normal; line-height: 1.35; }
.term[data-form="phone"] .lgm-i { min-height: 44px; }
.term[data-form="phone"] .lgm-q > .lgm-i { min-height: 44px; }

/* ---------- the summary: R:R in the size's place when both legs are there ---------- */
.tk-sum > [data-k="rr"] { display: none; }
.tk-sum[data-rr="1"] > [data-k="rr"] { display: flex; }
.tk-sum[data-rr="1"] > [data-k="qty"] { display: none; }
.tk-sum[data-rr="1"] > [data-k="loss"] { border-inline-start: 0; }

/* ---------- the chart: the grip that makes TP / SL, the active entry, R on a dragged leg ---------- */
.ln-tag > .ln-mk { color: var(--mute); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; cursor: ns-resize; }
.ln[data-make="1"]:not([data-drag]) .ln-tag { cursor: ns-resize; }
.ln[data-active="1"] .ln-tag { box-shadow: inset 0 0 0 2px currentColor, 0 6px 14px -8px rgba(0, 0, 0, 0.6); }
.ln-tag > .ln-be { color: var(--text); font-weight: 600; }
.ln:not([data-active="1"]) .ln-tag > .ln-be { display: none; }
.ln-tag > .ln-be:disabled { color: var(--dim); cursor: default; }
.ln-tag .ln-r[hidden] { display: none; }
.ln-tag > .ln-r { color: var(--text); background: var(--surface-4); }
@media (hover: hover) { .ln-tag > .ln-mk:hover { color: var(--text); background: var(--surface-4); } }
.term[data-form="phone"] .ln-tag > .ln-mk { position: relative; min-width: 44px; justify-content: center; }
.term[data-form="phone"] .ln-tag > .ln-mk::before { content: ""; position: absolute; inset: -6px 0; }
@media (pointer: coarse) {
  .term[data-form="desk"] .ln-tag > .ln-mk { position: relative; min-width: 44px; justify-content: center; }
}

/* ---------- « À l'entrée » on the position's row and on the focus's position line ---------- */
.tbl td.leg[data-be] { white-space: nowrap; }
.tbl td.leg[data-be] > .mini { display: inline-flex; vertical-align: middle; }
.tbl td.leg .be-k { margin-inline-start: 6px; vertical-align: middle; font-size: 11px; }
.be-k:disabled { cursor: default; opacity: 0.5; }
.fp-keys .fp-be { flex: 1.6 1 0; }
.fp-keys .fp-be:disabled { opacity: 0.5; }
.term[data-form="phone"] #posBody td.leg[data-be] { white-space: normal; }
.term[data-form="phone"] #posBody td.leg[data-be] .mini { display: flex; }
.term[data-form="phone"] #posBody td.leg .be-k { display: inline-block; margin: 6px 0 0; min-height: 44px; min-width: 44px; }
@media (pointer: coarse) { .term[data-form="desk"] .tbl td.leg .be-k { min-height: 44px; } }
.term[data-form="phone"] .tk-unit { min-height: 44px; min-width: 44px; justify-content: center; margin-block: -4px; }
@media (pointer: coarse) { .term[data-form="desk"] .tk-unit { min-height: 44px; min-width: 44px; justify-content: center; } }
