/*
 * @ftw-trade/charts — the chart's own styles. Import once per app:
 *   import '@ftw-trade/charts/chart.css';
 *
 * Theming: the chart reads only the --cc-* tokens below. Each defaults to the
 * host's same-named token when it has one (--up, --ink, …) and to a dark
 * palette otherwise, so the chart looks right in a bare page and follows the
 * host's theme — including a light theme — without being told.
 */
:where(.cc-root, .cc-study-picker, .cc-layout, .cc-fs) {
  --cc-up: var(--up, #1fcf7d);
  --cc-down: var(--down, #f4475d);
  --cc-ink: var(--ink, #eceef2);
  --cc-dim: var(--dim, #a0a6b2);
  --cc-faint: var(--faint, #808795);
  --cc-line: var(--line, #1f1f24);
  --cc-line2: var(--line2, #2c2c33);
  --cc-raise: var(--raise, #232328);
  --cc-card2: var(--card2, #1a1a1e);
  --cc-bg2: var(--bg2, #09090b);
  --cc-violet: var(--violet, #8f7ff7);
  --cc-amber: var(--amber, #f3b53f);
  --cc-accent: var(--act-text, #c7f464);
  --cc-bg-rgb: var(--bg-rgb, 14, 16, 20);
  /* The line and area chart types' series colour. */
  --cc-series: var(--blue, #4c8dff);
  /* Candle detail and volume (src/theme.ts); each follows the candle colours unless set. */
  --cc-wick-up: var(--cc-up);
  --cc-wick-down: var(--cc-down);
  --cc-volume-up: var(--cc-up);
  --cc-volume-down: var(--cc-down);
  --cc-volume-opacity: 0.42;
  --cc-grid-opacity: 0.5;
  /* Chart settings (src/settings.ts) set these; each follows a token above unless set. */
  --cc-grid: var(--cc-line);
  --cc-cross: var(--cc-dim);
  /* The axes' labels and border lines (settings: scales.textColor / lineColor). */
  --cc-axis: var(--cc-dim);
  --cc-axis-line: var(--cc-line2);
  --cc-cross-tag: var(--cc-raise);
  --cc-cross-ink: var(--cc-ink);
  --cc-tag-ink: #0c0a12;
  /* The previous day's close line and tag (settings: scales.prevCloseColor). */
  --cc-prev-close: var(--cc-dim);
  /* Bid and ask lines and tags (settings: scales.bidColor / askColor). */
  --cc-bid: var(--cc-up);
  --cc-ask: var(--cc-down);
  /* Bars outside the regular session (the sessions prop). */
  --cc-ext-hours: var(--cc-faint);
  --cc-ext-hours-opacity: 0.1;
  --cc-watermark: var(--cc-ink);
  /* Session breaks (settings: sessions.color). */
  --cc-session: var(--cc-faint);
  /*
   * Controls: one look for every button, toggle, menu and popover the chart
   * draws (the toolbar, the rail, the footer, menus, dialogs, the layout bar).
   * Quiet at rest (no fill, no border), a faint wash on hover, a deeper one
   * pressed; a toggle that is on reads in the accent over a tint of it, as
   * TradingView's do. Override any of them to restyle every control at once.
   */
  --cc-ctl-h: 28px;
  --cc-ctl-r: 6px;
  --cc-hover: color-mix(in srgb, var(--cc-ink) 8%, transparent);
  --cc-press: color-mix(in srgb, var(--cc-ink) 13%, transparent);
  --cc-on: var(--cc-accent);
  --cc-on-bg: color-mix(in srgb, var(--cc-on) 15%, transparent);
  --cc-pop: var(--cc-card2);
  --cc-pop-ring: color-mix(in srgb, var(--cc-ink) 10%, transparent);
  --cc-pop-shadow: 0 1px 2px rgba(0, 0, 0, .16), 0 4px 10px -2px rgba(0, 0, 0, .2), 0 18px 40px -8px rgba(0, 0, 0, .42);
  /* Motion: one easing and two lengths for every hover, press and entrance (none under prefers-reduced-motion). */
  --cc-ease: cubic-bezier(.2, .8, .2, 1);
  --cc-fast: .12s;
  --cc-focus-ring: 0 0 0 2px color-mix(in srgb, var(--cc-accent) 60%, transparent);
  --cc-ui-font: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}
.cc-root { font-family: var(--cc-font, inherit); }
/* Crisp text on the dark surfaces, and figures that line up: every number the chart prints is tabular. */
.cc-root, .cc-layout { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-variant-numeric: tabular-nums; }
/* Every control the chart draws: the keyboard ring, never the click's. */
:where(.cc-root, .cc-layout, .cc-study-picker, .cc-fs) :is(button, select, [role='tab']):focus-visible { outline: none; box-shadow: var(--cc-focus-ring); }
/* The chart is a tab stop for its arrow keys (`keyboard`): a ring for keyboard focus only, none for a click. */
.cc-root[tabindex]:focus { outline: none; }
.cc-root[tabindex]:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; border-radius: 4px; }

@keyframes cc-whirl { to { transform: rotate(360deg); } }
/* A chart still waiting for its first read. */
.cc-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--cc-ink) 14%, transparent); border-top-color: var(--cc-accent); animation: cc-whirl .7s linear infinite; }
/* A chart with nothing to draw yet: loading, empty, or unavailable (with its reason). */
.cc-notice { position: relative; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; text-align: center; padding: 0 12%; overflow: hidden; }
.cc-notice > * { position: relative; z-index: 1; }
/* The words over the loading ghost sit in a soft clearing of the chart's own background. */
.cc-notice[data-state='loading']::after { content: ''; position: absolute; inset: 0; background: radial-gradient(closest-side, rgba(var(--cc-bg-rgb), .92) 30%, rgba(var(--cc-bg-rgb), 0)) center / 220px 120px no-repeat; pointer-events: none; }
.cc-notice-title { color: var(--cc-dim); font-size: 13px; font-weight: 600; letter-spacing: -.005em; }
.cc-notice-title::first-letter { text-transform: uppercase; }
.cc-notice-title[data-tone='unavailable'] { color: var(--cc-ink); }
.cc-notice-note { max-width: 42ch; color: var(--cc-faint); font-size: 12px; line-height: 1.5; }
/* Loading: a ghost of a candle chart behind the spinner, a light sweeping across it. */
.cc-notice[data-state='loading']::before { content: ''; position: absolute; inset: 14% 6% 18%; background: linear-gradient(100deg, color-mix(in srgb, var(--cc-ink) 5%, transparent) 30%, color-mix(in srgb, var(--cc-ink) 11%, transparent) 50%, color-mix(in srgb, var(--cc-ink) 5%, transparent) 70%) 0 0 / 300% 100%; -webkit-mask: var(--cc-ghost) center / 100% 100% no-repeat; mask: var(--cc-ghost) center / 100% 100% no-repeat; animation: cc-sweep 1.8s linear infinite; }
.cc-notice { --cc-ghost: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 100' preserveAspectRatio='none'%3E%3Cg fill='%23000'%3E%3Crect x='4' y='58' width='5' height='18'/%3E%3Crect x='6' y='52' width='1' height='30'/%3E%3Crect x='14' y='50' width='5' height='14'/%3E%3Crect x='16' y='44' width='1' height='26'/%3E%3Crect x='24' y='54' width='5' height='12'/%3E%3Crect x='26' y='48' width='1' height='24'/%3E%3Crect x='34' y='44' width='5' height='16'/%3E%3Crect x='36' y='38' width='1' height='28'/%3E%3Crect x='44' y='36' width='5' height='14'/%3E%3Crect x='46' y='30' width='1' height='26'/%3E%3Crect x='54' y='40' width='5' height='10'/%3E%3Crect x='56' y='34' width='1' height='22'/%3E%3Crect x='64' y='30' width='5' height='16'/%3E%3Crect x='66' y='24' width='1' height='28'/%3E%3Crect x='74' y='34' width='5' height='14'/%3E%3Crect x='76' y='28' width='1' height='26'/%3E%3Crect x='84' y='42' width='5' height='12'/%3E%3Crect x='86' y='36' width='1' height='24'/%3E%3Crect x='94' y='48' width='5' height='14'/%3E%3Crect x='96' y='42' width='1' height='26'/%3E%3Crect x='104' y='44' width='5' height='10'/%3E%3Crect x='106' y='38' width='1' height='22'/%3E%3Crect x='114' y='36' width='5' height='14'/%3E%3Crect x='116' y='30' width='1' height='26'/%3E%3Crect x='124' y='28' width='5' height='12'/%3E%3Crect x='126' y='22' width='1' height='24'/%3E%3Crect x='134' y='32' width='5' height='14'/%3E%3Crect x='136' y='26' width='1' height='26'/%3E%3Crect x='144' y='24' width='5' height='16'/%3E%3Crect x='146' y='18' width='1' height='28'/%3E%3Crect x='154' y='18' width='5' height='12'/%3E%3Crect x='156' y='12' width='1' height='24'/%3E%3Crect x='164' y='22' width='5' height='14'/%3E%3Crect x='166' y='16' width='1' height='26'/%3E%3Crect x='174' y='30' width='5' height='12'/%3E%3Crect x='176' y='24' width='1' height='24'/%3E%3Crect x='184' y='26' width='5' height='10'/%3E%3Crect x='186' y='20' width='1' height='22'/%3E%3Crect x='194' y='18' width='5' height='14'/%3E%3Crect x='196' y='12' width='1' height='26'/%3E%3Crect x='204' y='12' width='5' height='12'/%3E%3Crect x='206' y='6' width='1' height='24'/%3E%3Crect x='214' y='16' width='5' height='10'/%3E%3Crect x='216' y='10' width='1' height='22'/%3E%3Crect x='224' y='10' width='5' height='12'/%3E%3Crect x='226' y='4' width='1' height='24'/%3E%3Crect x='234' y='14' width='5' height='10'/%3E%3Crect x='236' y='8' width='1' height='22'/%3E%3Crect x='4' y='88' width='5' height='12'/%3E%3Crect x='14' y='92' width='5' height='8'/%3E%3Crect x='24' y='90' width='5' height='10'/%3E%3Crect x='34' y='86' width='5' height='14'/%3E%3Crect x='44' y='91' width='5' height='9'/%3E%3Crect x='54' y='88' width='5' height='12'/%3E%3Crect x='64' y='93' width='5' height='7'/%3E%3Crect x='74' y='89' width='5' height='11'/%3E%3Crect x='84' y='92' width='5' height='8'/%3E%3Crect x='94' y='87' width='5' height='13'/%3E%3Crect x='104' y='90' width='5' height='10'/%3E%3Crect x='114' y='92' width='5' height='8'/%3E%3Crect x='124' y='88' width='5' height='12'/%3E%3Crect x='134' y='91' width='5' height='9'/%3E%3Crect x='144' y='86' width='5' height='14'/%3E%3Crect x='154' y='90' width='5' height='10'/%3E%3Crect x='164' y='93' width='5' height='7'/%3E%3Crect x='174' y='89' width='5' height='11'/%3E%3Crect x='184' y='92' width='5' height='8'/%3E%3Crect x='194' y='88' width='5' height='12'/%3E%3Crect x='204' y='90' width='5' height='10'/%3E%3Crect x='214' y='92' width='5' height='8'/%3E%3Crect x='224' y='87' width='5' height='13'/%3E%3Crect x='234' y='90' width='5' height='10'/%3E%3C/g%3E%3C/svg%3E"); }
@keyframes cc-sweep { from { background-position: 100% 0; } to { background-position: -50% 0; } }
/* Empty and unavailable: a glyph over the words, quiet for an empty market, the down colour for a failed read. */
.cc-notice[data-state='empty']::before, .cc-notice[data-state='unavailable']::before { content: ''; width: 28px; height: 28px; margin-bottom: 2px; background: var(--cc-faint); opacity: .7; -webkit-mask: var(--cc-glyph) center / contain no-repeat; mask: var(--cc-glyph) center / contain no-repeat; }
.cc-notice[data-state='empty'] { --cc-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4v20h20'/%3E%3Cpath d='M9 18v-4M14 18V9M19 18v-6' stroke-dasharray='2 2.5'/%3E%3C/svg%3E"); }
.cc-notice[data-state='unavailable'] { --cc-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='14' cy='14' r='10'/%3E%3Cpath d='M14 9v6M14 19h.01'/%3E%3C/svg%3E"); }
.cc-notice[data-state='unavailable']::before { background: var(--cc-down); opacity: .9; }

/* The chart's own buttons start bare, so a host without a reset does not paint them as form controls; zero specificity, so any host rule still wins. */
:where(.cc-root, .cc-layout) button { appearance: none; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }

.cc-tools { display: flex; align-items: center; gap: 2px; height: 32px; margin-bottom: 4px; padding: 0 2px; overflow-x: auto; scrollbar-width: none; font-family: var(--cc-font, var(--cc-ui-font)); box-shadow: inset 0 -1px 0 var(--cc-line); }
.cc-tools button { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 28px; height: var(--cc-ctl-h); padding: 0 6px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-size: 13px; font-weight: 500; line-height: 1; transition: background-color var(--cc-fast), color var(--cc-fast), transform var(--cc-fast) var(--cc-ease); }
.cc-tools button:hover:not(:disabled) { background: var(--cc-hover); color: var(--cc-ink); }
.cc-tools button:active:not(:disabled) { background: var(--cc-press); }
.cc-tools button[aria-pressed='true'], .cc-tools button[aria-expanded='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-tools button:disabled { opacity: 0.35; cursor: default; }
/* A host's study picker in the toolbar: its menu drops out of the row, which stops clipping while it is open. */
.cc-tools:has(.cc-study-menu) { overflow: visible; }
/* The toolbar's right end: undo and redo, settings, snapshot, full screen (TradingView's top-right). */
.cc-tools-end { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; margin-left: auto; padding-left: 8px; }
.cc-tool-group { display: inline-flex; align-items: center; flex: 0 0 auto; }
.cc-tools .cc-tool-caret { min-width: 12px; width: 12px; padding: 0; font-size: .55rem; color: var(--cc-faint); border-radius: 4px; }
.cc-tool-menu { position: absolute; top: 36px; z-index: 6; display: grid; min-width: 210px; padding: 4px; border-radius: 8px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); font-family: var(--cc-font, var(--cc-ui-font)); }
.cc-tool-menu-head { padding: 6px 8px 4px; color: var(--cc-faint); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cc-tool-menu button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 8px; border-radius: var(--cc-ctl-r); color: var(--cc-ink); font-size: 13px; font-weight: 450; text-align: left; transition: background-color .08s, color .08s; }
.cc-tool-menu button:hover { background: var(--cc-hover); }
.cc-tool-menu button[aria-pressed='true'] { color: var(--cc-on); }
.cc-tool-menu-glyph { color: var(--cc-dim); text-align: center; font-weight: 700; }
.cc-tool-menu kbd { color: var(--cc-faint); font: inherit; font-size: .66rem; }
.cc-tools-sep { flex: 0 0 1px; height: 18px; background: var(--cc-line2); margin: 0 6px; }
/* A phone (under 480 px): the drawing toolbar docked under the chart, one row that scrolls sideways, every target at least 40 px; its flyouts open upward from it. */
.cc-tools--dock { height: 48px; margin: 4px 0 0; padding: 0 4px; gap: 4px; overscroll-behavior-x: contain; border-top: 1px solid var(--cc-line); }
.cc-tools--dock button { min-width: 40px; height: 40px; font-size: .95rem; }
.cc-tools--dock .cc-tool-caret { min-width: 40px; width: 40px; height: 40px; font-size: .7rem; }
.cc-tools--dock .cc-tools-hint { display: none; }
.cc-dock > .cc-tool-menu:not(.cc-ctx-menu) { top: auto; bottom: 56px; max-height: 60%; overflow-y: auto; }
.cc-tool-menu-sep { height: 1px; margin: 4px 6px; background: var(--cc-line); }
.cc-tool-menu button[role='menuitemradio'][aria-checked='true'] { color: var(--cc-on); background: var(--cc-on-bg); }
.cc-tool-menu--side { min-width: 230px; }
.cc-type-menu { min-width: 190px; }
.cc-axis-menu { min-width: 230px; max-width: 320px; }
/* The right-click menu (ContextMenu.tsx), at the pointer. */
.cc-ctx-menu { z-index: 9; min-width: 220px; max-width: 300px; }
.cc-ctx-menu button:focus-visible, .cc-ctx-menu button:focus { outline: none; background: var(--cc-raise); }
.cc-ctx-menu button:disabled { opacity: .45; cursor: not-allowed; }
.cc-ctx-menu button > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-axis-menu button:disabled { opacity: .45; cursor: not-allowed; }
.cc-axis-menu button:disabled:hover { background: none; }
/* The row the axis menu acts at, held while the menu is open. */
.cc-axis-menu-mark { position: absolute; left: 0; height: 0; border-top: 1px dashed var(--cc-amber); pointer-events: none; z-index: 5; }
.cc-tools .cc-type-btn { display: inline-flex; gap: 2px; padding: 0 3px 0 6px; }
.cc-caret { flex: 0 0 auto; color: var(--cc-faint); transition: transform var(--cc-fast) var(--cc-ease), color var(--cc-fast); }
.cc-type-btn:hover .cc-caret { color: inherit; }
.cc-type-btn[aria-expanded='true'] .cc-caret { color: inherit; transform: rotate(180deg); }
/* The selected drawing's style bar (TradingView's floating drawing toolbar). */
.cc-draw-bar { position: absolute; z-index: 6; display: flex; align-items: center; gap: 1px; height: 30px; padding: 0 3px; border-radius: 7px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); }
.cc-draw-bar > button { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 26px; height: 24px; padding: 0 4px; border-radius: 5px; color: var(--cc-dim); }
.cc-draw-bar > button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-draw-bar > button[aria-pressed='true'], .cc-draw-bar > button[aria-expanded='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-draw-bar small { font-size: .62rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.cc-draw-pop { position: absolute; top: 34px; left: 0; display: flex; flex-wrap: wrap; gap: 2px; max-width: 220px; padding: 4px; border-radius: 7px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); }
.cc-draw-pop button { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 5px; color: var(--cc-dim); }
.cc-draw-pop button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-draw-pop button[aria-checked='true'] { background: var(--cc-raise); color: var(--cc-amber); box-shadow: inset 0 0 0 1px var(--cc-line2); }
/*
 * The drawing rail, its flyouts and the favourites bar: TradingView's left
 * toolbar. 28 px line icons in 36 x 32 buttons; an armed tool's icon in the
 * accent (`--cc-tool-on`, the series blue unless a host sets it), a toggle
 * that is on (magnet, stay in drawing mode, lock, hide) filled with it; a
 * chevron beside each group on hover; tooltips to the right.
 */
.cc-body--rail { display: flex; align-items: flex-start; }
.cc-root { --cc-tool-on: var(--cc-series); } /* a theme's `toolOn` overrides this on the root */
.cc-rail { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; box-sizing: border-box; border-right: 1px solid var(--cc-line); overflow-y: auto; scrollbar-width: none; }
.cc-rail button { flex: 0 0 auto; width: 36px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--cc-ctl-r); color: var(--cc-ink); font-size: .86rem; font-weight: 600; line-height: 1; transition: background-color var(--cc-fast), color var(--cc-fast); }
.cc-rail button:hover:not(:disabled) { background: var(--cc-hover); }
.cc-rail button[aria-pressed='true'] { color: var(--cc-tool-on); }
.cc-rail .cc-rail-toggle[aria-pressed='true'], .cc-rail .cc-rail-toggle[aria-pressed='true']:hover { background: var(--cc-tool-on); color: #fff; }
.cc-rail button:disabled { opacity: 0.35; }
.cc-rail .cc-tool-group { position: relative; display: flex; justify-content: center; width: 100%; }
/* The flyout chevron: a narrow tab at the rail's right edge, shown while its group is pointed at (always on touch). */
.cc-rail .cc-tool-caret { position: absolute; right: 0; top: 0; width: 10px; height: 32px; padding: 0; border-radius: 3px 0 0 3px; color: var(--cc-dim); opacity: 0; transition: opacity .12s; }
.cc-rail .cc-tool-group:hover .cc-tool-caret, .cc-rail .cc-tool-caret[aria-expanded='true'], .cc-rail .cc-tool-caret:focus-visible { opacity: 1; }
.cc-rail .cc-tool-caret:hover:not(:disabled), .cc-rail .cc-tool-caret[aria-expanded='true'] { background: var(--cc-raise); color: var(--cc-ink); }
@media (pointer: coarse) { .cc-rail .cc-tool-caret { opacity: 1; } }
.cc-icon { display: block; flex: 0 0 auto; }
.cc-tool-menu-glyph .cc-icon { margin: 0 auto; }
.cc-rail-sep { flex: 0 0 1px; width: 32px; height: 1px; background: var(--cc-line2); margin: 4px 0; }
.cc-tool-emoji { font-size: 20px; line-height: 1; }
.cc-tools .cc-tool-group > button { display: inline-grid; place-items: center; }
.cc-rail-tip { position: absolute; z-index: 12; pointer-events: none; padding: 6px 10px; border-radius: 6px; background: rgba(24, 27, 36, .96); color: #fff; font-size: 12.5px; font-weight: 500; line-height: 1.3; white-space: pre; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 6px 16px rgba(0, 0, 0, .32); }
/* A drawing flyout: section headers, then rows of icon, name, shortcut and a star on hover. */
.cc-tool-fly { min-width: 290px; padding: 4px 0 6px; border-radius: 6px; overflow-y: auto; scrollbar-width: thin; }
.cc-tool-fly .cc-tool-menu-head { padding: 12px 16px 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em; }
.cc-tool-fly .cc-tool-menu-head:first-child { padding-top: 8px; }
.cc-tool-fly .cc-tool-menu-sep { margin: 4px 0; background: var(--cc-line2); }
.cc-tool-row { position: relative; display: grid; }
.cc-tool-fly button[role='menuitem'], .cc-tool-fly button[role='menuitemradio'] { grid-template-columns: 28px 1fr auto; gap: 12px; height: 40px; padding: 0 44px 0 12px; border-radius: 0; font-size: 14px; font-weight: 400; }
.cc-tool-fly button[role='menuitem'][aria-pressed='true'] { color: inherit; }
.cc-tool-fly .cc-tool-menu-glyph { color: var(--cc-ink); }
.cc-tool-fly kbd { font-size: 12.5px; letter-spacing: .04em; }
.cc-tool-row[data-active] > button[role='menuitem'], .cc-tool-row[data-active] > button[role='menuitem']:hover { background: var(--cc-tool-on); color: #fff; }
.cc-tool-row[data-active] .cc-tool-menu-glyph, .cc-tool-row[data-active] kbd, .cc-tool-row[data-active] .cc-tool-star { color: #fff; }
.cc-tool-fly .cc-tool-star { position: absolute; right: 10px; top: 8px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 4px; color: var(--cc-faint); opacity: 0; }
.cc-tool-row:hover .cc-tool-star, .cc-tool-fly .cc-tool-star:focus-visible, .cc-tool-fly .cc-tool-star[aria-pressed='true'] { opacity: 1; }
.cc-tool-fly .cc-tool-star:hover { background: transparent; color: var(--cc-ink); }
.cc-tool-fly .cc-tool-star[aria-pressed='true'] { color: #ffca3b; }
.cc-tool-fly button[role='menuitemradio'][aria-checked='true'] { background: var(--cc-tool-on); color: #fff; }
.cc-emoji-grid { display: grid; grid-template-columns: repeat(6, 38px); gap: 2px; padding: 2px 10px 6px; }
.cc-tool-fly .cc-emoji-grid button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 4px; font-size: 22px; }
.cc-tool-fly .cc-emoji-grid button[aria-pressed='true'] { background: var(--cc-raise); box-shadow: inset 0 0 0 1px var(--cc-tool-on); }
/* The favourites bar: the starred tools, floating over the chart where the reader dragged it. */
.cc-fav-bar { position: absolute; z-index: 5; display: flex; align-items: center; gap: 1px; height: 38px; padding: 0 3px 0 0; border-radius: 6px; background: var(--cc-card2); box-shadow: inset 0 0 0 1px var(--cc-line2), 0 6px 18px rgba(0, 0, 0, .28); }
.cc-fav-grip { width: 14px; height: 24px; margin: 0 1px 0 3px; cursor: grab; touch-action: none; background: radial-gradient(circle, var(--cc-faint) 1px, transparent 1.5px) 0 0 / 5px 5px; opacity: .8; }
.cc-fav-bar button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 4px; color: var(--cc-ink); }
.cc-fav-bar button:hover { background: var(--cc-raise); }
.cc-fav-bar button[aria-pressed='true'] { color: var(--cc-tool-on); }
.cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 28px; padding: 0 2px; box-sizing: border-box; font-family: var(--cc-font, var(--cc-ui-font)); font-size: 12px; font-variant-numeric: tabular-nums; }
.cc-foot button { height: 24px; min-width: 28px; padding: 0 7px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-weight: 500; transition: background-color var(--cc-fast), color var(--cc-fast), transform var(--cc-fast) var(--cc-ease); }
.cc-foot button:hover:not(:disabled) { background: var(--cc-hover); color: var(--cc-ink); }
.cc-foot button:active:not(:disabled) { background: var(--cc-press); }
.cc-foot button[aria-pressed='true'], .cc-foot button[aria-expanded='true'] { color: var(--cc-on); background: transparent; }
.cc-foot button[aria-pressed='true']:hover { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-foot button:disabled { opacity: 0.35; }
.cc-foot-start, .cc-foot-end { display: flex; align-items: center; gap: 2px; min-width: 0; }
.cc-foot-end { margin-left: auto; }
.cc-foot-start { overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.cc-foot-end { flex: 0 0 auto; }
.cc-realtime { position: absolute; z-index: 3; width: 26px; height: 26px; border-radius: 50%; background: var(--cc-pop); color: var(--cc-ink); font-size: .9rem; font-weight: 600; line-height: 1; box-shadow: inset 0 0 0 1px var(--cc-pop-ring), 0 2px 8px rgba(0, 0, 0, .25); transition: background-color var(--cc-fast), color var(--cc-fast), transform var(--cc-fast) var(--cc-ease); }
.cc-realtime:hover { transform: translateX(1px); }
.cc-realtime:hover { background: var(--cc-raise); color: var(--cc-on); }
/* Back to the full series and autoscale, once a gesture has taken the view. */
.cc-root .cc-reset { position: absolute; font-size: .62rem; font-weight: 650; letter-spacing: .05em; color: var(--cc-dim); background: var(--cc-pop); border-radius: 999px; padding: 4px 10px; box-shadow: inset 0 0 0 1px var(--cc-pop-ring); }
.cc-root .cc-reset:hover { color: var(--cc-ink); background: var(--cc-raise); }
.cc-alert-note { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); max-width: 80%; padding: 5px 10px; border-radius: 6px; background: var(--cc-amber); color: #0c0a12; font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.cc-foot-style { height: 24px; padding: 0 4px; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-dim); font: inherit; font-weight: 500; cursor: pointer; }
.cc-foot-style:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-foot .cc-foot-icon { min-width: 28px; padding: 0; display: inline-grid; place-items: center; }
.cc-foot-clock { color: var(--cc-dim); margin: 0 4px; white-space: nowrap; }
.cc-tools-hint { flex: 0 1 auto; margin-left: 8px; color: var(--cc-faint); font-size: .7rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-marker-tip { position: absolute; z-index: 3; max-width: 240px; pointer-events: none; display: grid; gap: 3px; padding: 7px 9px; border-radius: 6px; background: rgba(var(--cc-bg-rgb), 0.94); box-shadow: inset 0 0 0 1px var(--cc-line); font-size: .7rem; font-weight: 700; line-height: 1.35; }
.cc-legend { position: absolute; left: 8px; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 1px; pointer-events: none; font-size: 12px; font-variant-numeric: tabular-nums; }
/* A row wider than the plot wraps its values under its name rather than running past the scale. */
.cc-legend-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 6px; width: max-content; max-width: 100%; box-sizing: border-box; padding: 1px 4px; border-radius: 4px; color: var(--cc-dim); pointer-events: auto; background: rgba(var(--cc-bg-rgb), .78); }
.cc-legend-row:hover { background: rgba(var(--cc-bg-rgb), .92); }
.cc-legend-row b { font-weight: 600; }
.cc-legend-row button { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; color: var(--cc-faint); line-height: 1; }
.cc-legend-row button:hover { color: var(--cc-ink); background: var(--cc-hover); }
/* A row's eye, gear, × and more (legend-ui.tsx): folded away until the row is hovered or focused; always out on touch. */
.cc-legend-act { display: inline-flex; gap: 1px; max-width: 0; margin-left: -6px; overflow: hidden; }
.cc-legend-row:hover .cc-legend-act, .cc-legend-row:focus-within .cc-legend-act, .cc-legend-act:has([aria-expanded='true']) { max-width: 100px; margin-left: 0; }
@media (pointer: coarse) { .cc-legend-act { max-width: 100px; margin-left: 0; } }
.cc-legend-grip { cursor: grab; touch-action: none; }
.cc-legend-ghost { position: fixed; z-index: 20; padding: 2px 6px; border-radius: 4px; background: var(--cc-card2); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font-size: .7rem; white-space: nowrap; pointer-events: none; }
.cc-legend-row[data-hidden] > :not(.cc-legend-act) { opacity: .45; }
.cc-legend--main .cc-legend-row { min-height: 16px; background: none; }
/* The price scale's A / L / %: shown while the chart is hovered or a button has focus, always on touch. This top is their
   place at the scale's head; at its foot the chart sets top inline. */
.cc-scale-btns { position: absolute; top: 2px; z-index: 3; display: flex; justify-content: center; gap: 2px; border-radius: 3px; background: rgb(var(--cc-bg-rgb)); opacity: 0; transition: opacity .12s; }
.cc-body:hover .cc-scale-btns, .cc-scale-btns:focus-within { opacity: 1; }
/* On touch the main legend's eye and ⋯ always show, 28px tall across the chart's top and onto a narrow chart's scale, so
   the buttons' head place is under that row (2 + 28 + 2px), with their 8px hit area above them clear of it too. */
@media (pointer: coarse) { .cc-scale-btns { opacity: 1; top: 40px; } }
.cc-scale-btns button { width: 16px; height: 16px; padding: 0; border-radius: 3px; background: rgba(var(--cc-bg-rgb), .86); color: var(--cc-faint); font-size: 10px; font-weight: 600; line-height: 16px; }
.cc-scale-btns button:hover:not(:disabled) { color: var(--cc-ink); background: var(--cc-raise); }
.cc-scale-btns button[aria-pressed='true'] { color: var(--cc-on); }
.cc-scale-btns button:disabled { opacity: .35; }
.cc-legend--pane { font-size: 11px; }
.cc-legend-fold { display: inline-flex; align-items: center; gap: 2px; width: max-content; padding: 1px 2px; border-radius: 4px; pointer-events: auto; background: rgba(var(--cc-bg-rgb), .78); }
.cc-legend-fold button { display: inline-grid; place-items: center; width: 18px; height: 16px; border-radius: 3px; color: var(--cc-dim); line-height: 1; }
.cc-legend-fold button:hover { color: var(--cc-ink); background: var(--cc-hover); }
.cc-legend-fold span { color: var(--cc-dim); padding-right: 3px; }
.cc-bubble-tip { position: absolute; z-index: 6; width: max-content; max-width: 300px; padding: 8px 12px; border-radius: 8px; background: var(--cc-card2); color: var(--cc-ink); box-shadow: 0 6px 20px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--cc-line2); font-size: 13px; line-height: 1.4; pointer-events: none; }
.cc-bubble-tip span { display: block; color: var(--cc-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.cc-trade { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; pointer-events: auto; }
.cc-trade button { display: inline-grid; justify-items: center; min-width: 64px; padding: 3px 8px; border-radius: 4px; color: var(--cc-tag-ink, #fff); font: inherit; font-weight: 600; font-size: 12px; line-height: 1.2; cursor: pointer; transition: filter .1s; }
.cc-trade button:hover { filter: brightness(1.12); }
.cc-trade button:focus-visible { outline: 2px solid var(--cc-series); outline-offset: 1px; }
.cc-trade small { font-size: 10px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.cc-trade-sell { background: var(--cc-down); }
.cc-trade-buy { background: var(--cc-series); }
.cc-trade-spread { color: var(--cc-dim); font-size: 11px; }
/* Study panes (pane-ui.tsx): the separator a reader drags, and each pane's corner buttons. */
.cc-pane-sep { position: absolute; left: 0; right: 0; z-index: 4; cursor: row-resize; touch-action: none; }
.cc-pane-sep::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--cc-accent); opacity: 0; transition: opacity .12s; }
.cc-pane-sep:hover::after, .cc-pane-sep:focus-visible::after, .cc-pane-sep--on::after { opacity: .7; }
.cc-pane-sep:focus-visible { outline: none; }
@media (pointer: coarse) { .cc-pane-sep { margin-top: -6px; padding-bottom: 12px; } }
.cc-pane-ctl { position: absolute; z-index: 4; display: flex; gap: 1px; padding: 1px; border-radius: 5px; background: rgba(var(--cc-bg-rgb), .86); opacity: 0; pointer-events: none; transition: opacity .12s; }
.cc-pane-ctl--on, .cc-pane-ctl:hover, .cc-pane-ctl:focus-within { opacity: 1; pointer-events: auto; }
.cc-pane-ctl button { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 4px; background: transparent; color: var(--cc-faint); cursor: pointer; }
.cc-pane-ctl button:hover { color: var(--cc-ink); background: var(--cc-hover); }
.cc-pane-ctl button[aria-pressed='true'] { color: var(--cc-ink); }
.cc-pane-ctl button:disabled { opacity: .35; cursor: default; background: transparent; }
.cc-legend-row button[aria-expanded='true'] { display: inline-grid; place-items: center; color: var(--cc-ink); }

/* Phones: a narrow footer is one row that scrolls sideways, as TradingView's
   mobile footer is (two rows cost the plot ~75px at 390px). The fade on the
   right says "more this way" without a scrollbar; the padding lets the last
   control come to rest clear of it. Keyed on the viewport as well as the
   chart's width, so a narrow multi-chart cell on a desktop keeps its one
   tight row. */
@media (max-width: 640px) {
  .cc-foot--narrow { height: 36px; padding: 0 20px 0 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
  .cc-foot--narrow::-webkit-scrollbar { display: none; }
  .cc-foot--narrow .cc-foot-start { flex: 0 0 auto; overflow: visible; }
  .cc-foot--narrow .cc-foot-end { flex: 0 0 auto; }
  .cc-foot--narrow button,
  .cc-foot--narrow .cc-foot-style { flex: 0 0 auto; height: 34px; min-width: 36px; font-size: .8rem; }
  .cc-foot--narrow .cc-foot-style { min-width: 0; padding: 0 8px; }
}

/* An empty chart whose read failed or was refused offers a retry. */
.cc-retry { margin-top: 6px; height: 30px; padding: 0 16px; border-radius: var(--cc-ctl-r); background: var(--cc-hover); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-pop-ring); font-size: 12px; font-weight: 600; cursor: pointer; transition: background-color var(--cc-fast); }
.cc-retry:hover { background: var(--cc-press); }

/* The f(x) button and its Indicators dialog (`@ftw-trade/charts/studies`, StudyPicker.tsx), as TradingView's. */
.cc-study-picker { position: relative; display: inline-block; }
.cc-fx { display: inline-flex; align-items: center; gap: 0; height: var(--cc-ctl-h); padding: 0 10px; white-space: nowrap; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-ink); font: inherit; font-family: var(--cc-font, var(--cc-ui-font)); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .1s; }
.cc-fx:hover { background: var(--cc-hover); }
.cc-fx[aria-expanded="true"] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-fx i { margin-right: 1px; font-family: Georgia, 'Times New Roman', serif; font-size: 15px; font-weight: 400; }
.cc-study-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.cc-study-modal { display: flex; flex-direction: column; width: min(760px, 100%); height: min(640px, calc(100vh - 32px)); overflow: hidden; border-radius: 10px; background: var(--cc-card2); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2), 0 24px 60px rgba(0, 0, 0, .5); font-size: 14px; text-align: left; }
.cc-study-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px 24px; }
.cc-study-top h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.cc-study-top .cc-study-x { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; box-shadow: none; border-radius: 6px; background: transparent; color: var(--cc-dim); cursor: pointer; }
.cc-study-top .cc-study-x:hover { background: var(--cc-raise); color: var(--cc-ink); }
.cc-study-searchbar { display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 52px; box-shadow: inset 0 1px 0 var(--cc-line2), inset 0 -1px 0 var(--cc-line2); color: var(--cc-faint); cursor: text; }
.cc-study-search { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--cc-ink); font: inherit; font-size: 17px; outline: none; }
.cc-study-search::placeholder { color: var(--cc-faint); }
.cc-study-search::-webkit-search-cancel-button { filter: grayscale(1); }
.cc-study-body { flex: 1; min-height: 0; display: flex; }
.cc-study-groups { flex: 0 0 196px; display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; overflow-y: auto; box-shadow: inset -1px 0 0 var(--cc-line2); }
.cc-study-modal .cc-study-groups button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; box-shadow: none; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--cc-dim); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.cc-study-modal .cc-study-groups button:hover { background: var(--cc-raise); color: var(--cc-ink); }
.cc-study-modal .cc-study-groups button[aria-selected="true"] { background: var(--cc-raise); color: var(--cc-ink); font-weight: 600; }
.cc-study-groups i { color: var(--cc-faint); font-style: normal; font-size: 11px; font-variant-numeric: tabular-nums; }
.cc-study-sep { margin: 10px 10px 4px; color: var(--cc-faint); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.cc-study-sep:empty { height: 1px; margin: 8px 6px; background: var(--cc-line2); }
.cc-study-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cc-study-head { padding: 14px 24px 6px 54px; color: var(--cc-faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.cc-study-list { flex: 1; min-height: 0; margin: 0; padding: 0 8px 8px; list-style: none; overflow-y: auto; }
.cc-study-list li[role="option"] { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px; border-radius: 6px; cursor: pointer; }
.cc-study-list li[aria-selected="true"] { background: var(--cc-raise); }
.cc-study-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.cc-study-short { flex: 0 0 auto; color: var(--cc-faint); font-size: 12px; }
.cc-study-editor .cc-study-added { flex: 0 0 auto; color: var(--cc-up); font-size: 12px; font-weight: 600; }
.cc-study-list .cc-study-star { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; box-shadow: none; border-radius: 5px; background: transparent; color: var(--cc-faint); cursor: pointer; opacity: 0; }
.cc-study-list li[aria-selected="true"] .cc-study-star, .cc-study-list .cc-study-star[aria-pressed="true"], .cc-study-list .cc-study-star:focus-visible { opacity: 1; }
.cc-study-list li .cc-study-star[aria-pressed="true"] { color: var(--cc-amber); }
.cc-study-list .cc-study-star:hover { color: var(--cc-amber); }
.cc-study-none { padding: 24px 16px; color: var(--cc-faint); }
.cc-study-about { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 24px; box-shadow: inset 0 1px 0 var(--cc-line2); color: var(--cc-faint); font-size: 12px; }
.cc-study-about b { flex: 0 0 auto; color: var(--cc-ink); font-weight: 600; }
.cc-study-about > span:not(.cc-study-keys) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cc-dim); }
.cc-study-keys { flex: 0 0 auto; margin-left: auto; }
.cc-study-about kbd { padding: 1px 5px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; font-size: 11px; }
.cc-study-editor { display: grid; align-content: start; gap: 10px; padding: 16px 24px; overflow-y: auto; }
.cc-study-editor textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.cc-study-editor textarea:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cc-series); }
.cc-study-diag { margin: 0; padding: 0; list-style: none; }
.cc-study-diag li { display: grid; gap: 2px; padding: 4px 0; color: var(--cc-down); font-size: 12px; }
.cc-study-diag pre { margin: 0; color: var(--cc-dim); font-size: 12px; white-space: pre; overflow-x: auto; }
.cc-study-editor .cc-study-add { justify-self: start; height: 32px; padding: 0 16px; border: 0; border-radius: 6px; background: var(--cc-series); color: var(--cc-tag-ink, #fff); font: inherit; font-weight: 650; cursor: pointer; }
.cc-study-editor .cc-study-add:disabled { opacity: .4; cursor: default; }
.cc-study-tpls { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cc-study-tpl-save { display: flex; gap: 8px; padding: 16px 24px 4px; }
.cc-study-tpl-save input { flex: 1; min-width: 0; height: 32px; box-sizing: border-box; padding: 0 10px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; font-size: 13px; }
.cc-study-tpl-save input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cc-series); }
.cc-study-modal .cc-study-tpl-save .cc-study-add { flex: 0 0 auto; height: 32px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--cc-series); color: var(--cc-tag-ink, #fff); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.cc-study-tpl-save .cc-study-add:disabled { opacity: .4; cursor: default; }
.cc-study-tpl-note { margin: 0; padding: 4px 24px 8px; color: var(--cc-faint); font-size: 12px; }
.cc-study-tpl { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.cc-study-tpl:hover { background: var(--cc-raise); }
.cc-study-modal .cc-study-tpl .cc-study-star { opacity: 1; font-size: 16px; }
.cc-study-modal .cc-study-tpl-apply { flex: 1; height: auto; min-height: 44px; justify-content: center; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 12px; border: 0; box-shadow: none; background: transparent; color: var(--cc-ink); font: inherit; text-align: left; cursor: pointer; }
.cc-study-tpl-apply .cc-study-name { width: 100%; font-size: 14px; }
.cc-study-tpl-apply .cc-study-short { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 640px) {
  .cc-study-backdrop { padding: 0; }
  .cc-study-modal { width: 100%; height: 100%; border-radius: 0; }
  .cc-study-body { flex-direction: column; }
  .cc-study-main { min-height: 0; }
  .cc-study-groups { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 8px 16px; overflow-x: auto; box-shadow: inset 0 -1px 0 var(--cc-line2); }
  .cc-study-modal .cc-study-groups button { flex: 0 0 auto; min-height: 30px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--cc-line2); white-space: nowrap; }
  .cc-study-modal .cc-study-groups button[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--cc-dim); }
  .cc-study-sep { display: none; }
  .cc-study-head { padding-left: 46px; }
  .cc-study-list .cc-study-star { opacity: 1; }
  .cc-study-keys { display: none; }
}
/* A study's settings dialog (study-inputs.tsx, the legend row's gear): Inputs and Style, as TradingView's. */
.cc-study-backdrop { pointer-events: auto; font-variant-numeric: normal; }
.cc-study-settings { display: flex; flex-direction: column; width: min(520px, 100%); max-height: min(620px, calc(100vh - 32px)); overflow: hidden; border-radius: 10px; background: var(--cc-card2); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2), 0 24px 60px rgba(0, 0, 0, .5); font-size: 13px; text-align: left; }
.cc-study-settings .cc-study-top { padding: 14px 12px 8px 20px; }
.cc-study-settings .cc-study-top h2 { font-size: 17px; }
.cc-ss-tabs { display: flex; gap: 18px; padding: 0 20px; box-shadow: inset 0 -1px 0 var(--cc-line2); }
.cc-ss-tabs button { height: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--cc-dim); font: inherit; font-weight: 600; cursor: pointer; }
.cc-ss-tabs button:hover { color: var(--cc-ink); }
.cc-ss-tabs button[aria-selected="true"] { color: var(--cc-ink); box-shadow: inset 0 -2px 0 var(--cc-series); }
.cc-ss-body { flex: 1; min-height: 120px; padding: 14px 20px; overflow-y: auto; }
.cc-ss-grid { display: grid; gap: 10px; }
.cc-ss-grid label { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 12px; color: var(--cc-dim); }
.cc-study-settings input[type="number"], .cc-study-settings select { box-sizing: border-box; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; font-variant-numeric: tabular-nums; color-scheme: dark light; }
.cc-study-settings input[type="number"]:focus, .cc-study-settings select:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cc-series); }
.cc-study-settings [aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--cc-down); }
.cc-study-settings select:disabled { opacity: .4; }
.cc-ss-group { margin: 6px 0 -2px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cc-faint); }
.cc-ss-grid input[type="checkbox"] { justify-self: start; margin: 0; accent-color: var(--cc-series); }
.cc-ss-none { margin: 4px 0; color: var(--cc-faint); }
.cc-ss-style { display: grid; gap: 8px; }
.cc-plot-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px 74px 88px 104px; align-items: center; gap: 6px; }
.cc-plot-row[data-off] .cc-plot-name span { color: var(--cc-faint); }
.cc-plot-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cc-plot-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-plot-name input { flex: 0 0 auto; margin: 0; accent-color: var(--cc-series); }
.cc-plot-row input[type="color"] { width: 34px; height: 28px; padding: 2px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); box-shadow: inset 0 0 0 1px var(--cc-line2); cursor: pointer; }
.cc-levels { display: grid; gap: 6px; margin-top: 10px; padding-top: 12px; box-shadow: inset 0 1px 0 var(--cc-line2); }
.cc-levels-head { display: flex; align-items: center; justify-content: space-between; color: var(--cc-dim); font-weight: 600; }
.cc-levels-head button, .cc-level-row button, .cc-ss-foot button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; box-shadow: inset 0 0 0 1px var(--cc-line2); color: var(--cc-ink); font: inherit; cursor: pointer; }
.cc-levels-head button:hover, .cc-level-row button:hover, .cc-ss-foot button:hover:not(:disabled) { background: var(--cc-raise); }
.cc-level-row { display: grid; grid-template-columns: 160px auto; justify-content: start; gap: 8px; }
.cc-ss-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; box-shadow: inset 0 1px 0 var(--cc-line2); }
.cc-ss-foot span { flex: 1; }
.cc-ss-foot .cc-ss-ok { background: var(--cc-series); box-shadow: none; color: var(--cc-tag-ink, #fff); font-weight: 650; }
.cc-ss-foot .cc-ss-ok:hover:not(:disabled) { background: var(--cc-series); filter: brightness(1.1); }
.cc-ss-foot button:disabled { opacity: .4; cursor: default; }
@media (max-width: 520px) {
  .cc-plot-row { grid-template-columns: 34px repeat(3, minmax(0, 1fr)); }
  .cc-plot-name { grid-column: 1 / -1; }
  .cc-ss-grid label { grid-template-columns: 1fr 120px; }
}
/* The TradingView-compatible widget's header: symbol and resolution. */
.cc-tv-header { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.cc-tv-sep { flex: 0 0 1px; height: 16px; margin: 0 5px; background: var(--cc-line); }
.cc-tv-search { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 6px; color: var(--cc-dim); cursor: text; }
.cc-tv-search:hover, .cc-tv-search:focus-within { background: var(--cc-hover); color: var(--cc-ink); }
.cc-tv-symbol { width: 9ch; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--cc-ink); font: inherit; font-size: .82rem; font-weight: 700; }
strong.cc-tv-symbol { width: auto; padding: 0 6px; white-space: nowrap; }
.cc-tv-res { display: inline-flex; align-items: center; gap: 1px; }
.cc-tools .cc-tv-res button, .cc-tools .cc-tv-replay { min-width: 28px; height: 26px; padding: 0 6px; font-size: .8rem; font-weight: 500; color: var(--cc-dim); }
.cc-tools .cc-tv-res button[aria-pressed='true'] { background: transparent; color: var(--cc-on); font-weight: 600; }
.cc-tools .cc-tv-replay { display: inline-flex; align-items: center; gap: 5px; }
.cc-tv-more { position: relative; display: inline-grid; place-items: center; width: 18px; height: 26px; border-radius: 6px; color: var(--cc-faint); font-size: .6rem; }
.cc-tv-more:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-tv-more select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Replay bar (ReplayControls.tsx), in the footer's left end. */
.cc-replay { display: inline-flex; align-items: center; gap: 4px; }
.cc-replay-btn { height: 24px; min-width: 26px; padding: 0 6px; border: 0; border-radius: var(--cc-ctl-r); background: var(--cc-hover); color: var(--cc-ink); font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; }
.cc-replay-btn:disabled { opacity: .4; cursor: default; }
.cc-replay-on { color: var(--cc-accent); }
.cc-replay-speed { height: 24px; padding: 0 2px; border: 0; border-radius: var(--cc-ctl-r); background: var(--cc-hover); color: var(--cc-ink); font: inherit; font-size: .7rem; font-weight: 700; }
.cc-replay-scrub { width: 140px; accent-color: var(--cc-accent); }
.cc-replay-at { font-size: .7rem; color: var(--cc-dim); font-variant-numeric: tabular-nums; }

/* Multi-chart layouts (ChartLayout.tsx). */
.cc-layout { display: flex; flex-direction: column; gap: 4px; font-family: var(--cc-font, var(--cc-ui-font)); color: var(--cc-ink); }
.cc-layout-bar { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; padding: 0 2px; overflow-x: auto; scrollbar-width: none; }
.cc-layout-group { display: flex; align-items: center; gap: 2px; }
.cc-layout-label { color: var(--cc-faint); font-size: 12px; font-weight: 500; margin: 0 4px 0 2px; }
.cc-layout-bar button { display: inline-flex; align-items: center; justify-content: center; height: var(--cc-ctl-h); min-width: 28px; padding: 0 10px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color .1s, color .1s; }
.cc-layout-bar button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-layout-bar button:active { background: var(--cc-press); }
.cc-layout-bar button[aria-pressed='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
/* The grid picker: one segmented track of icons, the chosen one raised. */
.cc-layout-seg { padding: 2px; border-radius: calc(var(--cc-ctl-r) + 2px); background: color-mix(in srgb, var(--cc-ink) 5%, transparent); }
.cc-layout-bar .cc-layout-seg button { min-width: 30px; height: 24px; padding: 0 7px; border-radius: var(--cc-ctl-r); }
.cc-layout-bar .cc-layout-seg button[aria-pressed='true'] { background: var(--cc-raise); color: var(--cc-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 0 0 1px var(--cc-pop-ring); }
/* The sync links: quiet chips, the accent when on, a dot that fills. */
.cc-layout-bar .cc-layout-chip { gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 999px; }
.cc-layout-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .7; }
.cc-layout-chip[aria-pressed='true']::before { background: currentColor; opacity: 1; }
.cc-layout-grid { display: grid; flex: 1 1 auto; min-height: 0; }
.cc-layout-cell { position: relative; min-width: 0; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--cc-line2); overflow: hidden; }
/* The active cell: a ring in the accent drawn over the chart (the cell's own inset ring sits under its canvas), and a lit dot in its header. */
.cc-layout-cell::after { content: ''; position: absolute; inset: 0; z-index: 15; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--cc-line2); pointer-events: none; transition: box-shadow var(--cc-fast, .12s); }
.cc-layout-cell--active::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cc-on) 70%, transparent), inset 0 0 0 3px color-mix(in srgb, var(--cc-on) 14%, transparent); }
.cc-layout-head { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 10px; font-size: 12px; background: color-mix(in srgb, var(--cc-ink) 2.5%, transparent); box-shadow: inset 0 -1px 0 var(--cc-line); }
.cc-layout-head::before { content: ''; flex: 0 0 auto; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--cc-line2); transition: background-color var(--cc-fast, .12s), box-shadow var(--cc-fast, .12s); }
.cc-layout-cell--active .cc-layout-head::before { background: var(--cc-on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc-on) 22%, transparent); }
.cc-layout-head select { height: 22px; padding: 0 6px; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cc-layout-head select:hover { background: var(--cc-hover); }
.cc-layout-head select option { background: var(--cc-card2); color: var(--cc-ink); }
.cc-layout-head select + select { color: var(--cc-dim); font-weight: 500; }
.cc-layout-gear { display: grid; place-items: center; width: 22px; height: 22px; margin-left: auto; border-radius: var(--cc-ctl-r); color: var(--cc-dim); }
.cc-layout-gear:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-layout-gear[aria-expanded='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
/* A touch screen: the pickers, the gear and the layout bar's buttons at a thumb's size (ChartLayout's head and bar grow to 40px with them). */
@media (pointer: coarse) {
  .cc-layout-head select { height: 36px; font-size: 14px; }
  .cc-layout-gear { width: 36px; height: 36px; }
  .cc-layout-bar button { height: 36px; min-width: 36px; }
  .cc-layout-bar .cc-layout-seg button { height: 32px; min-width: 36px; }
  .cc-layout-bar .cc-layout-chip { height: 32px; }
}
.cc-layout-err { color: var(--cc-down); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Go to date (Alt+G): a small form over the plot's bottom-right corner. */
.cc-goto { position: absolute; z-index: 7; right: 8px; bottom: 30px; display: flex; align-items: flex-end; gap: 6px; padding: 8px; border-radius: 8px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); font-size: .74rem; }
.cc-goto label { display: grid; gap: 4px; color: var(--cc-dim); font-weight: 600; }
.cc-goto small { color: var(--cc-faint); font-weight: 500; }
.cc-goto input { height: 26px; padding: 0 6px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line); font: inherit; color-scheme: dark light; }
.cc-goto input[aria-invalid='true'] { box-shadow: inset 0 0 0 1px var(--cc-down); }
.cc-goto button { height: 28px; padding: 0 14px; border-radius: var(--cc-ctl-r); background: var(--cc-ink); color: var(--cc-pop); font-weight: 600; }
.cc-goto button:hover { background: var(--cc-dim); }
/* The watermark: the symbol and interval, faint, centred behind the candles. */
.cc-watermark { position: absolute; left: 0; top: 0; display: grid; place-items: center; overflow: hidden; color: var(--cc-watermark); opacity: .07; font-weight: 700; letter-spacing: .02em; white-space: nowrap; pointer-events: none; user-select: none; }

/* Chart settings (SettingsPanel.tsx): TradingView's dialog, inside the chart. */
.cc-settings { position: absolute; right: 8px; z-index: 12; display: flex; flex-direction: column; width: min(620px, calc(100% - 16px)); max-height: min(540px, calc(100% - 40px)); min-height: 220px; border-radius: 12px; background: var(--cc-pop); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), 0 2px 4px rgba(0, 0, 0, .2), 0 24px 64px rgba(0, 0, 0, .45); font-family: var(--cc-font, var(--cc-ui-font)); font-size: 13px; overflow: hidden; }
/* TradingView's dialog stands in the middle of the chart. */
.cc-settings:not(.cc-dset) { right: 50%; translate: 50% 0; }
.cc-settings-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 12px 20px; box-shadow: inset 0 -1px 0 var(--cc-line); font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.cc-settings-x { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-size: 1.25rem; font-weight: 300; line-height: 1; }
.cc-settings-x:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-settings-main { display: flex; flex: 1 1 auto; min-height: 0; }
.cc-settings-nav { flex: 0 0 168px; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; box-shadow: inset -1px 0 0 var(--cc-line); }
.cc-settings-nav button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-weight: 500; text-align: left; white-space: nowrap; transition: background-color .1s, color .1s; }
.cc-settings-nav button svg { flex: 0 0 auto; opacity: .85; }
.cc-settings-nav button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-settings-nav button[aria-selected='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-settings-nav button[aria-selected='true'] svg { opacity: 1; }
.cc-settings-body { flex: 1 1 auto; min-width: 0; padding: 4px 20px 16px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--cc-line2) transparent; }
.cc-settings-group { margin: 16px 0 6px; color: var(--cc-faint); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.cc-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.cc-settings-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--cc-ink); }
.cc-settings-row label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.cc-settings-ctl { display: inline-flex; align-items: center; gap: 6px; }
.cc-settings-note { margin: 12px 0 0; color: var(--cc-faint); font-size: 12px; line-height: 1.5; }
/* Drawn from the chart's tokens, so a light chart on a dark page (or the reverse) does not get the page's checkboxes. */
.cc-settings input[type='checkbox'] { appearance: none; position: relative; flex: 0 0 auto; width: 16px; height: 16px; margin: 0; border-radius: 4px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--cc-faint); cursor: pointer; transition: background-color .1s, box-shadow .1s; }
.cc-settings input[type='checkbox']:hover { box-shadow: inset 0 0 0 1.5px var(--cc-dim); }
.cc-settings input[type='checkbox']:checked { background: var(--cc-on); box-shadow: none; }
.cc-settings input[type='checkbox']:checked::after { content: ''; position: absolute; left: 5.5px; top: 2.5px; width: 3px; height: 7px; border: solid var(--cc-pop); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cc-settings input[type='checkbox']:focus-visible { outline: none; box-shadow: var(--cc-focus-ring); }
.cc-settings input[type='color'] { width: 30px; height: 26px; padding: 0; border: 0; border-radius: var(--cc-ctl-r); background: none; box-shadow: inset 0 0 0 1px var(--cc-line2); cursor: pointer; }
.cc-settings input[type='color']:hover { box-shadow: inset 0 0 0 1px var(--cc-faint); }
.cc-settings input[type='color']::-webkit-color-swatch-wrapper { padding: 4px; }
.cc-settings input[type='color']::-webkit-color-swatch { border: 0; border-radius: 3px; }
.cc-settings input[type='color']::-moz-color-swatch { border: 0; border-radius: 3px; }
.cc-settings input[type='color']:disabled { opacity: .35; cursor: default; }
.cc-settings input[type='text'], .cc-settings input[type='number'], .cc-settings select { height: 30px; padding: 0 10px; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; transition: box-shadow .1s; }
.cc-settings select { padding-right: 6px; cursor: pointer; }
.cc-settings select option { background: var(--cc-pop); color: var(--cc-ink); }
.cc-settings input[type='text']:hover, .cc-settings input[type='number']:hover, .cc-settings select:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--cc-faint); }
.cc-settings :is(input, select):disabled { opacity: .4; cursor: default; }
.cc-settings input[type='number'] { width: 72px; font-variant-numeric: tabular-nums; }
.cc-settings input[type='text'] { width: 160px; }
.cc-settings input:focus-visible, .cc-settings select:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--cc-on), var(--cc-focus-ring); }
.cc-settings-undo { width: 22px; height: 22px; border-radius: var(--cc-ctl-r); color: var(--cc-faint); font-size: .8rem; line-height: 1; }
.cc-settings-undo:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-settings-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: calc(var(--cc-ctl-r) + 2px); background: color-mix(in srgb, var(--cc-ink) 6%, transparent); }
.cc-settings-seg button { height: 26px; padding: 0 12px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-weight: 500; white-space: nowrap; transition: background-color .1s, color .1s; }
.cc-settings-seg button:hover:not(:disabled) { color: var(--cc-ink); }
.cc-settings-seg button[aria-pressed='true'] { background: var(--cc-raise); color: var(--cc-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .22), inset 0 0 0 1px var(--cc-pop-ring); }
.cc-settings-seg button:disabled { opacity: .35; cursor: default; }
/* The Canvas tab's theme presets: a swatch of each, the one in use ringed in the accent. */
.cc-settings-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin: 4px 0 2px; }
.cc-settings-themes button { display: grid; gap: 6px; padding: 6px; border-radius: 8px; color: var(--cc-dim); font-size: 12px; text-align: left; }
.cc-settings-themes button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-settings-themes button[aria-checked='true'] { color: var(--cc-on); }
.cc-settings-themes button[aria-checked='true'] .cc-settings-theme { outline: 2px solid var(--cc-on); outline-offset: 1px; }
.cc-settings-themes button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-settings-theme { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 40px; padding-bottom: 9px; box-sizing: border-box; border-radius: 6px; }
.cc-settings-theme i { width: 6px; border-radius: 1px; }
.cc-settings-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 12px 20px; box-shadow: inset 0 1px 0 var(--cc-line); }
.cc-settings-foot .cc-settings-ctl { gap: 8px; min-width: 0; flex-wrap: wrap; }
.cc-settings-foot select { min-width: 0; max-width: 100%; }
.cc-settings-btn { white-space: nowrap; height: 32px; padding: 0 14px; border-radius: var(--cc-ctl-r); color: var(--cc-ink); font-weight: 500; box-shadow: inset 0 0 0 1px var(--cc-line2); transition: background-color .1s, box-shadow .1s; }
.cc-settings-btn:hover:not(:disabled) { background: var(--cc-hover); box-shadow: inset 0 0 0 1px var(--cc-faint); }
.cc-settings-btn:disabled { opacity: .45; cursor: default; }
.cc-settings-btn--primary { margin-left: auto; min-width: 72px; background: var(--cc-ink); color: var(--cc-pop); box-shadow: none; font-weight: 600; }
.cc-settings-btn--primary:hover:not(:disabled) { background: var(--cc-dim); box-shadow: none; }
/* A narrow chart stacks the section tabs over the form. */
.cc-settings--narrow .cc-settings-main { flex-direction: column; }
.cc-settings--narrow .cc-settings-nav { flex: 0 0 auto; flex-direction: row; overflow-x: auto; box-shadow: inset 0 -1px 0 var(--cc-line); scrollbar-width: none; }
.cc-settings--narrow .cc-settings-nav button { flex: 0 0 auto; }
.cc-settings--narrow .cc-settings-nav button svg { display: none; }

/* The object tree and data window: a column inside the chart, clear of the
   price axis; on a phone-width chart, a sheet over its bottom. */
.cc-objects { position: absolute; z-index: 11; display: flex; flex-direction: column; width: min(270px, calc(100% - 16px)); min-height: 160px; border-radius: 10px; background: var(--cc-pop); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); font-size: .75rem; overflow: hidden; }
.cc-objects--sheet { left: 8px; right: 8px; width: auto; max-height: 58%; }
.cc-objects-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 0 8px; border-bottom: 1px solid var(--cc-line); }
.cc-objects-head [role='tab'] { height: 30px; padding: 0 8px; color: var(--cc-dim); font-weight: 650; }
.cc-objects-head [role='tab'][aria-selected='true'] { color: var(--cc-ink); box-shadow: inset 0 -2px 0 var(--cc-accent); }
.cc-objects-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.cc-obj-list { margin: 0; padding: 0; list-style: none; }
.cc-obj-row { display: flex; align-items: center; gap: 2px; min-height: 30px; padding: 0 6px 0 10px; }
.cc-obj-row:hover { background: var(--cc-hover); }
.cc-obj-row[aria-selected='true'] { background: var(--cc-on-bg); }
.cc-obj-row[aria-selected='true'] { box-shadow: inset 2px 0 0 var(--cc-accent); }
.cc-obj-row--sub { padding-left: 26px; color: var(--cc-dim); }
.cc-obj-row[data-hidden] .cc-obj-name { opacity: .45; }
.cc-obj-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; text-align: left; color: inherit; }
.cc-obj-row > button:not(.cc-obj-name) { flex: 0 0 auto; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--cc-faint); }
.cc-obj-row > button:not(.cc-obj-name):hover, .cc-obj-row > button[aria-pressed='true'] { color: var(--cc-ink); }
.cc-obj-row > button:not(.cc-obj-name):hover { background: var(--cc-hover); }
.cc-obj-swatch { flex: 0 0 auto; display: inline-block; width: 10px; height: 3px; border-radius: 2px; background: var(--cc-line2); }
.cc-obj-data dl { margin: 0 0 4px; padding: 0 12px; }
.cc-obj-group { margin: 8px 0 2px; color: var(--cc-faint); font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cc-obj-datum { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; }
.cc-obj-datum dt { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--cc-dim); white-space: nowrap; text-overflow: ellipsis; }
.cc-obj-datum dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Number fields: the browser's spinner arrows hidden everywhere the chart draws a form (they ignore the theme and crowd a 72px field); the settings dialog's own stepper (`Num`, SettingsPanel.tsx) takes their place. */
:where(.cc-root, .cc-layout, .cc-study-backdrop) input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
:where(.cc-root, .cc-layout, .cc-study-backdrop) input[type='number']::-webkit-inner-spin-button,
:where(.cc-root, .cc-layout, .cc-study-backdrop) input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cc-num { position: relative; display: inline-flex; flex: 0 0 auto; }
.cc-settings .cc-num input[type='number'] { padding-right: 24px; }
.cc-num-step { position: absolute; top: 4px; right: 4px; bottom: 4px; display: flex; flex-direction: column; gap: 1px; width: 16px; }
.cc-num-step button { flex: 1 1 0; display: grid; place-items: center; min-height: 0; padding: 0; border-radius: 3px; color: var(--cc-faint); transition: background-color var(--cc-fast), color var(--cc-fast); }
.cc-num-step button:hover:not(:disabled) { background: var(--cc-hover); color: var(--cc-ink); }
.cc-num-step button:active:not(:disabled) { background: var(--cc-press); }
.cc-num-step button:disabled { opacity: .35; cursor: default; }

/* Axis borders, pane separators and the crosshair are hairlines: kept on the
   device pixel grid so they read 1px sharp at any zoom and DPR. */
.cc-hair { shape-rendering: crispEdges; }

/* The settings dialog's Template menu: saved templates, preset themes, JSON export and import. */
.cc-tpl-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; padding: 0 10px 0 12px; }
.cc-tpl-label { overflow: hidden; text-overflow: ellipsis; }
.cc-settings-foot { position: relative; }
.cc-tpl-menu { position: absolute; left: 12px; bottom: calc(100% + 4px); z-index: 2; display: flex; flex-direction: column; width: min(280px, calc(100% - 24px)); max-height: 360px; padding: 4px; overflow-y: auto; border-radius: 8px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); scrollbar-width: thin; }
.cc-tpl-menu button { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 28px; padding: 0 8px; border-radius: 6px; color: var(--cc-ink); font-weight: 550; text-align: left; }
.cc-tpl-menu button:hover { background: var(--cc-hover); }
.cc-tpl-menu button[aria-checked='true'] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-tpl-head { margin: 8px 8px 2px; color: var(--cc-faint); font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cc-tpl-row { display: flex; align-items: center; }
.cc-tpl-row > button:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tpl-menu .cc-tpl-icon { justify-content: center; width: 26px; padding: 0; color: var(--cc-faint); }
.cc-tpl-menu .cc-tpl-icon:hover { color: var(--cc-ink); }
.cc-tpl-swatch { display: inline-flex; align-items: center; justify-content: center; gap: 2px; width: 22px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-tpl-swatch i { width: 4px; height: 9px; border-radius: 1px; }
.cc-tpl-save { display: flex; gap: 6px; padding: 4px; }
.cc-settings .cc-tpl-save input[type='text'] { flex: 1 1 auto; width: auto; min-width: 0; }
.cc-tpl-menu .cc-tpl-save button { justify-content: center; padding: 0 12px; box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-tpl-menu button:disabled { opacity: .4; cursor: default; }
.cc-tpl-note { padding: 2px 8px 4px; color: var(--cc-dim); font-size: .7rem; }
.cc-tpl-sep { flex: 0 0 1px; margin: 4px 6px; background: var(--cc-line); }

/* A drawing's settings dialog (DrawingSettings.tsx): the chart settings' look, centred over the chart, modal. */
.cc-dset-scrim { position: absolute; inset: 0; z-index: 14; display: grid; place-items: center; padding: 8px; background: rgba(0, 0, 0, .22); }
.cc-settings.cc-dset { position: relative; right: auto; width: min(400px, 100%); max-height: min(460px, 100%); min-height: 0; }
.cc-dset:focus { outline: none; }
.cc-dset .cc-settings-body { min-height: 150px; }
.cc-dset-swatches { display: inline-flex; flex-wrap: wrap; gap: 1px; max-width: 170px; }
.cc-dset-swatches button { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; }
.cc-dset-swatches button[aria-pressed='true'] { background: var(--cc-raise); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-dset-swatches .cc-swatch { width: 12px; height: 12px; }
.cc-dset-levels .cc-settings-row { min-height: 30px; }
.cc-dset-actions { display: flex; gap: 8px; margin-top: 8px; }
.cc-dset-note { color: var(--cc-dim); }
.cc-dset-range { display: inline-flex; align-items: center; gap: 4px; color: var(--cc-dim); }
.cc-settings .cc-dset-range input[type='number'] { width: 56px; padding: 0 8px; text-align: right; }
.cc-dset-range input:disabled { opacity: .45; }
.cc-dset input[aria-invalid='true'] { box-shadow: inset 0 0 0 1px var(--cc-down); }
.cc-dset-tpl .cc-tpl-save { padding: 0; }
.cc-dset-tpl .cc-tpl-save input[type='text'] { width: 120px; }
@media (pointer: coarse) {
  .cc-dset .cc-settings-nav button, .cc-dset .cc-settings-btn, .cc-dset .cc-settings-seg button { min-height: 34px; }
  .cc-dset-swatches button { width: 28px; height: 28px; }
  .cc-dset input[type='checkbox'] { width: 20px; height: 20px; }
}
/* A note's words typed in place (TextEditor.tsx): the box in the note's own type, sized to its words, and its style bar. */
.cc-note-edit { position: absolute; left: 0; top: 0; z-index: 7; }
.cc-note-lead { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cc-note-box { position: absolute; display: inline-grid; width: max-content; box-sizing: border-box; border: 1px solid transparent; outline: 1px dashed var(--cc-amber); outline-offset: 2px; font-family: var(--cc-font, inherit); white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-note-box::after { content: attr(data-v); visibility: hidden; grid-area: 1 / 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-note-box textarea { grid-area: 1 / 1; width: 100%; min-width: 1ch; margin: 0; padding: 0; border: 0; outline: none; resize: none; overflow: hidden; background: transparent; color: inherit; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre-wrap; overflow-wrap: anywhere; caret-color: var(--cc-amber); }
.cc-note-bar { gap: 3px; }
.cc-note-bar select { height: 22px; padding: 0 2px; border: 0; border-radius: 5px; background: var(--cc-raise); color: var(--cc-ink); font: inherit; font-size: .72rem; }
.cc-note-bar label, .cc-dset-text label { display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; color: var(--cc-dim); cursor: pointer; }
.cc-dset-text small { font-size: .72rem; }
.cc-note-bar input[type='color'], .cc-dset-text input[type='color'] { width: 24px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; }
.cc-note-bar input[type='checkbox'] { margin: 0; accent-color: var(--cc-amber); }
.cc-note-b, .cc-note-i { font-family: Georgia, serif; font-size: .82rem; }
.cc-note-b { font-weight: 800; }
.cc-note-i { font-style: italic; }
.cc-dset-text { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.cc-dset-text > button { min-width: 24px; height: 22px; border-radius: 5px; color: var(--cc-dim); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-dset-text > button[aria-pressed='true'] { background: var(--cc-raise); color: var(--cc-amber); }
.cc-dset-text select { height: 22px; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); border: 0; box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-dset textarea { width: 200px; min-height: 52px; padding: 4px 6px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); font: inherit; box-shadow: inset 0 0 0 1px var(--cc-line2); resize: vertical; }

/* The footer's range presets and date range (`rangePresets`, RangeBar.tsx), ahead of the host's footer controls. */
.cc-range { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
/* The window in words beside the presets (RangeBar `summary`): quiet, one line, cut short before it crowds the footer's own buttons. */
.cc-range-sum { flex: 0 1 auto; margin-left: 6px; padding-left: 8px; box-shadow: inset 1px 0 0 var(--cc-line2); color: var(--cc-faint); font-size: 11.5px; font-weight: 500; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.cc-goto.cc-range-pick { right: auto; left: 8px; }
/* The eraser cursor (cursor-modes.ts): a click on a drawing deletes it. */
.cc-root svg[data-cursor='eraser'] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M3 13.5 10.5 6l5 5-6 6H6z' fill='%23f3b53f' stroke='%23111' stroke-width='1.2' stroke-linejoin='round'/%3E%3Cpath d='M7 17h10' stroke='%23111' stroke-width='1.4'/%3E%3C/svg%3E") 4 16, cell; }
/* Full screen: the chart over the whole screen on its own background, and the way out. */
.cc-root:fullscreen { background: var(--cc-bg2); padding: 0 8px; box-sizing: border-box; }
.cc-fs-exit { position: absolute; z-index: 8; top: 6px; left: 50%; translate: -50% 0; height: 28px; padding: 0 14px; border-radius: 14px; background: var(--cc-pop); color: var(--cc-ink); font-size: .74rem; font-weight: 600; box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); }
.cc-fs-exit kbd { margin-left: 6px; color: var(--cc-faint); font: inherit; font-size: .66rem; }

/*
 * Motion. Popovers and menus drop in from their anchor, dialogs rise and
 * settle, scrims fade; a pressed button gives a hair. Short (≤ 180 ms) and
 * eased out, and none of it for a reader who asked for reduced motion.
 */
@keyframes cc-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
@keyframes cc-pop-up { from { opacity: 0; transform: translateY(4px) scale(.985); } }
@keyframes cc-rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes cc-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .cc-tool-menu, .cc-draw-pop, .cc-objects, .cc-goto, .cc-study-menu { animation: cc-pop-in .14s var(--cc-ease, ease-out); transform-origin: top left; }
  .cc-dock > .cc-tool-menu:not(.cc-ctx-menu), .cc-tpl-menu { animation-name: cc-pop-up; transform-origin: bottom left; }
  .cc-settings, .cc-study-modal, .cc-study-settings, .cc-keys { animation: cc-rise .18s var(--cc-ease, ease-out); }
  .cc-study-backdrop, .cc-dset-scrim, .cc-keys-scrim, .cc-rail-tip, .cc-marker-tip { animation: cc-fade .14s ease-out; }
  :is(.cc-tools, .cc-foot, .cc-layout-bar) button:active:not(:disabled), .cc-rail button:active:not(:disabled) { transform: scale(.94); }
}
@media (prefers-reduced-motion: reduce) {
  .cc-notice[data-state='loading']::before { animation: none; }
  .cc-spin { animation-duration: 1.6s; }
}

/* The keyboard shortcuts sheet ("?", ShortcutsHelp.tsx): the menus' surface, centred over the chart, two columns where there is room. */
.cc-keys-scrim { position: absolute; inset: 0; z-index: 14; display: grid; place-items: center; padding: 8px; background: rgba(0, 0, 0, .22); }
.cc-keys { display: flex; flex-direction: column; width: min(640px, 100%); max-height: min(520px, 100%); min-height: 0; border-radius: 10px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); color: var(--cc-ink); font-family: var(--cc-ui-font, inherit); font-size: .76rem; }
.cc-keys-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 16px; box-shadow: inset 0 -1px 0 var(--cc-line); }
.cc-keys-head b { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.cc-keys-head input { flex: 1; min-width: 0; height: 26px; padding: 0 8px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); font: inherit; box-shadow: inset 0 0 0 1px var(--cc-line); }
.cc-keys-head input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cc-amber); }
.cc-keys-x { width: 26px; height: 26px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-size: 1rem; }
.cc-keys-x:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-keys-body { overflow: auto; padding: 4px 16px 14px; columns: 2 260px; column-gap: 24px; }
.cc-keys-body section { break-inside: avoid; padding-top: 8px; }
.cc-keys-body h4 { margin: 0 0 4px; color: var(--cc-faint); font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.cc-keys-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; }
.cc-keys-row > span:first-child { color: var(--cc-dim); }
.cc-keys-k { flex: none; white-space: nowrap; }
.cc-keys-k i { color: var(--cc-faint); font-style: normal; font-size: .66rem; }
.cc-keys kbd { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 4px; background: var(--cc-hover); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; font-size: .7rem; text-align: center; }
.cc-keys-none { margin: 12px 0; color: var(--cc-faint); }
.cc-quick-scrim { place-items: start center; padding-top: min(72px, 12%); }
.cc-quick { width: min(560px, 100%); max-height: min(460px, 100%); }
.cc-quick-head { gap: 8px; padding: 10px 12px; color: var(--cc-faint); }
.cc-quick-head input { height: 30px; background: transparent; box-shadow: none; font-size: .86rem; }
.cc-quick-head input:focus { box-shadow: none; }
.cc-quick-body { overflow: auto; padding: 2px 6px 8px; }
.cc-quick-body section { padding-top: 6px; }
.cc-quick-body h4 { margin: 0; padding: 4px 10px; color: var(--cc-faint); font-size: .64rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.cc-quick-row { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px 0 6px; border-radius: 6px; cursor: pointer; }
.cc-quick-row[aria-selected="true"] { background: var(--cc-hover); }
.cc-quick-check { flex: none; width: 14px; color: var(--cc-amber); text-align: center; }
.cc-quick-label { flex: 1; min-width: 0; overflow: hidden; color: var(--cc-ink); text-overflow: ellipsis; white-space: nowrap; }
.cc-quick-hint { flex: none; color: var(--cc-faint); font-size: .7rem; }

/* The magnet's modes (the rail's magnet chevron): weak or strong, and how to turn it over for a moment. */
.cc-magnet-note { max-width: 210px; padding: 6px 16px 4px; color: var(--cc-faint); font-size: .66rem; line-height: 1.35; }

/* The object tree's drawings group (ObjectsPanel.tsx): its heading folds it; the drawings sit under it; a name renamed in place. */
.cc-obj-row--head { color: var(--cc-dim); font-weight: 600; padding-left: 4px; }
.cc-obj-row--in { padding-left: 22px; }
.cc-obj-row--in + .cc-obj-row--sub { padding-left: 38px; }
.cc-obj-row > .cc-obj-fold { width: 18px; height: 22px; color: var(--cc-faint); }
.cc-obj-rename { flex: 1 1 auto; min-width: 0; height: 24px; margin: 0 4px; padding: 0 6px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); font: inherit; box-shadow: inset 0 0 0 1px var(--cc-amber); outline: none; }

/* The replay bar's cursor is a button that opens its Go to field (ReplayControls.tsx). */
button.cc-replay-at { height: 24px; padding: 0 6px; border-radius: var(--cc-ctl-r); font: inherit; font-size: .7rem; color: var(--cc-dim); font-variant-numeric: tabular-nums; }
button.cc-replay-at:not(:disabled):hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-replay-go { display: inline-flex; align-items: center; gap: 4px; }
.cc-replay-go input { height: 24px; padding: 0 6px; border: 0; border-radius: var(--cc-ctl-r); background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line); font: inherit; font-size: .7rem; color-scheme: dark light; }
.cc-replay-go input[aria-invalid='true'] { box-shadow: inset 0 0 0 1px var(--cc-down); }


/* The Arcana editor (ArcanaEditor.tsx, `@ftw-trade/charts/arcana`): TradingView's Pine Editor, docked under the chart. */
.cc-fs { display: flex; flex-direction: column; min-width: 0; border-radius: 8px; background: var(--cc-card2); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font-family: var(--cc-font, var(--cc-ui-font)); font-size: 13px; text-align: left; }
.cc-fs button { display: inline-flex; align-items: center; gap: 5px; height: var(--cc-ctl-h); padding: 0 10px; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-ink); font: inherit; cursor: pointer; transition: background-color .1s; white-space: nowrap; }
.cc-fs button:hover { background: var(--cc-hover); }
.cc-fs button[aria-expanded="true"] { background: var(--cc-on-bg); color: var(--cc-on); }
.cc-fs-head { position: relative; display: flex; align-items: center; gap: 2px; padding: 6px 8px; box-shadow: inset 0 -1px 0 var(--cc-line2); }
.cc-fs-name { flex: 0 1 220px; min-width: 80px; height: var(--cc-ctl-h); margin-right: 4px; padding: 0 8px; border: 0; border-radius: var(--cc-ctl-r); background: transparent; color: var(--cc-ink); font: inherit; font-weight: 600; }
.cc-fs-name:hover { box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-fs-name:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cc-series); }
.cc-fs-menu { position: relative; }
.cc-fs-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; width: 320px; max-height: 320px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; border-radius: 8px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); }
.cc-fs-pop li { position: relative; display: grid; gap: 2px; padding: 7px 34px 7px 10px; border-radius: 6px; cursor: pointer; }
.cc-fs-pop li:hover, .cc-fs-pop li:focus-visible { background: var(--cc-hover); outline: none; }
.cc-fs-pop li b { font-weight: 600; }
.cc-fs-pop li span { color: var(--cc-dim); font-size: 12px; line-height: 1.35; }
.cc-fs-pop li.cc-fs-none { color: var(--cc-faint); cursor: default; }
.cc-fs-pop li.cc-fs-none:hover { background: transparent; }
.cc-fs .cc-fs-del { position: absolute; top: 6px; right: 4px; width: 24px; height: 24px; padding: 0; justify-content: center; color: var(--cc-faint); font-size: 16px; }
.cc-fs .cc-fs-del:hover { color: var(--cc-down); }
.cc-fs-status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; margin: 0 6px 0 auto; overflow: hidden; color: var(--cc-dim); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.cc-fs-status i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--cc-faint); }
.cc-fs-status[data-tone="ok"] i { background: var(--cc-up); }
.cc-fs-status[data-tone="bad"] { color: var(--cc-down); }
.cc-fs-status[data-tone="bad"] i { background: var(--cc-down); }
.cc-fs-status[data-tone="wait"] i { animation: cc-fs-pulse 1s ease-in-out infinite alternate; }
@keyframes cc-fs-pulse { from { opacity: .3; } to { opacity: 1; } }
.cc-fs .cc-fs-apply { padding: 0 14px; background: var(--cc-series); color: var(--cc-tag-ink, #fff); font-weight: 600; }
.cc-fs .cc-fs-apply:hover { background: color-mix(in srgb, var(--cc-series) 85%, #fff); }
.cc-fs .cc-fs-apply:disabled { opacity: .4; cursor: default; background: var(--cc-series); }
.cc-fs .cc-fs-x { width: var(--cc-ctl-h); padding: 0; justify-content: center; color: var(--cc-dim); }
.cc-fs-body { position: relative; display: flex; min-height: 0; overflow: hidden; background: rgb(var(--cc-bg-rgb)); font: 13px/19px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.cc-fs-gutter { flex: 0 0 auto; min-width: 44px; overflow: hidden; padding: 8px 0; box-shadow: inset -1px 0 0 var(--cc-line); color: var(--cc-faint); text-align: right; user-select: none; }
.cc-fs-ln { position: relative; height: 19px; padding: 0 10px 0 16px; font-variant-numeric: tabular-nums; }
.cc-fs-ln--bad { color: var(--cc-down); }
.cc-fs-ln--bad::before { content: ''; position: absolute; left: 6px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--cc-down); }
.cc-fs-code { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.cc-fs-hl, .cc-fs-input { margin: 0; padding: 8px 12px; border: 0; font: inherit; letter-spacing: 0; white-space: pre; word-wrap: normal; tab-size: 2; }
.cc-fs-hl { position: absolute; top: 0; left: 0; min-width: 100%; pointer-events: none; color: var(--cc-ink); }
.cc-fs-input { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; resize: none; overflow: auto; background: transparent; color: transparent; caret-color: var(--cc-ink); outline: none; }
.cc-fs-input::selection { background: color-mix(in srgb, var(--cc-series) 32%, transparent); color: transparent; }
/* Syntax colours (arcana-syntax.ts paint): a hue per kind, Palenight-like on dark paper and GitHub-like on light. A host overrides any --cc-syn-* var; .cc-fs-syn carries them to code shown outside the editor. */
.cc-fs, .cc-fs-syn {
  --cc-syn-comment: #697098; --cc-syn-annotation: #bb9af7; --cc-syn-keyword: #c792ea; --cc-syn-decl: #c792ea; --cc-syn-def: #eeffff;
  --cc-syn-builtin: #82aaff; --cc-syn-call: #ffcb6b; --cc-syn-module: #f07178; --cc-syn-bar: #4ec9b0; --cc-syn-string: #c3e88d;
  --cc-syn-label: #ecc48d; --cc-syn-number: #f78c6c; --cc-syn-key: #a6accd; --cc-syn-operator: #89ddff; --cc-syn-op: #7f87a6;
}
.cc-fs[data-paper="light"], .cc-fs-syn[data-paper="light"], :root[data-theme="light"] :is(.cc-fs, .cc-fs-syn):not([data-paper="dark"]) {
  --cc-syn-comment: #6e7781; --cc-syn-annotation: #8250df; --cc-syn-keyword: #cf222e; --cc-syn-decl: #8250df; --cc-syn-def: #1f2328;
  --cc-syn-builtin: #0550ae; --cc-syn-call: #953800; --cc-syn-module: #bc4c00; --cc-syn-bar: #116329; --cc-syn-string: #0a3069;
  --cc-syn-label: #7d4e00; --cc-syn-number: #0969da; --cc-syn-key: #57606a; --cc-syn-operator: #cf222e; --cc-syn-op: #6e7781;
}
.cc-fs-t-comment { color: var(--cc-syn-comment); font-style: italic; }
.cc-fs-t-annotation { color: var(--cc-syn-annotation); font-style: italic; }
.cc-fs-t-keyword { color: var(--cc-syn-keyword); }
.cc-fs-t-decl { color: var(--cc-syn-decl); font-style: italic; }
.cc-fs-t-def { color: var(--cc-syn-def); font-weight: 600; }
.cc-fs-t-builtin { color: var(--cc-syn-builtin); }
.cc-fs-t-call { color: var(--cc-syn-call); }
.cc-fs-t-module { color: var(--cc-syn-module); }
.cc-fs-t-bar { color: var(--cc-syn-bar); }
.cc-fs-t-string { color: var(--cc-syn-string); }
.cc-fs-t-label { color: var(--cc-syn-label); }
.cc-fs-t-number, .cc-fs-t-literal { color: var(--cc-syn-number); }
.cc-fs-t-setting { color: var(--cc-syn-number); text-decoration: underline dotted color-mix(in srgb, var(--cc-syn-number) 60%, transparent); text-underline-offset: 3px; }
.cc-fs-t-key { color: var(--cc-syn-key); }
.cc-fs-t-operator { color: var(--cc-syn-operator); }
.cc-fs-t-op { color: var(--cc-syn-op); }
/* A string naming a colour shows it: a tint behind and a bar under, so the text keeps its place under the textarea. */
.cc-fs-swatch { border-radius: 3px; background: color-mix(in srgb, var(--cc-fs-sw) 28%, transparent); box-shadow: inset 0 -3px 0 var(--cc-fs-sw-solid, var(--cc-fs-sw)); }
.cc-fs-err { text-decoration: underline wavy var(--cc-down); text-decoration-skip-ink: none; text-underline-offset: 3px; }
.cc-fs-complete { position: absolute; z-index: 10; min-width: 240px; max-width: 420px; margin: 0; padding: 4px; list-style: none; border-radius: 6px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); font-family: var(--cc-font, var(--cc-ui-font)); font-size: 12px; }
.cc-fs-complete li { display: flex; gap: 10px; align-items: baseline; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.cc-fs-complete li[aria-selected="true"] { background: var(--cc-on-bg); }
.cc-fs-complete b { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.cc-fs-complete span { overflow: hidden; color: var(--cc-dim); white-space: nowrap; text-overflow: ellipsis; }
.cc-fs-sig, .cc-fs-hover { position: absolute; z-index: 9; display: grid; gap: 2px; max-width: min(520px, calc(100% - 24px)); padding: 5px 8px; border-radius: 6px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring), var(--cc-pop-shadow); font-family: var(--cc-font, var(--cc-ui-font)); font-size: 12px; pointer-events: none; }
.cc-fs-sig { transform: translateY(-100%); }
.cc-fs-sig--below { transform: translateY(calc(19px + 4px)); }
.cc-fs-sig code, .cc-fs-hover code { overflow-wrap: anywhere; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cc-ink); }
.cc-fs-sig b { color: var(--cc-series); font-weight: 700; }
.cc-fs-sig span, .cc-fs-hover span { color: var(--cc-dim); }
.cc-fs-hover--bad code { color: var(--cc-down); }
.cc-fs-problems { max-height: 112px; overflow-y: auto; padding: 4px 8px; box-shadow: inset 0 1px 0 var(--cc-line2); font-size: 12px; }
.cc-fs-problems ul { margin: 0; padding: 0; list-style: none; }
.cc-fs-problems button { width: 100%; height: auto; min-height: 24px; padding: 3px 6px; color: var(--cc-ink); text-align: left; white-space: normal; }
.cc-fs-where { flex: 0 0 auto; min-width: 42px; color: var(--cc-down); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.cc-fs-code-id { margin-left: auto; padding-left: 8px; color: var(--cc-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cc-fs-runtime { display: block; padding: 3px 6px; color: var(--cc-down); white-space: pre-wrap; }
.cc-fs-quiet { display: block; padding: 3px 6px; color: var(--cc-faint); }
@media (max-width: 640px) {
  .cc-fs-head { flex-wrap: wrap; }
  .cc-fs-name { flex: 1 1 100%; margin: 0 0 4px; }
  .cc-fs-status { order: 9; flex: 1 1 100%; margin: 4px 0 0; }
}
.cc-goto.cc-iv-type { right: auto; bottom: auto; left: 50%; top: 40%; transform: translate(-50%, -50%); }
.cc-iv-type input { width: 9em; font-size: .9rem; }
.cc-iv { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.cc-iv > button { height: 26px; min-width: 30px; padding: 0 6px; border-radius: var(--cc-ctl-r); color: var(--cc-dim); font-size: 12px; font-weight: 600; }
.cc-iv > button:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-iv > button[aria-pressed='true'] { color: var(--cc-on); background: var(--cc-on-bg); }
.cc-iv > button:disabled { opacity: .4; }
.cc-iv-menu { top: 30px; left: 0; max-height: 420px; overflow-y: auto; min-width: 180px; }
.cc-iv-row { display: grid; grid-template-columns: 1fr 28px; align-items: center; }
.cc-tool-menu .cc-iv-row button[role='menuitemradio'] { grid-template-columns: 0 1fr; }
.cc-tool-menu .cc-iv-row button:disabled { opacity: .4; }
.cc-tool-menu .cc-iv-star { display: block; height: 30px; padding: 0; color: var(--cc-faint); text-align: center; }
.cc-tool-menu .cc-iv-star[aria-pressed='true'] { color: var(--cc-amber); }
.cc-iv-add { display: flex; gap: 4px; padding: 4px; }
.cc-iv-add input { flex: 1; min-width: 0; height: 26px; padding: 0 6px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line); font: inherit; font-size: 12px; }
.cc-iv-add input[aria-invalid='true'] { box-shadow: inset 0 0 0 1px var(--cc-down); }
.cc-tool-menu .cc-iv-add button { display: block; height: 26px; padding: 0 10px; background: var(--cc-ink); color: var(--cc-pop); font-weight: 600; }
.cc-tool-menu .cc-iv-add button:disabled { opacity: .4; }
.cc-deriving { position: absolute; left: 16px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px; background: var(--cc-pop); box-shadow: inset 0 0 0 1px var(--cc-pop-ring); color: var(--cc-dim); font-size: 12px; font-weight: 500; transform: translateY(-50%); pointer-events: none; }
.cc-deriving .cc-spin { width: 12px; height: 12px; }
/* A touch screen: the legend's eye, gear, × and more, and the scale's A / L / %, get a thumb-sized target. */
@media (pointer: coarse) {
  .cc-legend-row button { width: 28px; height: 28px; }
  .cc-legend-act { gap: 2px; max-width: 140px; }
  .cc-scale-btns button { position: relative; width: 20px; height: 20px; line-height: 20px; }
  .cc-scale-btns button::after { content: ''; position: absolute; inset: -8px -2px; }
}

/* ---- @stratos/chart shell: the vanilla layout the React version had from its host */
.sx-chart { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; box-sizing: border-box; color: var(--cc-ink); background: rgb(var(--cc-bg-rgb)); }
.sx-chart .cc-tools { flex: 0 0 auto; margin-bottom: 0; }
.sx-chart .cc-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; }
.sx-chart .cc-rail { align-self: stretch; width: 48px; max-height: 100%; }
.sx-chart .cc-foot { flex: 0 0 auto; box-shadow: inset 0 1px 0 var(--cc-line); }
.sx-wrap { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; }
.sx-canvas, .sx-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sx-svg { touch-action: none; user-select: none; -webkit-user-select: none; font-family: var(--cc-font, var(--cc-ui-font)); }
.sx-panes { position: absolute; inset: 0; pointer-events: none; }
.sx-panes > * { pointer-events: auto; }
.sx-chart .cc-legend--main { top: 6px; }
.sx-lg-title { font-weight: 700; color: var(--cc-ink); margin-right: 2px; }
.sx-lg-iv { color: var(--cc-faint); margin-right: 6px; }
.sx-tb-title { font-weight: 700 !important; color: var(--cc-ink) !important; font-size: 13px !important; padding: 0 8px !important; }
.sx-tb-type-label { font-size: 12px; }
.cc-tools .cc-type-btn { gap: 4px; }
.cc-tools .cc-caret { display: inline-flex; color: var(--cc-faint); transition: transform .12s; }
.cc-tools .cc-iv-more { min-width: 20px; padding: 0 4px; font-size: 10px; }
.cc-iv-group { display: grid; }
.cc-iv-row button[role='menuitemradio'] { grid-template-columns: 14px 1fr; }
.cc-iv-star { width: 28px; height: 28px; padding: 0; color: var(--cc-faint); border-radius: 4px; }
.cc-iv-star[aria-pressed='true'] { color: #ffca3b; }
.cc-icon-wrap { display: inline-grid; place-items: center; }
.cc-icon-glyph { font-size: 15px; line-height: 1; }
.cc-rail-tip { transform: translateY(-50%); }
.sx-theme-sw { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; padding: 3px; border-radius: 4px; background: var(--sw-bg); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.sx-theme-sw i { display: block; width: 5px; border-radius: 1px; }
.sx-theme-sw i:nth-child(1) { height: 8px; background: var(--sw-up); }
.sx-theme-sw i:nth-child(2) { height: 12px; background: var(--sw-down); }
.sx-theme-sw i:nth-child(3) { height: 6px; background: var(--sw-up); }
.cc-settings-theme { flex-direction: column; align-items: center; gap: 6px; height: auto; padding: 8px 4px; font-size: 12px; color: var(--cc-dim); }
.cc-settings-theme:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-settings-theme[aria-checked='true'] { box-shadow: inset 0 0 0 1.5px var(--cc-accent); color: var(--cc-ink); }
.cc-settings-nav button span { flex: 1; }
.sx-dset-tabs { flex: 0 0 140px; }
.cc-dset .cc-settings-nav button { height: 32px; }
.cc-dset textarea { font-size: 12px; }
.cc-dset .cc-settings-row > span:first-child label { gap: 6px; }
.cc-study-backdrop.sx-ss-backdrop { position: absolute; z-index: 14; padding: 8px; }
.cc-study-list li[role='option'] { list-style: none; }
.cc-study-list .cc-study-short { flex: 0 0 auto; color: var(--cc-faint); font-size: 12px; font-weight: 600; }
.cc-study-list .cc-study-add { flex: 0 0 auto; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: var(--cc-series); color: #fff; font-size: 12px; font-weight: 600; opacity: 0; }
.cc-study-list li[aria-selected='true'] .cc-study-add, .cc-study-list .cc-study-add.cc-study-added { opacity: 1; }
.cc-study-list .cc-study-add.cc-study-added { background: transparent; color: var(--cc-up); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-study-groups small { color: var(--cc-faint); font-variant-numeric: tabular-nums; }
.cc-study-sep { height: 1px; margin: 6px 8px; background: var(--cc-line2); }
.cc-study-tpl { display: flex; align-items: center; gap: 10px; padding: 10px 24px; }
.cc-study-tpl > div { flex: 1; min-width: 0; display: grid; }
.cc-study-tpl small { color: var(--cc-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-study-tpl .cc-study-tpl-apply { height: 28px; padding: 0 12px; border-radius: 6px; background: var(--cc-series); color: #fff; font-weight: 600; }
.cc-study-tpl-note { padding: 4px 24px; color: var(--cc-faint); font-size: 12px; }
.cc-study-tpl-save button { height: 32px; padding: 0 14px; border-radius: 6px; background: var(--cc-series); color: #fff; font-weight: 600; }
.cc-study-tpl-save button:disabled { opacity: .4; }
.cc-study-search { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; color: var(--cc-ink); font: inherit; font-size: 16px; outline: none; }
.cc-study-x { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: var(--cc-dim); font-size: 1.3rem; }
.cc-study-x:hover { background: var(--cc-hover); color: var(--cc-ink); }
.cc-study-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 24px; color: var(--cc-ink); font-size: 16px; letter-spacing: 0; text-transform: none; }
.cc-study-settings .cc-study-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 20px; font-size: 15px; }
.cc-plot-row select, .cc-ss-grid select, .cc-ss-grid input[type='number'] { height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; }
.cc-ss-foot .cc-ss-reset { height: 32px; padding: 0 14px; border-radius: 6px; color: var(--cc-dim); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-ss-foot .cc-ss-ok { height: 32px; padding: 0 18px; border-radius: 6px; }
.cc-levels { margin-top: 14px; display: grid; gap: 6px; }
.cc-levels-head { display: flex; align-items: center; justify-content: space-between; }
.cc-levels-head button { height: 26px; padding: 0 10px; border-radius: 6px; color: var(--cc-dim); box-shadow: inset 0 0 0 1px var(--cc-line2); }
.cc-level-row { display: flex; align-items: center; gap: 8px; }
.cc-level-row input { width: 100px; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; }
.cc-level-row button { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--cc-faint); }
.cc-goto label { display: grid; gap: 4px; color: var(--cc-dim); font-size: 12px; }
.cc-goto input { height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; }
.cc-goto button { height: 28px; padding: 0 12px; border-radius: 6px; background: var(--cc-series); color: #fff; font-weight: 600; }
.cc-note-box textarea { display: block; min-width: 120px; max-width: 320px; width: 100%; min-height: 24px; padding: 3px 6px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; line-height: 1.3; resize: both; outline: none; }
.cc-note-box { display: inline-grid; border-radius: 4px; }
.cc-note-box::after { content: attr(data-v); grid-area: 1 / 1; visibility: hidden; white-space: pre-wrap; padding: 3px 6px; }
.cc-note-box textarea { grid-area: 1 / 1; }
.cc-note-bar { position: static; margin-top: 6px; }
.cc-note-bar select, .cc-note-bar input[type='color'] { height: 24px; border: 0; border-radius: 5px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; font-size: 12px; }
.cc-note-bar input[type='color'] { width: 28px; padding: 0; }
.cc-keys-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.cc-keys-head input { flex: 1; min-width: 0; height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: rgb(var(--cc-bg-rgb)); color: var(--cc-ink); box-shadow: inset 0 0 0 1px var(--cc-line2); font: inherit; outline: none; }
.sx-tb-draw { gap: 2px; }
