/* ============================================================================
   ChartControl brand v1.1 — chart extras (2026-11-05, batch 1)
     1. timeframe trigger + picker dialog (src/v11-chart.jsx)
     2. notice carousel + toolbar launcher (src/notice-popup.jsx, src/v11-chart.jsx)
     3. backtest settings flow (src/pages-more.jsx BacktestSettingsV11)

   ★★ Gate: every selector starts with
         :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme]
       The markup these rules style is rendered only under the same gate (QTV11Trade.useOn()), so a
       customer never has the elements and never matches a rule. APP_DESIGN=v1 → the :where() refuses.
   ★ Motion: dialog entry 150ms, control state 140ms (design CHART-WORKSPACE-DETAILS §기준), off under
       prefers-reduced-motion.
   ★ Source: reference-viewer/directions/charts/details/workspace-details.css (cd-period-*),
       charts/events-popup.css (cc-event-*), automation/strategy-details.css (sd-request*).
   ============================================================================ */

/* ---------- 1. Timeframe trigger + picker ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .chart-tf__btn.v11-tf-trigger {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-trigger__icon { width: 11px; height: 11px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-back {
  position: fixed; inset: 0; z-index: 10000; /* above the mobile tab bar (9999) */ display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--cc-scrim, rgba(8, 12, 18, .6));
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog {
  width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: hidden;
  display: flex; flex-direction: column; /* only the list scrolls; title, close and footer stay on screen */
  background: var(--cc-surface); color: var(--cc-ink);
  border: 1px solid var(--cc-line); border-radius: var(--cc-panel-radius, 12px);
  box-shadow: var(--cc-shadow, 0 24px 80px rgba(0, 0, 0, .45));
  font-family: var(--cc-font, inherit);
  animation: v11-chart-enter 150ms var(--cc-motion-ease, ease-out);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 16px 12px 24px; border-bottom: 1px solid var(--cc-line);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__head p { margin: 0 0 2px; font-size: 12px; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__head h2 { margin: 0; font-size: 18px; font-weight: var(--cc-weight-heading, 600); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-tf-icon, .v11-notice__icon) {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: var(--cc-control-radius, 6px);
  background: transparent; color: var(--cc-ink); cursor: pointer;
  transition: background-color 140ms var(--cc-motion-ease, ease);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-tf-icon, .v11-notice__icon):hover:not(:disabled) { background: var(--cc-hover, var(--cc-accent-soft)); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-tf-icon, .v11-notice__icon):disabled { opacity: .4; cursor: not-allowed; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__intro { margin: 0; padding: 14px 24px 0; font-size: 13px; color: var(--cc-muted); line-height: 1.6; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-groups { padding: 16px 24px 20px; display: grid; gap: 18px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-groups h3 { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt {
  display: flex; min-width: 0; overflow: hidden;
  border: 1px solid var(--cc-control-line, var(--cc-line)); border-radius: var(--cc-control-radius, 6px);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt button {
  min-height: 40px; border: 0; border-radius: 0; background: transparent; color: var(--cc-ink); cursor: pointer;
  font: inherit; font-family: var(--cc-font-numbers, inherit); font-variant-numeric: tabular-nums;
  transition: background-color 140ms var(--cc-motion-ease, ease), color 140ms var(--cc-motion-ease, ease);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt > button:first-child { flex: 1; text-align: left; padding-left: 12px; white-space: nowrap; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt > button:first-child[aria-pressed="true"] { background: var(--cc-hover); font-weight: 600; } /* selection = neutral hover surface (DESIGN.md :79-80; accent-soft is compatibility only) */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt > button:last-child { display: grid; place-items: center; width: 40px; color: var(--cc-faint, var(--cc-muted)); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt > button:last-child[aria-pressed="true"] { color: var(--cc-ink); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt button:hover { background: var(--cc-hover, var(--cc-accent-soft)); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt button:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: -3px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-top: 1px solid var(--cc-line); font-size: 12px; color: var(--cc-muted);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__foot .is-warn { color: var(--cc-warning); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__foot button {
  min-height: 36px; padding: 4px 10px; white-space: nowrap; cursor: pointer; font: inherit;
  border: 1px solid var(--cc-control-line, var(--cc-line)); border-radius: var(--cc-control-radius, 6px);
  background: transparent; color: var(--cc-ink);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog__foot button:disabled { opacity: .45; cursor: default; }
@media (max-width: 600px) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-back { align-items: flex-end; padding: 0; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-dialog { width: 100%; border-radius: var(--cc-panel-radius, 12px) var(--cc-panel-radius, 12px) 0 0; max-height: 88dvh; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt button { min-height: 44px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-opt > button:last-child { width: 44px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-tf-groups { padding: 14px 18px 18px; }
}

/* ---------- 2. Notice carousel ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .qt-noticeback.v11-notice-back { z-index: 10000; background: var(--cc-scrim, rgba(8, 12, 18, .7)); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice {
  width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  background: var(--cc-surface); color: var(--cc-ink);
  border: 1px solid var(--cc-line); border-radius: 16px; box-shadow: var(--cc-shadow, 0 26px 100px rgba(0, 0, 0, .45));
  font-family: var(--cc-font, inherit); outline: none;
  animation: v11-chart-enter 150ms var(--cc-motion-ease, ease-out);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice--warning { border-top: 3px solid var(--cc-warning); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice--critical { border-top: 3px solid var(--cc-danger); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 10px 24px; border-bottom: 1px solid var(--cc-line);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__head p { margin: 0; font-size: 12px; color: var(--cc-muted); }
/*
   (2026-11-19 prod) A notice taller than the window (the competition notice on a phone, or on a 1366x640 laptop): the
   text area was a flex item that shrank while its text kept its height, so the text ran over the pager and the "Got it"
   row. Now the header, pager and footer keep their height and the text area scrolls inside the window.
*/
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-notice__head, .v11-notice__pager, .v11-notice__foot) { flex: none; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__slide {
  padding: 24px 28px 20px; min-height: 200px; touch-action: pan-y;
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 12px; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__sev { padding: 2px 8px; border-radius: 4px; font-weight: 600; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__sev--warning { color: var(--cc-warning); background: var(--cc-warning-soft, transparent); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__sev--critical { color: var(--cc-danger); background: var(--cc-danger-soft, transparent); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__read { color: var(--cc-success, var(--cc-muted)); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__slide h2 {
  margin: 0 0 12px; font-size: clamp(20px, 3vw, 26px); font-weight: var(--cc-weight-heading, 600); line-height: 1.35; word-break: keep-all;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__body {
  color: var(--cc-muted); font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--cc-line);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__dots { display: flex; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__dots button {
  display: grid; place-items: center; width: 36px; min-height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__dots button::after {
  content: ''; display: block; width: 6px; height: 6px; border-radius: 10px; background: var(--cc-faint, var(--cc-muted));
  transition: width 140ms var(--cc-motion-ease, ease);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__dots button[aria-pressed="true"]::after { width: 20px; background: var(--cc-ink); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__arrows { display: flex; align-items: center; gap: 6px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__arrows .v11-notice__icon { border-color: var(--cc-control-line, var(--cc-line)); border-radius: 50%; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__counter { font-size: 12px; color: var(--cc-muted); font-family: var(--cc-font-numbers, inherit); font-variant-numeric: tabular-nums; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 20px 14px 24px;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__foot label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13px; color: var(--cc-muted); cursor: pointer; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__foot input { width: 16px; height: 16px; accent-color: var(--cc-accent); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-notice, .v11-tf-dialog) :is(button, input):focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .chart-tool.v11-notice-launcher { display: inline-flex; align-items: center; gap: 4px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice-launcher__n {
  min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--cc-accent-soft); color: var(--cc-ink);
  font-size: 10px; line-height: 16px; text-align: center; font-family: var(--cc-font-numbers, inherit);
}
@media (max-width: 600px) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice { border-radius: 12px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__slide { padding: 18px 18px 14px; min-height: 0; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__head { padding-left: 18px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__pager,
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__foot { padding-left: 14px; padding-right: 14px; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-notice__icon { width: 44px; height: 44px; }
}

/* ---------- 3. Backtest settings flow ---------- */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt { display: grid; gap: 12px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__fields .input-group { min-width: 0; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__fields .input-group :is(input, select) { flex: 1 1 auto; width: 100%; min-width: 0; font-family: var(--cc-font-numbers, inherit); font-variant-numeric: tabular-nums; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__fields .input-group__label { flex-shrink: 0; white-space: nowrap; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__hint,
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__actions > span { font-size: 12px; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__panel {
  display: grid; gap: 12px; padding: 14px 16px; border: 1px solid var(--cc-line); border-radius: var(--cc-control-radius, 8px);
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__panel.is-failed { border-color: var(--cc-warning); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__title { margin: 0; font-weight: 600; outline: none; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__panel.is-failed .v11-bt__title { color: var(--cc-warning); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt-scope { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 16px; margin: 0; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt-scope dt { font-size: 12px; color: var(--cc-muted); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt-scope dd { margin: 2px 0 0; font-family: var(--cc-font-numbers, inherit); font-variant-numeric: tabular-nums; }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__progress { position: relative; height: 4px; overflow: hidden; border-radius: 2px; background: var(--cc-accent-soft); }
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__progress > span {
  position: absolute; inset: 0 auto 0 0; width: 35%; border-radius: 2px; background: var(--cc-ink);
  animation: v11-chart-indeterminate 1.2s ease-in-out infinite;
}
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__showing { font-size: 12px; }

@keyframes v11-chart-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes v11-chart-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) {
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-tf-dialog, .v11-notice) { animation: none; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] .v11-bt__progress > span { animation: none; width: 100%; opacity: .5; }
  :where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] :is(.v11-tf-opt button, .v11-notice__dots button::after, .v11-tf-icon, .v11-notice__icon) { transition: none; }
}

/* ---------- 4. (2026-11-06) CCAI v2 trade setup box + shared chart objects (chart-kline.jsx qtTradeSetup* / qtObj*) ----------
   Role tokens the chart reads with getComputedStyle(documentElement) (readColors). Entry is neutral ink (as the position
   tool), the stop is the danger role and targets the success role — the result of the trade, not its direction.
   Unset (no v1.1 gate) → the chart falls back to the long/short tokens, i.e. nothing changes for those screens. */
:where(html:not([data-app-design="v1"]))[data-cc-brand="v11"][data-theme] {
  --chart-setup-entry: var(--cc-ink);
  --chart-setup-stop: var(--cc-danger);
  --chart-setup-target: var(--cc-success);
  --chart-obj-c1: var(--cc-series-1);
  --chart-obj-c2: var(--cc-ai);
  --chart-obj-c3: var(--cc-warning);
  --chart-obj-c4: var(--cc-down);
  --chart-obj-c5: var(--cc-success);
  --chart-obj-c6: var(--cc-up);
  --chart-obj-c7: var(--cc-muted);
  --chart-obj-c8: var(--cc-accent);
}
