/*
 * Exit Strategies card (includes/class-sd-chart-exit.php, assets/js/sd-exit.js).
 * Its own file so a parallel edit of sd.css cannot collide with it. Colours are sd.css tokens only.
 * Grid card = the compact picture; the expanded card = the instrument (controls + both tables).
 */

#sttw-sd .sttw-sd__exit .sttw-sd__exit-full,
#sttw-sd .sttw-sd__exit .sttw-sd__exit-head { display: none; }
#sttw-sd .sttw-sd__card.is-expanded .sttw-sd__exit .sttw-sd__exit-compact { display: none; }
#sttw-sd .sttw-sd__card.is-expanded .sttw-sd__exit .sttw-sd__exit-head { display: flex; }
#sttw-sd .sttw-sd__card.is-expanded .sttw-sd__exit .sttw-sd__exit-full {
	display: grid;
	grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}
@media (max-width: 1100px) {
	#sttw-sd .sttw-sd__card.is-expanded .sttw-sd__exit .sttw-sd__exit-full { grid-template-columns: minmax(0, 1fr); }
}

/* Controls */
#sttw-sd .sttw-sd__exit-bar { align-items: flex-end; gap: 10px 18px; margin-bottom: 12px; }
#sttw-sd .sttw-sd__exit-field { display: inline-flex; flex-direction: column; gap: 4px; margin: 0; font-size: 11px; color: var(--sd-muted) !important; }
#sttw-sd .sttw-sd__exit-field input {
	width: 150px;
	box-sizing: border-box;
	padding: 5px 8px;
	border: 1px solid var(--sd-line);
	border-radius: 5px;
	background: transparent;
	color: var(--sd-text) !important;
	font: inherit;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}
#sttw-sd .sttw-sd__exit-field input:focus { outline: none; border-color: var(--sd-gold); }
#sttw-sd .sttw-sd__exit-field input[readonly] { color: var(--sd-muted) !important; border-style: dashed; }
#sttw-sd .sttw-sd__exit-bar .sttw-sd__exit-seg { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-left: 0; }
#sttw-sd .sttw-sd__exit-formula { font-size: 11px; color: var(--sd-muted) !important; }

/* Tables */
#sttw-sd .sttw-sd__exit-scroll { overflow-x: auto; min-width: 0; }
#sttw-sd .sttw-sd__exit table th[scope="row"] {
	padding: 8px;
	border-bottom: 1px solid var(--sd-edge);
	color: var(--sd-text) !important;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
	text-align: left;
	white-space: nowrap;
}
#sttw-sd .sttw-sd__exit tbody tr:last-child th[scope="row"] { border-bottom: 0; }
#sttw-sd .sttw-sd__exit table td { padding: 8px; }
#sttw-sd .sttw-sd__exit th.is-group { text-align: center; border-bottom: 0; padding-bottom: 0; }
#sttw-sd .sttw-sd__exit td.is-sold { color: var(--sd-up) !important; }
#sttw-sd .sttw-sd__exit td.is-zero { color: var(--sd-dim) !important; }
#sttw-sd .sttw-sd__exit td.is-total { font-weight: 700; }
#sttw-sd .sttw-sd__exit td.is-oor { color: var(--sd-muted) !important; font-size: 11px; font-style: italic; }
#sttw-sd .sttw-sd__exit td.is-proj { color: var(--sd-gold) !important; }
#sttw-sd .sttw-sd__exit-unpriced { display: block; font-size: 11px; font-weight: 400; color: var(--sd-muted) !important; }
#sttw-sd .sttw-sd__exit-key { margin: 6px 8px 0; font-size: 11px; color: var(--sd-gold) !important; }
#sttw-sd .sttw-sd__exit-line { margin: 0 0 6px; font-size: 12px; color: var(--sd-muted) !important; }
#sttw-sd .sttw-sd__exit-msg { margin: 8px 0; font-size: 14px; color: var(--sd-soft) !important; }
#sttw-sd .sttw-sd__exit-compact th[scope="row"] { white-space: normal; }

/* 0.46.3 (Boss: "not all selectors on the same level"): every control is one 34px box under one label line - the
   inputs match the pilot's dropdown boxes, and the strategy's formula hangs under its segments outside the flow, so
   it no longer lifts the Strategy group above the others. */
#sttw-sd .sttw-sd__exit-bar { align-items: flex-start; gap: 22px 18px; padding-bottom: 16px; }
#sttw-sd .sttw-sd__exit-bar > .sttw-sd__exit-seg, #sttw-sd .sttw-sd__exit-bar > .sttw-sd__exit-field { position: relative; gap: 6px !important; margin: 0 !important; }
#sttw-sd .sttw-sd__exit-bar .sttw-sd__ma-label { display: block; height: 16px; margin: 0; font-size: 12.5px; line-height: 16px; }
/* The asset dropdown carries its label inside the box: drop it to the boxes' line (label 16 + gap 6). */
#sttw-sd .sttw-sd__exit-bar > .sttw-sd__dd { margin-top: 22px; }
#sttw-sd .sttw-sd__exit-field input { height: 34px; padding: 0 12px; border-radius: 10px; background: var(--sd-panel); font-size: 13.5px; }
#sttw-sd .sttw-sd__exit-field input:focus { border-color: var(--sd-accent-edge); }
#sttw-sd .sttw-sd__exit-bar .sttw-sd__ma-seg { box-sizing: border-box; height: 34px; align-items: center; }
#sttw-sd .sttw-sd__exit-bar .sttw-sd__ma-seg button { padding-top: 0; padding-bottom: 0; height: 26px; }
#sttw-sd .sttw-sd__exit-formula { position: absolute; top: 100%; left: 2px; margin-top: 3px; white-space: nowrap; }
#sttw-sd .sttw-sd__exit td.is-proj { color: var(--sd-accent) !important; }
#sttw-sd .sttw-sd__exit-key { color: var(--sd-accent) !important; }
