/* console: compact automation editors inside the rail panel .cx-ap (Nov 5)
   The panel (.cx-ap: header, nav, scrolling body .cx-apb) swaps in for the right rail, ~330–380px wide. Its body is the
   very editor markup the How / Review pages use (ttForm, recipeInner, liveMini), built for a wide drawer. Here it is
   re-cut for the rail: 12px body, 11px labels, 13px values, 30px controls, 8px gaps, frosted surfaces with soft
   hairlines, mode cards as one row of three small chips, 2×2 stats, smart-sell rungs as small frosted cards.
   CSS only. Selectors are doubled on [data-look] so they outrank look 9's (select.css, l9.css, inner.css) without
   touching them; light theme overrides sit at the end. */

html:root[data-look][data-look] .cx-ap {
  --ap-fill: rgba(255,255,255,.03);
  --ap-fill2: rgba(255,255,255,.055);
  --ap-hair: rgba(255,255,255,.055);
  --ap-edge: inset 0 0 0 1px rgba(255,255,255,.05);
  --ap-well: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01)), rgba(10,13,18,.22);
  --ap-well-sh: inset 0 0 0 1px rgba(201,220,242,.07);
  --ap-on: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.015) 60%), rgba(201,220,242,.07);
  --ap-on-sh: inset 0 0 0 1px rgba(201,220,242,.22), inset 0 1px 0 rgba(240,247,255,.14);
  font-size: 12px; line-height: 1.4; }
html:root[data-look][data-look] .cx-ap .cx-apb * { min-width: 0; }

/* ---------- sections: title line, then one frosted box ---------- */
html:root[data-look][data-look] .cx-ap .cx-ads { gap: 6px; margin-bottom: 10px; }
html:root[data-look][data-look] .cx-ap .cx-ads:last-child { margin-bottom: 0; }
html:root[data-look][data-look] .cx-ap .cx-ads > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 0 2px; }
html:root[data-look][data-look] .cx-ap .cx-ads > header b { font: 600 12px var(--f); color: var(--tx2); letter-spacing: .01em; }
html:root[data-look][data-look] .cx-ap .cx-ads > header small { font-size: 11px; color: var(--tx3); line-height: 1.35; }
html:root[data-look][data-look] .cx-ap .cx-ads > :is(.trade, .tt-form, .lr-body) { padding: 10px; border-radius: 10px; background: var(--ap-fill); box-shadow: var(--ap-edge); }
html:root[data-look][data-look] .cx-ap .cx-adn { font-size: 11.5px; color: var(--tx3); line-height: 1.45; }
/* drawer-style head, if a panel body still carries one */
html:root[data-look][data-look] .cx-ap .cx-adh { flex-wrap: wrap; gap: 8px; padding: 8px 10px; margin-bottom: 10px; border-radius: 10px; background: var(--ap-fill); box-shadow: var(--ap-edge); }
html:root[data-look][data-look] .cx-ap .cx-adr { gap: 8px; } html:root[data-look][data-look] .cx-ap .cx-adr b { font-size: 13px; }
html:root[data-look][data-look] .cx-ap .cx-adh .cx-asum { font-size: 11px; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .cx-apst .btn { justify-self: start; }

/* ---------- type, labels, long text ---------- */
html:root[data-look][data-look] .cx-ap .fl { font: 500 11px/1.3 var(--f) !important; color: var(--tx3) !important; letter-spacing: 0; text-transform: none; }
html:root[data-look][data-look] .cx-ap .tt-form .fl { margin: 0 0 -2px; }
html:root[data-look][data-look] .cx-ap .field { display: grid; gap: 4px; min-width: 0; }
html:root[data-look][data-look] .cx-ap .fh { font-size: 10.5px; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap :is(.hint, .lr-say, .lr-ss-hint, p.muted) { margin: 0; font-size: 11.5px !important; line-height: 1.45; color: var(--tx3) !important; }
html:root[data-look][data-look] .cx-ap .hint .i { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
html:root[data-look][data-look] .cx-ap .muted { color: var(--tx3); }

/* ---------- the form: one column, 8–10px rhythm ---------- */
html:root[data-look][data-look] .cx-ap .tt-form { gap: 8px; margin-top: 0; padding-top: 10px; border-top: 0; }
html:root[data-look][data-look] .cx-ap .lr-body { display: grid; gap: 8px; }
html:root[data-look][data-look] .cx-ap .mini-eng { gap: 8px; }
html:root[data-look][data-look] .cx-ap :is(.tt-amt, .tt-time) { gap: 8px; padding-top: 10px; border-top: 1px solid var(--ap-hair); }
html:root[data-look][data-look] .cx-ap .tt-time { display: grid; }
html:root[data-look][data-look] .cx-ap .tt-time-h { flex-wrap: wrap; align-items: center; gap: 6px 8px; }
html:root[data-look][data-look] .cx-ap .tt-time-h > span:first-child { flex: 1 1 150px; gap: 1px; line-height: 1.35; }
html:root[data-look][data-look] .cx-ap .tt-time-h b { font: 600 12px var(--f); color: var(--tx); }
html:root[data-look][data-look] .cx-ap .tt-time-h small { font-size: 11px; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .tt-opts { gap: 6px 12px; }
html:root[data-look][data-look] .cx-ap .tt-opt { gap: 6px; } html:root[data-look][data-look] .cx-ap .tt-opt > small { font-size: 11px; color: var(--tx3); }

/* switches: the console's own size (30×18, 14px knob) */
html:root[data-look][data-look] .cx-ap .te-sw { gap: 8px; font-size: 12px; line-height: 1.35; color: var(--tx2); }
html:root[data-look][data-look] .cx-ap .tt-form .tt-auto { padding: 0; }
html:root[data-look][data-look] .cx-ap .te-sw > span:not(.lr-was) { flex: none; width: 30px; height: 18px; border-radius: 999px; }
html:root[data-look][data-look] .cx-ap .te-sw > span:not(.lr-was)::after { top: 2px; left: 2px; width: 14px; height: 14px; }
html:root[data-look][data-look] .cx-ap .te-sw input:checked + span::after { left: 14px; }
html:root[data-look][data-look] .cx-ap .cx-sw.lg { width: 30px; height: 18px; } html:root[data-look][data-look] .cx-ap .cx-sw.lg i { width: 14px; height: 14px; } html:root[data-look][data-look] .cx-ap .cx-sw.lg[aria-checked="true"] i { transform: translateX(12px); }

/* ---------- inputs: 30px, frosted well ---------- */
html:root[data-look][data-look] .cx-ap .inp { min-height: 30px !important; height: 30px; padding: 0 9px !important; gap: 4px; border-radius: 8px !important; font-size: 13px;
  background: var(--ap-well) !important; box-shadow: var(--ap-well-sh) !important; border: 0 !important; }
html:root[data-look][data-look] .cx-ap .inp input, html:root[data-look][data-look] .cx-ap .inp select { min-width: 0; width: 100%; height: 100%; padding: 0; font: 500 13px var(--f) !important; font-variant-numeric: tabular-nums; color: var(--tx); }
html:root[data-look][data-look] .cx-ap .inp.sel select { font-size: 12px !important; }
html:root[data-look][data-look] .cx-ap .inp em { flex: none; font-size: 11px !important; font-style: normal; color: var(--tx3); white-space: nowrap; }
html:root[data-look][data-look] .cx-ap .inp em.hl-suf { display: inline-flex; align-items: center; gap: 3px; }
html:root[data-look][data-look] .cx-ap .inp .chain-mark { width: 12px; height: 12px; }
html:root[data-look][data-look] .cx-ap .inp:focus-within { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 40%, transparent) !important; }
html:root[data-look][data-look] .cx-ap :is(.g2, .g3, .g4) { display: grid; gap: 8px; }
html:root[data-look][data-look] .cx-ap :is(.g2, .g4) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
html:root[data-look][data-look] .cx-ap .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
html:root[data-look][data-look] .cx-ap .lr-body .g3 { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)) !important; }

/* min / max amount: label · value · coin, 30px */
html:root[data-look][data-look] .cx-ap .tt-mm { gap: 8px; }
html:root[data-look][data-look] .cx-ap .mm-b { height: 30px; border-radius: 8px !important; background: var(--ap-well) !important; box-shadow: var(--ap-well-sh) !important; border: 0 !important; }
html:root[data-look][data-look] .cx-ap .mm-b > span { min-width: 0; padding: 0 8px; background: rgba(255,255,255,.035); border-right: 1px solid var(--ap-hair); color: var(--tx3); font: 500 11px var(--f); }
html:root[data-look][data-look] .cx-ap .mm-b input { padding: 0 6px; font: 500 13px var(--f); font-variant-numeric: tabular-nums; }
html:root[data-look][data-look] .cx-ap .mm-b em { padding: 0 8px 0 2px; }
html:root[data-look][data-look] .cx-ap .mm-b .chain-mark { width: 13px; height: 13px; }
html:root[data-look][data-look] .cx-ap .mm-b:focus-within { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 40%, transparent) !important; }

/* time fields (delay min:sec, duration h:m:s): one 30px row, the unit after the number */
html:root[data-look][data-look] .cx-ap .tt-dl { gap: 8px; }
html:root[data-look][data-look] .cx-ap .tt-dl > div { gap: 4px; }
html:root[data-look][data-look] .cx-ap .tt-dl .fl { font-weight: 500 !important; }
html:root[data-look][data-look] .cx-ap .hms { height: 30px; padding: 0 4px; gap: 0; border-radius: 8px !important; background: var(--ap-well) !important; box-shadow: var(--ap-well-sh) !important; border: 0 !important; }
html:root[data-look][data-look] .cx-ap .hms > i { padding: 0 1px; font: 600 12px var(--fm); color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .hms-b { display: flex; align-items: center; justify-content: center; gap: 3px; height: 24px; padding: 0 4px; border-radius: 6px; }
html:root[data-look][data-look] .cx-ap .hms-b small { order: 2; font: 600 9px var(--f); letter-spacing: .06em; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .hms-b input { order: 1; flex: 0 1 3ch; width: 3ch; font: 600 13px var(--fm); text-align: right; }
html:root[data-look][data-look] .cx-ap .hms-b:focus-within { background: rgba(255,255,255,.05); }

/* segmented controls: 30px, quiet ice selection */
html:root[data-look][data-look] .cx-ap :is(.seg, .tt-tb) { display: inline-flex; align-items: center; height: 30px; min-height: 30px; padding: 3px !important; gap: 2px; border-radius: 999px !important;
  background: var(--ap-well) !important; box-shadow: var(--ap-well-sh) !important; border: 0 !important; }
html:root[data-look][data-look] .cx-ap :is(.seg, .tt-tb) button { height: 24px !important; min-height: 0; padding: 0 9px !important; border-radius: 999px !important; font: 500 11.5px var(--f) !important; color: var(--tx3); white-space: nowrap; }
html:root[data-look][data-look] .cx-ap :is(.seg, .tt-tb) button.on { background: var(--ap-on) !important; box-shadow: var(--ap-on-sh) !important; color: var(--tx) !important; }
html:root[data-look][data-look] .cx-ap .tt-time-h .tt-tb { flex: none; }

/* "Trade from" wallet picker */
html:root[data-look][data-look] .cx-ap .lr-from { height: 30px; min-height: 30px; padding: 0 10px; gap: 6px; font-size: 12px; border-radius: 8px !important; background: var(--ap-well) !important; box-shadow: var(--ap-well-sh) !important; border: 0 !important; }
html:root[data-look][data-look] .cx-ap .lr-from .i { width: 13px; height: 13px; }
html:root[data-look][data-look] .cx-ap .vol-from { width: 100%; }

/* ---------- mode and direction cards: one row of three small chips, icon + title ---------- */
html:root[data-look][data-look] .cx-ap :is(.tt-modes, .tt-dirs) { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; padding: 0 !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir) { display: flex !important; flex-direction: column; align-items: center !important; justify-content: center !important; gap: 4px !important;
  min-height: 0 !important; height: auto; padding: 7px 4px !important; border-radius: 9px !important; text-align: center;
  background: var(--ap-fill) !important; box-shadow: var(--ap-edge) !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir)::before { content: none !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir)::after { content: none !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir) > span { display: block; align-self: auto; line-height: 1.2; max-width: 100%; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir) b { display: block; font: 500 11.5px var(--f) !important; color: var(--tx2) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir) small { display: none !important; }
html:root[data-look][data-look] .cx-ap .tt-dir > svg { width: 40px !important; height: 14px !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button > .i, .tt-dir > svg) { width: 14px; height: 14px; flex: none; opacity: .8; color: color-mix(in srgb, var(--tc, var(--rk, #c9dcf2)) 55%, var(--tx3)) !important; filter: none !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir):not(.on):hover { background: var(--ap-fill2) !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir).on { background: var(--ap-on) !important; box-shadow: var(--ap-on-sh), inset 0 -2px 0 -0.5px color-mix(in srgb, var(--tc, var(--rk, #c9dcf2)) 55%, transparent) !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button, .tt-dir).on b { color: var(--tx) !important; font-weight: 600 !important; }
html:root[data-look][data-look] .cx-ap :is(.tt-modes button.on > .i, .tt-dir.on > svg) { opacity: 1; color: color-mix(in srgb, var(--tc, var(--rk, #c9dcf2)) 80%, var(--tx)) !important; }
/* the line under the mode cards stays muted (the drawer tinted it in the mode's colour) */
html:root[data-look][data-look] .cx-ap .tt-risk + .hint { color: var(--tx3) !important; }

/* ---------- run summary: 2×2 small tiles ---------- */
html:root[data-look][data-look] .cx-ap .tt-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none; overflow: visible; }
html:root[data-look][data-look] .cx-ap .tt-sum > div { gap: 1px; padding: 7px 9px; border-radius: 8px !important; background: var(--ap-fill) !important; box-shadow: var(--ap-edge) !important; }
html:root[data-look][data-look] .cx-ap .tt-sum small { font-size: 11px; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .tt-sum b { font: 600 13px/1.3 var(--f); font-variant-numeric: tabular-nums; }
html:root[data-look][data-look] .cx-ap .tt-sum span { font-size: 10.5px; line-height: 1.3; color: var(--tx3); white-space: normal; overflow: visible; }
html:root[data-look][data-look] .cx-ap .tt-sum .tt-fee b { color: color-mix(in srgb, #ff9a4d 45%, var(--tx)); }

/* ---------- smart sells: source line + rungs as small frosted cards ---------- */
html:root[data-look][data-look] .cx-ap .lr-top { gap: 6px; }
html:root[data-look][data-look] .cx-ap .lr-top .tpl-note { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
html:root[data-look][data-look] .cx-ap .lr-cnt { font-size: 10.5px; }
html:root[data-look][data-look] .cx-ap .btn { height: 28px; padding: 0 10px; gap: 5px; font-size: 12px; border-radius: 8px; }
html:root[data-look][data-look] .cx-ap .btn.sm { height: 26px; padding: 0 9px; font-size: 11.5px; }
html:root[data-look][data-look] .cx-ap .btn .i { width: 13px; height: 13px; }
html:root[data-look][data-look] .cx-ap .btn.ic { width: 26px; padding: 0; justify-content: center; }
html:root[data-look][data-look] .cx-ap .lr-rungs { gap: 6px; padding: 0; container-type: inline-size; }
html:root[data-look][data-look] .cx-ap .lr-rung { display: grid !important; grid-template-columns: minmax(0, 86px) minmax(0, 1fr) 26px; grid-template-areas: "n f x" "mc pct pct";
  gap: 6px; align-items: center; padding: 8px; border-radius: 10px;
  background: var(--in-bg, var(--ap-fill)); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 0 0 1px rgba(201,220,242,.07); }
html:root[data-look][data-look] .cx-ap .lr-rung .te-rn { grid-area: n; padding: 0; font: 600 11px var(--fm); color: color-mix(in srgb, #fbbf24 70%, var(--tx2)); }
html:root[data-look][data-look] .cx-ap .lr-rung > .inp:has([data-lr-rmc]) { grid-area: mc; }
html:root[data-look][data-look] .cx-ap .lr-rung > .inp:has([data-lr-rpct]) { grid-area: pct; }
html:root[data-look][data-look] .cx-ap .lr-rung .inp em.pre { margin-right: 2px; }
html:root[data-look][data-look] .cx-ap .lr-rung .inp input { flex: 1 0 3ch; min-width: 3ch; }
html:root[data-look][data-look] .cx-ap .lr-rung .inp em:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a narrow rail: the row already says "Sell n", so the "Sell to" prefix goes and the value keeps its room */
@container (max-width: 284px) { html:root[data-look][data-look] .cx-ap .lr-rung .inp em.pre { display: none; } }
html:root[data-look][data-look] .cx-ap .lr-rung .lr-from { grid-area: f; height: 26px; min-height: 26px; padding: 0 8px; font-size: 11px; }
html:root[data-look][data-look] .cx-ap .lr-rung .btn.ic { grid-area: x; width: 26px; height: 26px; }
html:root[data-look][data-look] .cx-ap .lr-rungs > .btn { justify-self: start; }

/* ---------- live views ---------- */
html:root[data-look][data-look] .cx-ap .live-dot { font-size: 10.5px; }
html:root[data-look][data-look] .cx-ap .mini-eng .rung { display: grid; gap: 4px; padding: 8px 10px !important; border: 0; border-radius: 10px;
  background: var(--in-bg, var(--ap-fill)); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 0 0 1px rgba(201,220,242,.07); }
html:root[data-look][data-look] .cx-ap .mini-eng .rung b { font: 600 12px var(--f) !important; font-variant-numeric: tabular-nums; }
html:root[data-look][data-look] .cx-ap .mini-eng .rung span { font-size: 11px !important; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .mini-eng .rung .bar { height: 3px; margin-top: 2px; border-radius: 2px; background: rgba(255,255,255,.06); }
html:root[data-look][data-look] .cx-ap .mini-eng .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
html:root[data-look][data-look] .cx-ap .kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0 !important; font-size: 12px !important; border-color: var(--ap-hair); }
html:root[data-look][data-look] .cx-ap .kv dt { flex: none; font-size: 11px; color: var(--tx3); }
html:root[data-look][data-look] .cx-ap .kv dd { margin: 0; font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
html:root[data-look][data-look] .cx-ap .tt-log { font-size: 11.5px; }

/* ---------- light theme ---------- */
html:root[data-look][data-theme="light"] .cx-ap {
  --ap-fill: rgba(255,255,255,.42);
  --ap-fill2: rgba(255,255,255,.62);
  --ap-hair: rgba(20,40,70,.07);
  --ap-edge: inset 0 0 0 1px rgba(20,40,70,.07);
  --ap-well: rgba(255,255,255,.55);
  --ap-well-sh: inset 0 0 0 1px rgba(20,40,70,.09), inset 0 1px 1px rgba(20,40,70,.04);
  --ap-on: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.75));
  --ap-on-sh: inset 0 0 0 1px rgba(20,40,70,.14), 0 1px 2px rgba(20,40,70,.1); }
html:root[data-look][data-theme="light"] .cx-ap .cx-ads > :is(.trade, .tt-form, .lr-body), html:root[data-look][data-theme="light"] .cx-ap .cx-adh { background: var(--ap-fill) !important; box-shadow: var(--ap-edge) !important; }
html:root[data-look][data-theme="light"] .cx-ap .mm-b > span { background: rgba(20,40,70,.035); }
html:root[data-look][data-theme="light"] .cx-ap :is(.lr-rung, .mini-eng .rung) { background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1px rgba(20,40,70,.07), 0 1px 2px rgba(20,40,70,.04); }
html:root[data-look][data-theme="light"] .cx-ap .mini-eng .rung .bar { background: rgba(20,40,70,.08); }
html:root[data-look][data-theme="light"] .cx-ap .lr-rung .te-rn { color: #b7791f; }
html:root[data-look][data-theme="light"] .cx-ap .hms-b:focus-within { background: rgba(20,40,70,.05); }
html:root[data-look][data-theme="light"] .cx-ap .tt-sum .tt-fee b { color: #b45a14; }
html:root[data-look][data-theme="light"] .cx-ap :is(.tt-modes button.on > .i, .tt-dir.on > svg) { color: color-mix(in srgb, var(--tc, var(--rk, #5b7fa6)) 75%, #0f1724) !important; }
html:root[data-look][data-theme="light"] .cx-ap :is(.tt-modes button, .tt-dir).on { box-shadow: var(--ap-on-sh), inset 0 -2px 0 -0.5px color-mix(in srgb, var(--tc, var(--rk, #5b7fa6)) 70%, transparent) !important; }
