/* ============================================================================
   ChartControl brand v1.1 — trade screen (Phase 1, 2026-11-05)

   Scope: #/trade's work area — .symbol-header--v2, .trade-body (chart frame and toolbars, order book,
   recent trades, order entry incl. paper mode, positions and orders tables, assets) and the mobile
   order sheet (.cc-sheet with #ccSheetSubmit). Header, navigation, the .mono utility and global input
   borders belong to the shell layer and are not touched here.

   ★★ Gate: every selector starts with
         :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme]
       src/brand-v11.js is the only writer of data-cc-brand (admin preview #/trade2 or the explicit
       ?cc-brand=v11 opt-in). Customers on #/trade never match a rule in this file.
       APP_DESIGN=v1 → data-app-design="v1" → the :where() guard refuses to match.
   ★ Loads right after tokens-v11.css, i.e. BEFORE widgets.css / chart-kline.css / mobile.css. Rules
       therefore win on specificity, never on order: the prefix alone is (0,2,0) and selectors repeat
       the structure of the rule they replace. mobile.css uses !important for some light-theme
       surfaces; the few overrides of those use !important too (only under this gate).
   ★ Source: design-review/reference-viewer/directions/brand-system/DESIGN.md + adapters.css (selection
       = ink text + neutral selection surface + magenta line, actions neutral, CCAI violet, up/down
       separate from success/danger), product/DESIGN.md (Pretendard numbers, no mono / upper-case
       labels), orders/ data states and EXTERNAL-REVIEW-2026-11-05 round 9 A–E.
       Density of the trade terminal (row heights, control heights) is kept as the product has it —
       the brand system says dense chart controls keep their existing behaviour.
   ============================================================================ */

/* ---------- 0. Chart canvas inputs (read by JS, no effect without the gate) ----------
   chart-kline.jsx reads --chart-font-num for axis / price labels (falls back to --font-mono).
   qt-indicators-ccai-levels.js reads --chart-candle-down (that name never existed in tokens.css, so its
   down lines and count labels fell back to a fixed saturated red) and --ccai-label-ink.
   qt-indicators-ccai.js reads --ccai-score-* for the CCAI score candles (fixed saturated red / blue
   before). The score palette follows the brand up/down only with the default long/short palette —
   the same condition tokens-v11.css uses; a customer's explicit palette keeps the original colours. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] {
  --chart-font-num: var(--cc-font-numbers);
  --chart-candle-down: var(--chart-candle-dn);
  --ccai-label-ink: var(--cc-on-trade);
}
:where(html:not([data-app-design="v1"]):is([data-longshort="teal-magenta"], :not([data-longshort])))[data-cc-brand="v11"][data-theme] {
  /* strong = the brand up/down; weak = a lighter step of the same hue (alpha still carries the score). */
  --ccai-score-up-strong: var(--cc-up);
  --ccai-score-down-strong: var(--cc-down);
  --ccai-score-up: oklch(85% 0.06 7.34);
  --ccai-score-down: oklch(86% 0.05 257.18);
  --ccai-score-neutral: var(--cc-muted);
}
:where(html:not([data-app-design="v1"]):is([data-longshort="teal-magenta"], :not([data-longshort])))[data-cc-brand="v11"][data-theme="light"] {
  --ccai-score-up: oklch(70% 0.1 13.72);
  --ccai-score-down: oklch(70% 0.07 251.05);
}

/* ---------- 0b. CCAI Zones (2026-11-20, ledger #225) — read by qt-indicators-ccai-levels.js, once per theme ----------
   Support is blue and resistance is orange in both themes (owner, 2026-10-28: fixed hues, apart from the candle
   colours, colour-blind safe); dark gets a lighter step of the same hue. The ink pair is the text of a zone's tag on
   the chart surface. Hex on purpose: the indicator mixes these with an alpha for the zone fill. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] {
  --ccai-zone-support: #6B95FF;
  --ccai-zone-resistance: #FF8F40;
  --ccai-zone-support-ink: #A9C1FF;
  --ccai-zone-resistance-ink: #FFB784;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme="light"] {
  --ccai-zone-support: #2962FF;
  --ccai-zone-resistance: #FF6D00;
  --ccai-zone-support-ink: #1B4FD8;
  --ccai-zone-resistance-ink: #B84A00;
}

/* ---------- 1. Numbers and labels: Pretendard, tabular, no monospace blocks, no upper-case labels ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body :is(
  .chart-tf__btn, .chart-hud, .chart-legend, .input-group__suffix, .pct-slider__labels,
  .oe-summary__row, .oe-lev, .ob-row, .ob-mid, .rt-row, .tbl td, .qt-cgrid__warn
),
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 :is(.sh-price--v2 .val, .sh-price--v2 .change, .sh-meta-cell__v) {
  font-family: var(--cc-font-numbers);
  font-variant-numeric: tabular-nums lining-nums;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .panel .panel__header .panel__title,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .qt-cgrid__bar .qt-cgrid__barlabel {
  font-family: var(--cc-font);
  font-size: var(--cc-text-small);
  line-height: var(--cc-leading-small);
  font-weight: var(--cc-weight-heading);
  letter-spacing: var(--cc-tracking-body);
  text-transform: none;
  color: var(--cc-ink);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .tbl th,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body :is(.ob-head, .rt-head),
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-mmode .oe-mmode__label,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-meta-cell .sh-meta-cell__k {
  font-family: var(--cc-font);
  font-size: var(--cc-text-caption);
  font-weight: var(--cc-weight-control);
  letter-spacing: 0;
  text-transform: none;
  color: var(--cc-muted);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-meta-cell .sh-meta-cell__k .sh-deriv__btn {
  text-transform: none;
  letter-spacing: 0;
}
/* Two text levels only (ink / muted): size and weight carry the rest. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-hud .chart-hud__row .k,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-legend .chart-legend__item {
  color: var(--cc-muted);
}

/* ---------- 2. Symbol header ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-identity__sym {
  font-family: var(--cc-font);
  font-weight: var(--cc-weight-heading);
  letter-spacing: var(--cc-tracking-heading);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-identity__sub {
  font-family: var(--cc-font);
  font-size: var(--cc-text-caption);
  letter-spacing: 0;
  color: var(--cc-muted);
}
/* Favourite = persistent membership, not selection and not a warning: ink when on, muted when off. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-identity .sh-identity__star.is-off {
  color: var(--cc-muted);
  /* widgets.jsx dims "off" with inline opacity 0.35 (1.65:1 light / 2.27:1 dark). Muted at full opacity
     clears 3:1 (WCAG 1.4.11); on/off stays distinct by ink vs muted + aria-pressed. !important beats the inline style. */
  opacity: 1 !important;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-identity .sh-identity__star.is-on { color: var(--cc-ink); }
/* Market type is information, not the current selection — neutral, no magenta outline. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .badge.badge--perp {
  color: var(--cc-muted);
  border-color: var(--cc-control-line);
  background: transparent;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-price--v2 .val {
  font-weight: var(--cc-weight-price);
  letter-spacing: var(--cc-tracking-number);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-price--v2 .change .change__pill {
  border-radius: var(--cc-space-1);
  font-weight: var(--cc-weight-control);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 .sh-price--v2 .change .change__usd { color: var(--cc-muted); }

/* ---------- 3. Work surfaces: separated by lines and surface tone, no shadows ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .widget .panel {
  border-color: var(--cc-line);
  box-shadow: none;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .panel .panel__header {
  border-bottom-color: var(--cc-line);
}

/* ---------- 4. Selection: pressed toggles = neutral hover surface + ink; no line, no magenta ----------
   Brand DESIGN.md (round 17+) "차트 도구 토글 — 눌린 중립 hover 면 + ink. 선택선 없음 (주문창, 호가, 도구·배치)"
   and "분할 보기·필터 칩 — 중립 hover 면 + ink". The selection colour is --cc-hover directly (not accent-soft,
   not --color-bg-active, which the shell layer maps separately). Tabs keep their underline (below). */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-tf .chart-tf__btn.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .seg .seg__opt.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .seg .seg__opt[aria-selected="true"],
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .ob-side-toggle .ob-side-btn.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-toolbar .chart-tool.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-drawtools .chart-drawtool.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-body .btn.is-active[aria-pressed="true"] {
  background: var(--cc-hover);
  color: var(--cc-ink);
  border-color: transparent;
  box-shadow: none;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .chart-tf .chart-tf__btn.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .seg .seg__opt.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .seg .seg__opt[aria-selected="true"],
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-body .btn.is-active[aria-pressed="true"] {
  font-weight: var(--cc-weight-heading);
}
/* Icons inside a pressed tool follow the label (ink) — the old magenta icon is gone. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body :is(.chart-toolbar .chart-tool, .chart-drawtools .chart-drawtool).is-active svg { color: currentColor; }
/* Tabs: ink + heavier weight + the 2px magenta underline that already exists. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .pos-tabs .tab.is-active,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-tabs .oe-tab.is-active {
  color: var(--cc-ink);
  font-weight: var(--cc-weight-heading);
  border-bottom-color: var(--cc-tab-accent);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .pos-tabs .tab .tab__count {
  background: var(--cc-soft);
  color: var(--cc-muted);
  font-family: var(--cc-font-numbers);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .pos-tabs .tab.is-active .tab__count { color: var(--cc-ink); }
/* AI signals glyph keeps the CCAI violet (inline style); nothing to do. */

/* ---------- 5. Order entry ---------- */
/* Leverage is a control, not a selection — neutral chip (was magenta on magenta-soft). */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-margin .oe-lev {
  background: var(--cc-soft);
  color: var(--cc-ink);
  box-shadow: inset 0 0 0 1px var(--cc-control-line);
  font-weight: var(--cc-weight-heading);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-margin .oe-margin__badge {
  font-family: var(--cc-font);
  text-transform: none;
  letter-spacing: 0;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-summary {
  background: var(--cc-soft);
  border-color: var(--cc-line);
  border-radius: var(--cc-control-radius);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-summary .oe-summary__row { color: var(--cc-muted); }
/* Warnings use the status tokens (were fixed oklch literals). Danger stays danger, not "down". */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-body .oe-warn {
  background: var(--cc-warning-soft);
  border-color: color-mix(in oklab, var(--cc-warning) 40%, transparent);
  color: var(--cc-warning);
  border-radius: var(--cc-control-radius);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-body .oe-warn.oe-warn--danger {
  background: var(--cc-danger-soft);
  border-color: color-mix(in oklab, var(--cc-danger) 40%, transparent);
  color: var(--cc-danger);
}
/* Inline CTAs inside a warning read as text links in the warning's own colour, not magenta. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-body .oe-warn .qt-inline-cta {
  color: inherit !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* Buy / sell: up / down fill with on-trade text, 44px target (brand primary-action minimum).
   Desktop only — mobile.css already makes them taller (54px) and that must not shrink. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-buttons .btn.btn--lg {
  border-radius: var(--cc-control-radius);
  font-weight: var(--cc-weight-heading);
}
@media (min-width: 901px) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-buttons .btn.btn--lg { min-height: var(--cc-control-height); }
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-buttons .btn.btn--long:not(.btn--outline),
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .oe-buttons .btn.btn--short:not(.btn--outline) {
  color: var(--cc-on-trade);
}
/* The percentage slider is a selection: magenta fill / stop stays; its labels are captions. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .pct-slider__labels {
  font-size: var(--cc-text-caption);
  color: var(--cc-muted);
}

/* ---------- 6. Order book / recent trades ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .ob-mid {
  background: var(--cc-soft);
  border-color: var(--cc-line);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .ob-mid .ob-mid__last {
  font-weight: var(--cc-weight-price);
  letter-spacing: var(--cc-tracking-number);
}

/* ---------- 7. Tables: data states (src/v11-trade.js DataState / Note / Live) ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state-wrap {
  container-type: inline-size;
  padding: var(--cc-space-4);
}
/* Wide: graphic · text · actions in one row (short trade tables). Narrow (container below 560px): stacked. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--cc-space-2) var(--cc-space-4);
  max-width: 880px;
  margin: 0 auto;
  color: var(--cc-muted);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@container (max-width: 560px) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__actions { justify-content: center; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__title { font-size: var(--cc-text-small); line-height: var(--cc-leading-small); }
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__icon {
  width: 28px;
  height: 28px;
  color: var(--cc-muted);
  flex-shrink: 0;
}
/* Failed ≠ empty: its own broken-link graphic, larger, in the warning colour. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state.v11-state--failed .v11-state__icon {
  width: 40px;
  height: 40px;
  color: var(--cc-warning);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__text { min-width: 0; display: grid; gap: var(--cc-space-1); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__title {
  margin: 0;
  font-size: var(--cc-text-body);
  line-height: var(--cc-leading-body);
  font-weight: var(--cc-weight-control);
  color: var(--cc-ink);
  text-wrap: pretty;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state.v11-state--failed .v11-state__title { font-weight: var(--cc-weight-heading); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__msg {
  margin: 0;
  font-size: var(--cc-text-small);
  line-height: var(--cc-leading-small);
  color: var(--cc-muted);
  text-wrap: pretty;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cc-space-2) var(--cc-space-4);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__actions > :is(button, a) {
  min-height: var(--cc-compact-height);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-state, .v11-note) .btn {
  border-radius: var(--cc-control-radius);
  font-weight: var(--cc-weight-control);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__link {
  display: inline-flex;
  align-items: center;
  color: var(--cc-ink);
  font-size: var(--cc-text-small);
  font-weight: var(--cc-weight-control);
  text-decoration: underline;
  text-underline-offset: 3px;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-state .v11-state__link:hover { color: var(--cc-ink); text-decoration-thickness: 2px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--cc-space-2) var(--cc-space-3);
  margin: 0;
  padding: var(--cc-space-2) var(--cc-space-3);
  border-bottom: 1px solid var(--cc-line);
  background: var(--cc-warning-soft);
  color: var(--cc-ink);
  font-size: var(--cc-text-small);
  line-height: var(--cc-leading-small);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-note .v11-note__text { min-width: 0; flex: 1 1 240px; }
/* (2026-11-24) a link beside the note's button ("View connection →" when the exchange refused the read as a key
   problem) — the look of the empty state's link (.v11-state__link); it never wraps, the row does */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-note .v11-note__link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: var(--cc-compact-height);
  color: var(--cc-ink);
  font-size: var(--cc-text-small);
  font-weight: var(--cc-weight-control);
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-note .v11-note__link:hover { text-decoration-thickness: 2px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-note::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cc-warning);
}
/* While a read has failed the symbol filter is disabled — show it as unavailable, not just inert. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .pos-tabs .chk:has(input:disabled) {
  color: color-mix(in oklab, var(--cc-muted) 60%, var(--cc-surface));
  cursor: not-allowed;
}

/* ---------- 8. Narrow screens (mobile.css re-skins these with fixed near-black / gold) ---------- */
@media (max-width: 900px) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .symbol-header--v2 {
    background: var(--cc-surface);
    border-bottom-color: var(--cc-line);
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] .chart-toolbar {
    background: var(--cc-surface);
    border-bottom-color: var(--cc-line);
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] .chart-tf {
    background: var(--cc-soft) !important;
    border-color: var(--cc-line) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] :is(.chart-tool, .chart-drawtool) {
    background: var(--cc-soft) !important;
    border-color: var(--cc-line) !important;
    color: var(--cc-muted);
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] .chart-drawtools {
    background: var(--cc-surface);
    border-top-color: var(--cc-line);
  }
  /* Pressed = hover surface only: the border stays the resting line colour (no accent outline), ink text and icon. */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] :is(.chart-tf__btn, .chart-tool, .chart-drawtool).is-active,
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='marketWatch'] .mw-tab.is-active {
    background: var(--cc-hover) !important;
    border-color: var(--cc-line) !important;
    color: var(--cc-ink) !important;
    box-shadow: none;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='chart'] :is(.chart-tool, .chart-drawtool).is-active svg { color: currentColor; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='positions'] .tbl tbody tr {
    background: var(--cc-soft) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body > .widget[data-widget-type='positions'] .tbl th {
    border-bottom-color: var(--cc-line) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .panel .panel__header .panel__title {
    font-size: var(--cc-text-small);
    letter-spacing: var(--cc-tracking-body);
  }

  /* Mobile order sheet (mobile-tabbar.js — inline styles, hence !important). The CCAI sheet shares
     .cc-sheet, so the order sheet is picked by its submit button. */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) {
    background: var(--cc-surface) !important;
    border-top-color: var(--cc-line) !important;
    color: var(--cc-ink);
    font-family: var(--cc-font);
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-sheet__row, #ccSheetErr, .cc-sheet__note, .cc-sheet__meta) {
    font-family: var(--cc-font) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-sheet__row, .cc-sheet__note, .cc-sheet__meta) {
    color: var(--cc-muted) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__row {
    font-size: var(--cc-text-caption) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__grab { background: var(--cc-control-line) !important; }
  /* Close ✕ was hard-coded #848E9C (3.32:1 on the white sheet) — muted token clears 3:1 (WCAG 1.4.11) in both themes. */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__x { color: var(--cc-muted); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__head b { font-weight: var(--cc-weight-heading); color: var(--cc-ink); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__head b:focus-visible {
    outline: var(--cc-focus-width) solid var(--cc-accent);
    outline-offset: var(--cc-focus-offset);
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__head b:focus:not(:focus-visible) { outline: none; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__meta span {
    background: var(--cc-soft);
    border-color: var(--cc-line);
    font-variant-numeric: tabular-nums lining-nums;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__tabs {
    background: var(--cc-soft) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__tabs button { color: var(--cc-muted); font-weight: var(--cc-weight-heading); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__tabs button.on[data-side="long"] { background: var(--cc-up); color: var(--cc-on-trade); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__tabs button.on[data-side="short"] { background: var(--cc-down); color: var(--cc-on-trade); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__tabs button.on::before { border-top-color: var(--cc-on-trade); border-bottom-color: var(--cc-on-trade); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(#ccQty, #ccLev, #ccTp, #ccSl) {
    background: var(--cc-surface) !important;
    border-color: var(--cc-control-line) !important;
    border-radius: var(--cc-control-radius) !important;
    color: var(--cc-ink) !important;
    font-family: var(--cc-font-numbers) !important;
    font-variant-numeric: tabular-nums lining-nums;
  }
  /* One focus boundary (section 9): the field's own border goes transparent, a 2px ring sits on it (offset 0). */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(#ccQty, #ccLev, #ccTp, #ccSl):focus-visible {
    border-color: transparent !important;
    outline: var(--v11-input-focus-width) solid var(--cc-accent);
    outline-offset: 0;
    box-shadow: none;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) #ccSheetSubmit {
    background: var(--cc-up) !important;
    color: var(--cc-on-trade) !important;
    font-family: var(--cc-font) !important;
    font-weight: var(--cc-weight-heading) !important;
    border-radius: var(--cc-control-radius) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) #ccSheetSubmit.is-sell { background: var(--cc-down) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-lev-chips, .cc-tpsl-chips) button {
    background: var(--cc-soft) !important;
    border-color: var(--cc-line) !important;
    color: var(--cc-muted) !important;
    font-family: var(--cc-font-numbers) !important;
    border-radius: var(--cc-control-radius) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-lev-chips, .cc-tpsl-chips) button.on:not(.cc-pct-idle) {
    background: var(--cc-hover) !important;
    border-color: var(--cc-line) !important;
    color: var(--cc-ink) !important;
  }
  /* (2026-11-08, ledger #131) the sheet's Isolated / Cross switch — the same v1.1 chip look */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm__opt, :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm__ro {
    background: var(--cc-soft) !important; border-color: var(--cc-line) !important; color: var(--cc-muted) !important;
    font-family: var(--cc-font) !important; border-radius: var(--cc-control-radius) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm__ro { color: var(--cc-ink) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm__opt[aria-checked="true"] { background: var(--cc-hover) !important; color: var(--cc-ink) !important; box-shadow: inset 0 0 0 1px var(--cc-ink); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm__opt:not(:disabled):not([aria-checked="true"]):hover { background: var(--cc-hover) !important; color: var(--cc-ink) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm-note { color: var(--cc-muted) !important; font-family: var(--cc-font) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-mm-note--err { color: var(--cc-danger) !important; }
  /* (2026-11-08, v12 · #115) the sheet's review step is the desktop v1.1 order review (OrderPreviewModal .v11op, mounted by
     mobile-tabbar.js in #cc-v11-review-host). It sits over the sheet (9999) and its dim; at ≤600px v11-trade-legacy.css makes it
     a bottom sheet. Two-button footer: equal widths on a phone, Back left, the side-coloured confirm right. */
  /* (2026-11-08, #126) the sheet's LIVE review is app.jsx's own (placeOrder → OrderPreviewModal, overlay data-origin="mobile-sheet"): same rules */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host .v11op-overlay, .v11op-overlay[data-origin="mobile-sheet"]) { z-index: 10003; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host, .v11op-overlay[data-origin="mobile-sheet"]) .v11op__foot .v11op__btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host, .v11op-overlay[data-origin="mobile-sheet"]) .v11op__x { min-width: 44px; min-height: 44px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host, .v11op-overlay[data-origin="mobile-sheet"]) .v11op .risk-card .btn { min-height: 44px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host, .v11op-overlay[data-origin="mobile-sheet"]) .v11adv-skip select,
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(#cc-v11-review-host, .v11op-overlay[data-origin="mobile-sheet"]) .v11adv-skip__check,
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11op-overlay[data-origin="mobile-sheet"] .v11adv-skip__limit input { min-height: 44px; }
  /* (2026-11-08, #126) the sheet's live badge: "Live · KuCoin · Main account" (the phone bar's live badge colours) */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__live {
    display: inline-flex; align-items: center; margin: 0 0 0 8px; padding: 2px 6px; border: 1px solid var(--cc-danger); border-radius: 4px;
    color: var(--cc-danger); font: 600 11px/16px var(--cc-font); white-space: nowrap; vertical-align: middle;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__live[hidden] { display: none; }
  /* the rest of the sheet that still carried the old inline type and colours */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) #ccSheetSubmit {
    min-height: 48px !important;
    font-size: var(--cc-text-body, 15px) !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) #ccSheetSubmit:hover { filter: brightness(1.06); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) #ccSheetErr { color: var(--cc-danger) !important; font-size: var(--cc-text-caption) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-sheet__note { font-size: var(--cc-text-caption) !important; line-height: 1.5; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-sheet__tabs button, .cc-lev-chips button, .cc-tpsl-chips button, .cc-sheet__x):hover:not(.on) { background: var(--cc-hover) !important; color: var(--cc-ink) !important; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-sheet__tabs button, .cc-lev-chips button, .cc-tpsl-chips button, .cc-sheet__x, #ccSheetSubmit):focus:not(:focus-visible) { outline: none; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) :is(.cc-sheet__tabs button, .cc-lev-chips button, .cc-tpsl-chips button, .cc-sheet__x, #ccSheetSubmit):focus-visible {
    outline: var(--cc-focus-width) solid var(--cc-accent);
    outline-offset: var(--cc-focus-offset);
  }
  /* ≤360: the leverage chips wrap 4 + 3 (mobile.css's 3-per-row left the max chip alone on a third row); still ≥44px wide */
  @media (max-width: 360px) {
    :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet:has(#ccSheetSubmit) .cc-lev-chips button { flex: 1 1 calc(25% - 6px) !important; }
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-sheet-dim { background: var(--cc-scrim, rgb(12 17 26 / .6)); }
  /* .cc-toast is only drawn when the v1.1 shell's toasts are not there yet (mobile-tabbar.js showToast) — same look as .v11s-toast */
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-toast {
    width: min(380px, calc(100vw - 32px)) !important;
    padding: 13px 16px !important;
    border: 1px solid var(--cc-line) !important;
    border-left: 3px solid var(--cc-success) !important;
    border-radius: var(--cc-panel-radius, 12px) !important;
    background: var(--cc-surface) !important;
    color: var(--cc-ink) !important;
    box-shadow: var(--cc-shadow) !important;
    font: 13px/1.5 var(--cc-font) !important;
  }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .cc-toast.cc-toast--error { border-left-color: var(--cc-danger) !important; }
}

/* ---------- 9. Inputs: one focus boundary (brand adapters.css "Inputs have one focus boundary", REVIEW-INPUT-FOCUS) ----------
   Text inputs match :focus-visible after a pointer click too, so hiding the ring for pointer focus cannot fix a
   double line. Instead: a bordered input owns its boundary (border transparent, 2px ring, offset 0, no shadow);
   a composite field (.input-group: input + unit / suffix / button) rings its outer shell only and the inner
   input draws nothing. A control inside the shell (unit select, button) that takes keyboard focus shows its own
   ring and the shell stays quiet. High contrast: one 3px line. Invalid: the danger colour.
   Scope: the trade work area, the chart's indicator search panel and the mobile order sheet. Buttons, links,
   sliders and checkboxes keep their existing keyboard focus. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] { --v11-input-focus-width: var(--cc-focus-width); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme][data-a11y-high-contrast] { --v11-input-focus-width: 3px; }
@media (prefers-contrast: more) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] { --v11-input-focus-width: 3px; }
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.trade-body, .chart-ind-panel) :is(
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="hidden"]),
  select, textarea
):focus-visible {
  border-color: transparent;
  outline: var(--v11-input-focus-width) solid var(--cc-accent);
  outline-offset: 0;
  box-shadow: none;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.trade-body, .chart-ind-panel) :is(input, select, textarea)[aria-invalid="true"]:focus-visible { outline-color: var(--cc-danger); }
/* Composite: the shell carries the single ring … */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group:focus-within {
  border-color: transparent;
  outline: var(--v11-input-focus-width) solid var(--cc-accent);
  outline-offset: 0;
  box-shadow: none;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group:has([aria-invalid="true"]):focus-within { outline-color: var(--cc-danger); }
/* … and the inner input draws nothing (beats the standalone rule above on specificity). */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group :is(input, textarea):focus,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group :is(input, textarea):focus-visible {
  border-color: transparent;
  outline: none;
  box-shadow: none;
}
/* A unit select / button inside the shell keeps its own keyboard ring; the shell goes back to its resting line. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group:has(:is(button, select):focus-visible) {
  border-color: var(--cc-control-line);
  outline: none;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .trade-body .input-group :is(button, select):focus-visible {
  outline: var(--v11-input-focus-width) solid var(--cc-accent);
  outline-offset: 0;
}
/* Pointer clicks on the chart host (klinecharts' [role=region][tabindex]) and focusable SVGs draw no box; the
   keyboard ring (:focus-visible) and arrow-key chart inspection stay. WebKit paints a native ring on :focus. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.trade-body, .chart-ind-panel) :is(svg[tabindex], [role="region"][tabindex]):focus:not(:focus-visible) { outline: none; }
