/* ============================================================================
   signal_chart (有图) Gen 3 Design Token System (palette.css)
   Grounded in Adobe Spectrum Design Tokens (https://spectrum.adobe.com/page/design-tokens/)

   1. ORTHOGONAL AXIS A — TOKEN TERMINOLOGY (Data Structure of Every Token):
      - Token:      A reusable design decision represented as structured data (Token Name + Value).
      - Token Name: Left-to-right taxonomic classification of a use case
                    (e.g. [meaning | structure]-[property]-[orientation]-[state | scale]).
      - Value:      The data bound to a Token Name — either a direct implementation literal
                    (#D51562, 28px) OR an Alias.
      - Alias:      A token value that references another token (var(--...)), refining broad
                    decisions into specific contexts (including Primitive -> Semantic and
                    Semantic -> Semantic chaining) without duplicating values.

   2. ORTHOGONAL AXIS B — TOKEN TIERS (Abstraction Hierarchy of Design Decisions):
      - Tier 1 · Primitive (Global) Tokens:
          Available raw options in the design language (color scales, font scales, dimension
          scales) with zero usage intent.
      - Tier 2 · Semantic Tokens (Primary Consumption Layer):
          Communicate purpose, intent, and structure across the system. Organized into:
            (a) Semantic Meaning (accent/brand, agent, positive, negative, notice, danger
                across background-color, content-color, border-color and interaction states);
            (b) Reusable Structures (Base, Accessory, Group, List, Container, Banner) so
                components compose shared structural decisions instead of bespoke variables.
      - Tier 3 · Component-Specific Tokens (Intentionally Minimal Exception Layer):
          Scoped to a single component only when no Semantic Meaning or Reusable Structure
          decision applies (e.g. candlestick bar fills, quote rail width).

   NOTE (Migration Status):
     Top-level token taxonomy and the 4-layer workstation shell (ui.css) are wired to this
     system. Legacy module stylesheets (style.css, daily-desk.css, report.css) remain bridged
     via the Compatibility Alias section at the bottom for Phase 2 migration.
   ============================================================================ */
:root {
  /* ==========================================================================
     TIER 1: PRIMITIVE (GLOBAL) TOKENS — Available Options, Zero Usage Intent
     ========================================================================== */
  /* Color Palette Options */
  --prim-color-white: #FFFFFF;
  --prim-color-paper-50: #FCFBF9;
  --prim-color-paper-100: #FBF8F3;
  --prim-color-paper-200: #F7F5F1;
  --prim-color-paper-300: #F5F1EB;
  --prim-color-paper-400: #EFE9DF;
  --prim-color-paper-500: #EFEBE4;

  --prim-color-stone-200: #E8E0D6;
  --prim-color-stone-250: #DDD5CA;
  --prim-color-stone-300: #D9CFC4;
  --prim-color-stone-350: #CFC5BA;
  --prim-color-stone-400: #C6B9AC;

  --prim-color-ink-900: #27201B;
  --prim-color-ink-700: #5B5048;
  --prim-color-ink-500: #78695E;
  --prim-color-ink-300: #A3968A;
  --prim-color-ink-a06: rgba(39, 32, 27, 0.06);
  --prim-color-ink-a075: rgba(39, 32, 27, 0.075);
  --prim-color-ink-a08: rgba(39, 32, 27, 0.08);
  --prim-color-ink-a11: rgba(39, 32, 27, 0.11);
  --prim-color-ink-a14: rgba(39, 32, 27, 0.14);

  --prim-color-crimson-600: #D51562;
  --prim-color-crimson-a08: rgba(213, 21, 98, 0.08);
  --prim-color-cobalt-600: #3A6AA8;
  --prim-color-cobalt-a12: rgba(58, 106, 168, 0.12);
  --prim-color-cobalt-a55: rgba(58, 106, 168, 0.55);
  --prim-color-slate-600: #4F6177;
  --prim-color-amber-600: #A57A1E;
  --prim-color-amber-a12: rgba(165, 122, 30, 0.12);
  --prim-color-copper-600: #8B5B2E;
  --prim-color-brick-600: #B5342A;
  --prim-color-brick-a10: rgba(181, 52, 42, 0.10);
  --prim-color-violet-600: #6E5AA8;

  --prim-color-red-600: #D92D3A;
  --prim-color-red-500: #F23645;
  --prim-color-red-a45: rgba(242, 54, 69, 0.45);
  --prim-color-teal-700: #067C66;
  --prim-color-teal-600: #088770;
  --prim-color-teal-500: #089981;
  --prim-color-teal-a45: rgba(8, 153, 129, 0.45);

  /* Typography & Dimension Options */
  --prim-font-sans: "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --prim-font-serif: "Noto Serif SC", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", var(--prim-font-sans);
  --prim-font-display: "Playfair Display", Georgia, var(--prim-font-serif);
  --prim-font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --prim-font-size-2xs: 10px;
  --prim-font-size-xs: 11px;
  --prim-font-size-sm: 12px;
  --prim-font-size-md: 13px;
  --prim-font-size-lg: 15px;
  --prim-font-size-xl: 20px;
  --prim-font-size-2xl: 28px;

  --prim-space-1: 4px;
  --prim-space-2: 8px;
  --prim-space-3: 12px;
  --prim-space-4: 16px;
  --prim-space-5: 20px;
  --prim-space-6: 24px;

  --prim-size-20: 20px;
  --prim-size-22: 22px;
  --prim-size-24: 24px;
  --prim-size-26: 26px;
  --prim-size-28: 28px;
  --prim-size-30: 30px;
  --prim-size-36: 36px;
  --prim-size-216: 216px;
  --prim-shadow-lg: 0 6px 20px var(--prim-color-ink-a14);

  /* ==========================================================================
     TIER 2: SEMANTIC TOKENS — Primary Consumption Layer (Meaning + Structures)
     Taxonomy: [meaning | structure]-[property]-[variant | state]
     ========================================================================== */
  /* 2A. Semantic Meaning — Surface, Content, Border, Actor, Status & Direction */
  --sys-surface-canvas: var(--prim-color-paper-50);
  --sys-surface-bar: var(--prim-color-paper-200);
  --sys-surface-panebar: var(--prim-color-paper-100);
  --sys-surface-card: var(--prim-color-paper-100);
  --sys-surface-paper: var(--prim-color-paper-300);
  --sys-surface-paper-warm: var(--prim-color-paper-400);
  --sys-surface-float: var(--prim-color-white);
  --sys-surface-float-head: var(--prim-color-paper-200);

  --sys-text-primary: var(--prim-color-ink-900);
  --sys-text-secondary: var(--prim-color-ink-700);
  --sys-text-muted: var(--prim-color-ink-500);
  --sys-text-on-solid: var(--prim-color-paper-50);

  --sys-border-strong: var(--prim-color-stone-400);
  --sys-border-default: var(--prim-color-stone-300);
  --sys-border-subtle: var(--prim-color-stone-200);

  --sys-state-hover: var(--prim-color-ink-a06);
  --sys-state-active-tab: var(--prim-color-ink-a075);
  --sys-state-active: var(--prim-color-ink-a11);
  --sys-state-selected: var(--prim-color-cobalt-a12);
  --sys-state-focus: var(--prim-color-cobalt-600);

  /* Actor Provenance & Status Meaning (with Semantic -> Semantic aliasing) */
  --sys-actor-user: var(--prim-color-crimson-600);
  --sys-actor-user-tint: var(--prim-color-crimson-a08);
  --sys-actor-agent: var(--prim-color-cobalt-600);
  --sys-actor-agent-tint: var(--prim-color-cobalt-a12);

  --sys-status-danger: var(--prim-color-brick-600);
  --sys-status-danger-tint: var(--prim-color-brick-a10);
  --sys-status-warn: var(--prim-color-amber-600);
  --sys-status-warn-tint: var(--prim-color-amber-a12);

  --sys-market-up: var(--prim-color-red-600);
  --sys-market-down: var(--prim-color-teal-600);
  --sys-market-flat: var(--sys-text-muted);

  --sys-series-main: var(--sys-actor-agent);
  --sys-series-bench: var(--prim-color-slate-600);
  --sys-series-second: var(--sys-status-warn);
  --sys-series-zero: var(--prim-color-stone-350);
  --sys-series-underlying: var(--prim-color-cobalt-a55);

  /* 2B. Reusable Structures (Spectrum Structural Vocabulary:
         Base, Accessory, Group, List, Container, Banner) */
  --sys-base-height-xs: var(--prim-size-20);
  --sys-base-height-sm: var(--prim-size-22);
  --sys-base-height-md: var(--prim-size-26);
  --sys-base-height-lg: var(--prim-size-30);
  --sys-group-gap-xs: 2px;
  --sys-group-gap-sm: var(--prim-space-1);
  --sys-list-row-height: var(--prim-size-22);
  --sys-container-height-header: var(--prim-size-36);
  --sys-container-height-subheader: var(--prim-size-28);
  --sys-container-height-footer: var(--prim-size-24);
  --sys-container-padding-inline: var(--prim-space-2);
  --sys-container-elevation-float: var(--prim-shadow-lg);

  /* ==========================================================================
     TIER 3: COMPONENT-SPECIFIC TOKENS — Minimal Scoped Exceptions Only
     ========================================================================== */
  --comp-appbar-h: var(--sys-container-height-header);
  --comp-panebar-h: var(--sys-container-height-subheader);
  --comp-tapebar-h: var(--sys-container-height-footer);
  --comp-ctrl-h-sm: var(--sys-base-height-sm);
  --comp-ctrl-h: var(--sys-base-height-md);
  --comp-ctrl-h-md: var(--sys-base-height-lg);
  --comp-quote-w: var(--prim-size-216);
  --comp-float-shadow: var(--sys-container-elevation-float);

  --comp-candle-up: var(--prim-color-red-500);
  --comp-candle-down: var(--prim-color-teal-500);
  --comp-candle-vol-up: var(--prim-color-red-a45);
  --comp-candle-vol-down: var(--prim-color-teal-a45);

  /* ==========================================================================
     COMPATIBILITY & TRANSITIONAL ALIASES (Phase 1 Bridge)
     ========================================================================== */
  --ref-white: var(--prim-color-white);
  --ref-paper-50: var(--prim-color-paper-50);
  --ref-paper-100: var(--prim-color-paper-100);
  --ref-paper-200: var(--prim-color-paper-200);
  --ref-paper-300: var(--prim-color-paper-300);
  --ref-paper-400: var(--prim-color-paper-400);
  --ref-paper-500: var(--prim-color-paper-500);
  --ref-ink-900: var(--prim-color-ink-900);
  --ref-ink-700: var(--prim-color-ink-700);
  --ref-ink-500: var(--prim-color-ink-500);
  --ref-ink-300: var(--prim-color-ink-300);
  --ref-border-400: var(--prim-color-stone-400);
  --ref-border-300: var(--prim-color-stone-300);
  --ref-border-250: var(--prim-color-stone-250);
  --ref-border-200: var(--prim-color-stone-200);
  --ref-mag-600: var(--prim-color-crimson-600);
  --ref-mag-100: var(--prim-color-crimson-a08);
  --ref-sea-600: var(--prim-color-cobalt-600);
  --ref-sea-100: var(--prim-color-cobalt-a12);
  --ref-slate-600: var(--prim-color-slate-600);
  --ref-mustard-600: var(--prim-color-amber-600);
  --ref-mustard-100: var(--prim-color-amber-a12);
  --ref-copper-600: var(--prim-color-copper-600);
  --ref-seal-600: var(--prim-color-brick-600);
  --ref-seal-100: var(--prim-color-brick-a10);
  --ref-violet-600: var(--prim-color-violet-600);
  --ref-text-xs: var(--prim-font-size-xs);
  --ref-text-sm: var(--prim-font-size-sm);
  --ref-text-md: var(--prim-font-size-md);
  --ref-text-lg: var(--prim-font-size-lg);
  --ref-text-xl: var(--prim-font-size-xl);
  --ref-text-2xl: var(--prim-font-size-2xl);
  --ref-space-1: var(--prim-space-1);
  --ref-space-2: var(--prim-space-2);
  --ref-space-3: var(--prim-space-3);
  --ref-space-4: var(--prim-space-4);
  --ref-space-5: var(--prim-space-5);
  --ref-space-6: var(--prim-space-6);
  --sys-chart-up: var(--comp-candle-up);
  --sys-chart-down: var(--comp-candle-down);
  --sys-chart-vol-up: var(--comp-candle-vol-up);
  --sys-chart-vol-down: var(--comp-candle-vol-down);

  --sans: var(--prim-font-sans);
  --serif: var(--prim-font-serif);
  --num: var(--prim-font-display);
  --mono: var(--prim-font-mono);

  --paper: #F5F1EB;
  --paper-warm: #EFE9DF;
  --card: #FBF8F3;
  --ink: var(--sys-text-primary);
  --ink-soft: var(--sys-text-secondary);
  --muted: var(--sys-text-muted);
  --line: var(--sys-border-default);
  --rule: var(--sys-border-subtle);
  --dot: var(--prim-color-ink-a06);
  --select: var(--prim-color-ink-a08);
  --mag: var(--sys-actor-user);
  --sea: var(--sys-actor-agent);
  --slate: var(--prim-color-slate-600);
  --mustard: var(--sys-status-warn);
  --copper: var(--prim-color-copper-600);
  --seal: var(--sys-status-danger);
  --violet: var(--prim-color-violet-600);
  --up: var(--sys-market-up);
  --down: var(--sys-market-down);
  --chart-bg: var(--sys-surface-canvas);
  --chart-grid: var(--prim-color-stone-250);
  --chart-faint: var(--prim-color-paper-500);
  --chart-up: var(--comp-candle-up);
  --chart-down: var(--comp-candle-down);
  --chart-vol-up: var(--comp-candle-vol-up);
  --chart-vol-down: var(--comp-candle-vol-down);
  --map-flat: var(--prim-color-stone-200);
  --map-head: var(--prim-color-paper-300);
  --map-frame: var(--prim-color-white);
  --map-up: var(--sys-market-up);
  --map-down: var(--prim-color-teal-700);
  --series-main: var(--sys-series-main);
  --series-bench: var(--sys-series-bench);
  --series-second: var(--sys-series-second);
  --series-flat: var(--sys-series-zero);
  --grid: var(--prim-color-stone-200);
  --series-underlying: var(--sys-series-underlying);
}

/* The browse page: a white working ground; ink, lines and accents from palette.css (linked first). Controls carry
   no red: red and green are for prices. The selected thing is an ink block, the active chart and strategy mode sea
   blue, the watchlist star magenta (the palette's colour for one's own list). */
/* Native MathML needs no downloaded fonts; wide equations scroll within the answer, never the page (math.css). */
.math-block { display: block; max-width: 100%; overflow-x: auto; padding-block: 4px; }
.math-block math { margin-block: 0; }
.math-inline { vertical-align: baseline; }
:root { --bg: var(--chart-bg); --panel: #F7F5F1; --sel: rgba(58, 106, 168, 0.14); --hover: rgba(39, 32, 27, 0.05); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 13px/1.4 "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif; }
button { cursor: pointer; font: inherit; }
/* Toolbar: one segmented control for the period, one button style (links that act as buttons too), status and
   the keyboard help quiet on the right. */
#bar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 5px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
#bar .grow { flex: 1; }
.muted { color: var(--muted); }
/* The 幕僚 mark (app/muliao.svg; docs/design.md): drawn in the colour of the text around it. */
.mark { display: inline-block; width: 14px; height: 14px; margin-right: 5px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2327201B' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4V1.3'/%3E%3Cpath d='M8 1.3h2.6L9.7 2.1l.9.8H8' fill='%2327201B'/%3E%3Cpath d='M1.4 14.4h13.2M2.4 14.4 8 4l5.6 10.4'/%3E%3Cpath d='M8 8.6l-2 5.8h4z' fill='%2327201B'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2327201B' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4V1.3'/%3E%3Cpath d='M8 1.3h2.6L9.7 2.1l.9.8H8' fill='%2327201B'/%3E%3Cpath d='M1.4 14.4h13.2M2.4 14.4 8 4l5.6 10.4'/%3E%3Cpath d='M8 8.6l-2 5.8h4z' fill='%2327201B'/%3E%3C/svg%3E") center / contain no-repeat; }
#bar button, #bar select, #bar .btn { height: 26px; border: 1px solid var(--line); background: #fff; padding: 0 9px; color: var(--ink); font: inherit; display: inline-flex; align-items: center; text-decoration: none; }
#bar button:hover, #bar .btn:hover { border-color: var(--ink-soft); }
#bar button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
/* 关注 and 策略 choose the same right-side space.
   The 幕僚 sits at the edge. An open panel's button is underlined in ink, not
   filled, so open panels do not make black blocks. Then the help and the account. */
#bar button.tog.on { background: #fff; border-color: var(--ink-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
#bar #help { margin-left: 6px; }
/* 指标, 文字, 事件 add to the chart; set apart from the periods, adjustment and layout that set it up. */
#bar #formulaBtn { margin-left: 8px; }
#eventControls { display: inline-flex; gap: 3px; }
#bar .market-events-toggle[hidden], #bar .chart-odds-toggle[hidden] { display: none; }
body.options-mode #eventControls { display: none; }
#bar #who::after { content: "▾"; margin-left: 5px; font-size: 10px; color: var(--muted); }
#bar .seg { display: inline-flex; border: 1px solid var(--line); background: #fff; margin-right: 4px; }
#bar .seg button { border: 0; height: 24px; color: var(--ink-soft); }
#bar .seg button:hover { color: var(--ink); }
#bar .seg button.on { background: var(--ink); color: #fff; }
#status { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; max-width:220px; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media(max-width:700px) { #status { max-width:110px; } }
#bar #help { width: 26px; justify-content: center; padding: 0; border-radius: 50%; color: var(--muted); cursor: help; }
/* The page never scrolls sideways: the charts take what the side panels leave, down to nothing. */
main { position: relative; flex: 1; display: flex; min-height: 0; overflow: hidden; }
#workspace { position:relative; container-type:inline-size; display:flex; flex:1; min-width:0; min-height:0; }
#charts { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chart { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.chart[hidden] { display: none; }
.chart + .chart { border-top: 1px solid var(--line); }
.chart.active { outline: 1px solid var(--sea); outline-offset: -1px; }
.chart.placing { cursor: text; }
/* Board columns (columns.mjs), right of the charts; their widths are set from the layout. */
#cols { display: grid; grid-template-columns: 340px; border-left: 1px solid var(--line); background: #fff; min-height: 0; }
#cols[hidden] { display: none; }
.bcol { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; container-type: inline-size; }
.cgrip { position: absolute; top: 0; bottom: 0; left: -3px; width: 6px; cursor: col-resize; z-index: 2; }
.cgrip:hover, body.widening .cgrip { background: var(--sea); opacity: .4; }
body.widening { cursor: col-resize; user-select: none; }
.bpanel.cur .bhead { box-shadow: inset 3px 0 0 var(--sea); }
.bhead span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bhead .agent { color: #3A68B0; }
.bhead .holdings { color: var(--mag); }
.bhead .holdings b { font: 600 10px var(--sans); border: 1px solid var(--mag); padding: 0 2px; margin-right: 4px; vertical-align: 1px; }
.bcol + .bcol { border-left: 1px solid var(--line); }
.bpanel { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 60px; border-bottom: 1px solid var(--line); }
.bgrip { position: absolute; left: 0; right: 0; bottom: -4px; height: 7px; cursor: row-resize; z-index: 1; }
.bgrip:hover { background: var(--sea); opacity: .4; }
.bhead { display: flex; justify-content: space-between; padding: 2px 8px; background: var(--panel); color: var(--ink); font-weight: bold; }
.bhead i { font-weight: normal; }
.bhead[draggable] { cursor: grab; }
.bpanel.dragging { opacity: .4; }
.bpanel.drop-before { box-shadow: inset 0 3px 0 var(--sea); }
.bpanel.drop-after { box-shadow: inset 0 -3px 0 var(--sea); }
.bcol.drop-end { box-shadow: inset 0 -3px 0 var(--sea); }
.bhead i { color: var(--muted); font-style: normal; font-size: 11px; margin-left: 6px; }
.bhead .x { color: var(--muted); cursor: pointer; }
.bhead .x:hover { color: var(--seal); }
.bpanel .rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
/* Codes yield space before names; headers and rows reserve the same six-character name width. */
.bpanel .rows li { display: grid; grid-template-columns: 18px minmax(calc(6 * var(--prim-font-size-md)), 1fr) minmax(0, 58px) 46px 48px 56px; gap: 4px; padding: 1px 6px; cursor: default; white-space: nowrap; }
.bpanel .rows li > span { overflow: hidden; text-overflow: ellipsis; }
.bpanel .rows li.head { position: sticky; top: 0; background: #fff; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.bpanel .rows li.head:hover { background: #fff; }
.bpanel .rows li.head span:nth-child(n+4), .bpanel .rows .num { text-align: right; font-variant-numeric: tabular-nums; }
.bpanel .rows .n { color: var(--muted); text-align: right; font-size: 12px; }
.bpanel .rows .up { color: var(--up); }
.bpanel .rows .down { color: var(--down); }
.bpanel .rows li:hover { background: var(--hover); }
.bpanel .rows li.on { background: var(--sel); }
.bpanel .rows li.dragging { opacity: .45; }
.bpanel .rows li.row-before { box-shadow: inset 0 2px 0 var(--sea); }
.bpanel .rows li.row-after { box-shadow: inset 0 -2px 0 var(--sea); }
.bpanel .rows li.empty { display: block; color: var(--muted); }
.bcol select { margin: 4px; max-width: calc(100% - 8px); font: inherit; color: var(--muted); }
/* A narrow column drops 代码 before 5日涨幅%, then keeps main's order: 现价, 序号, 涨幅%.
   Hidden fields stay hidden as the column narrows; the row's title retains the full code. */
@container (max-width: 299px) { .bpanel .rows li { grid-template-columns: 18px minmax(0, 1fr) 46px 48px 56px; } .bpanel .rows li > :nth-child(3) { display: none; } }
@container (max-width: 239px) { .bpanel .rows li { grid-template-columns: 18px minmax(0, 1fr) 46px 48px; } .bpanel .rows li > :nth-child(6) { display: none; } }
@container (max-width: 189px) { .bpanel .rows li { grid-template-columns: 18px minmax(0, 1fr) 46px; } .bpanel .rows li > :nth-child(5) { display: none; } }
@container (max-width: 139px) { .bpanel .rows li { grid-template-columns: minmax(0, 1fr) 46px; } .bpanel .rows li > :nth-child(1) { display: none; } }
@container (max-width: 109px) { .bpanel .rows li { grid-template-columns: minmax(0, 1fr); } .bpanel .rows li > :nth-child(4) { display: none; } }
.legends { position: absolute; left: 6px; top: 0; right: 70px; pointer-events: none; z-index: 3; }
.lg { position: absolute; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12px; white-space: nowrap; }
.lg > span { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; }
.lg .title { font-weight: bold; }
.lg .ind { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 0 10px; }
.lg .cap, .lg .rm, .lg .star { pointer-events: auto; cursor: pointer; }
/* ☆ 加自选 / ★ 已自选 before the name: explicit pill on the chart legend, magenta when in the active watchlist (#P2). */
.lg .star { display: inline-flex; align-items: center; gap: 2px; margin-right: -4px; padding: 0 5px; height: 18px; border: 1px solid var(--line); background: rgba(252, 252, 252, .88); color: var(--ink-soft); font-size: 11px; line-height: 16px; }
.lg .star:hover, .lg .star:focus-visible { border-color: var(--mag); color: var(--mag); outline: none; }
.lg .star.on { border-color: var(--mag); color: var(--mag); background: rgba(213, 21, 98, .06); }
.lg .wt { pointer-events: auto; cursor: pointer; color: var(--sea); font-size: 12px; }
.lg .wt.hot { color: var(--mustard); }
/* The first row leaves room for the odds pill and camera at the chart's top right. */
.lg[data-pane="0"] { padding-right: 126px; }
/* Download this chart as a picture; the icon stays quiet until hover or keyboard focus. */
.chart .dl { position: absolute; top: 3px; z-index: 4; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; opacity: 0; transition: opacity .12s; /* shown only while the mouse is on the chart: it is not read, and right-click has 保存图片 */ }
.chart:hover .dl, .chart .dl:focus-visible { opacity: 1; }
.chart .dl:hover { background: var(--hover); color: var(--ink); }
.chart .dl:focus-visible, .market-events-toggle:focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }
.lg .cap:hover { text-decoration: underline; }
.lg .rm { color: var(--muted); margin-left: -6px; }
.lg button.rm { border:0; background:transparent; padding:0 2px; font:inherit; }
.lg .comparison { flex-wrap:nowrap; }
.lg .comparison > span { min-width:0; white-space:normal; overflow-wrap:anywhere; }
.lg .comparison button.rm { flex-shrink:0; }
.lg .rm:hover { color: var(--seal); }
.lg .err { color: var(--seal); }
/* One quote row, quiet state information, and one stable row per indicator. */
.legends { container: chart-legend / inline-size; }
.legends .lg { flex-direction:column; flex-wrap:nowrap; gap:1px; overflow-x:hidden; overflow-y:auto; scrollbar-width:thin; }
.legends .lg.is-scrollable { pointer-events:auto; }
.legend-row { display:flex; align-items:center; flex-shrink:0; gap:8px; width:max-content; max-width:100%; min-height:22px; line-height:20px; background:color-mix(in srgb, var(--chart-bg) 92%, transparent); }
.legend-symbol { flex-wrap:wrap; gap:0 8px; }
.legend-symbol .title { white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.legend-symbol-code, .legend-period, .legend-adjustment { color:var(--ink-soft); font-weight:normal; }
.legend-adjustment { font-size:11px; }
.legend-values { display:inline-flex; align-items:center; gap:8px; min-width:0; overflow:hidden; }
.legend-symbol > .legend-values { display:contents; }
.legend-field { display:inline-flex; align-items:baseline; flex-shrink:0; gap:4px; white-space:nowrap; }
.legend-field-label { color:var(--ink-soft); }
.legend-value { font-variant-numeric:tabular-nums; }
.legend-value.strong { font-weight:600; }
.legend-values[hidden], .legend-hidden-label[hidden] { display:none; }
.legend-status { min-height:16px; line-height:16px; font-size:11px; color:var(--muted); flex-wrap:wrap; }
.legend-status .legend-values { flex-wrap:wrap; }
.legend-status .legend-field { white-space:normal; }
.legend-indicator, .legend-comparison { pointer-events:auto; }
.legends .cap { min-width:0; max-width:240px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex-shrink:0; }
.legends button.cap { border:0; background:transparent; padding:0; color:inherit; font:inherit; line-height:inherit; text-align:left; }
.legend-actions { display:inline-flex; align-items:center; flex-shrink:0; gap:0; opacity:0; pointer-events:none; }
.legend-row:hover .legend-actions, .legend-row:focus-within .legend-actions { opacity:1; pointer-events:auto; }
.legend-actions button, .legend-collapse button { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:24px; height:24px; padding:3px; border:0; border-radius:0; background:transparent; color:var(--ink-soft); cursor:pointer; }
.legend-actions button:hover, .legend-collapse button:hover { background:var(--hover); color:var(--ink); }
.legends .legend-actions .rm { margin:0; padding:3px; }
.legend-actions .rm:hover { color:var(--seal); }
.legend-actions svg, .legend-collapse svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.4; stroke-linecap:round; stroke-linejoin:round; }
.legend-actions [aria-pressed="true"] .eye-slash { display:none; }
.legend-actions button:focus-visible, .legend-collapse button:focus-visible, .legends button.cap:focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.legend-row.is-hidden .cap, .legend-hidden-label { color:var(--muted); }
.legend-hidden-label { font-size:11px; }
.legend-collapse { background:transparent; min-height:20px; }
.legend-collapse button { width:auto; min-width:28px; gap:3px; pointer-events:auto; border:1px solid var(--line); background:color-mix(in srgb, var(--chart-bg) 92%, transparent); }
.legend-collapse [aria-expanded="true"] svg { transform:rotate(180deg); }
@container chart-legend (max-width:540px) {
  .legend-indicator, .legend-comparison { display:grid; grid-template-columns:minmax(0,1fr) auto; width:100%; gap:0 8px; }
  .legends .legend-indicator > .cap, .legends .legend-comparison > .cap { max-width:100%; }
  .legend-indicator > .legend-values, .legend-comparison > .legend-values { grid-column:1 / -1; grid-row:2; flex-wrap:wrap; gap:0 10px; overflow:visible; }
  .legend-indicator > .legend-actions, .legend-comparison > .legend-actions { grid-column:2; grid-row:1; }
  .legend-hidden-label { grid-column:1 / -1; grid-row:2; }
}
@media (hover:none) {
  .legend-actions { opacity:1; pointer-events:auto; }
}
@media (pointer:coarse), (max-width:720px) {
  .legend-actions { opacity:1; pointer-events:auto; }
  .legend-actions button, .legend-collapse button { min-width:44px; height:44px; }
  .legends button.cap { min-height:44px; }
}

.note-edit { position: absolute; z-index: 6; width: 240px; display: grid; gap: 2px; padding: 3px; border: 1px solid #B8A040; background: #FFFADD; box-shadow: 0 2px 8px rgba(39, 32, 27, .15); }
.note-edit input { font: 12px "Microsoft YaHei", sans-serif; padding: 2px 4px; border: 1px solid var(--line); background: #fff; }
.note-edit input[name=why] { color: var(--ink-soft); }
/* The selected note's 编辑, 删除; the hovered note's card: all its text, why it was noted, who and when. */
.note-bar { position: absolute; z-index: 5; display: flex; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(39, 32, 27, .12); }
.note-bar[hidden], .note-tip[hidden] { display: none; }
.note-bar button { height: 22px; border: 0; background: none; padding: 0 8px; color: var(--ink); font-size: 12px; }
.note-bar button + button { border-left: 1px solid var(--rule); }
.note-bar button:hover { background: var(--hover); }
.note-bar button[data-n=del]:hover { color: var(--seal); }
.note-tip { position: absolute; z-index: 4; max-width: 300px; padding: 6px 9px; background: var(--card); border: 1px solid var(--line); box-shadow: 2px 2px 0 var(--line); pointer-events: none; font-size: 12px; line-height: 18px; }
.note-tip .t { color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.note-tip .why { margin-top: 3px; color: var(--ink-soft); padding-left: 7px; border-left: 2px solid var(--mustard); white-space: pre-wrap; }
.note-tip .m { margin-top: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.note-tip .m span { white-space: nowrap; }
#sprite { position: fixed; right: 16px; bottom: 16px; z-index: 10; width: 320px; background: #fff; border: 1px solid #9A9A9A; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
#sprite[hidden] { display: none; }
#sprite .bar { display: flex; justify-content: space-between; padding: 4px 8px; background: #ECECEC; }
#sprite .bar span { color: var(--muted); font-size: 12px; }
#spriteInput { display: block; width: calc(100% - 12px); margin: 6px; padding: 3px 4px; font: inherit; border: 1px solid #9A9A9A; }
#spriteList { list-style: none; margin: 0 6px 6px; padding: 0; min-height: 180px; max-height: 260px; overflow-y: auto; border: 1px solid #D0D0D0; }
#spriteList li { display: grid; grid-template-columns: 84px 1fr auto; gap: 8px; padding: 2px 6px; cursor: default; }
#spriteList li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } /* codes such as HSTECH.HK, long US names */
#spriteList li.on { background: var(--sel); }
#spriteList li .m { color: var(--muted); }
#spriteList li.empty { display: block; color: var(--muted); }
#pop { position: fixed; z-index: 95; width: 260px; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.15); padding: 8px 10px; display: grid; gap: 6px; }
#pop[hidden] { display: none; }
/* Right-click menus (context-menu.mjs): square, 1px, no shadow; a disabled item says why in small type. */
.ctx-menu { position: fixed; z-index: 95; min-width: 200px; max-width: min(320px, calc(100vw - 8px)); background: #fff; border: 1px solid var(--line); padding: 4px 0; display: grid; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.ctx-menu .ctx-item { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; height: 28px; padding: 0 12px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: default; }
.ctx-menu .ctx-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ctx-menu small { flex: none; color: var(--muted); font-size: 11px; font-family: var(--mono); }
.ctx-menu .ctx-item[aria-disabled] { color: var(--muted); }
.ctx-menu .ctx-item[aria-disabled] small { font-family: inherit; }
.ctx-menu [data-i]:focus, .ctx-menu [data-i]:hover { background: var(--hover); outline: none; }
.ctx-menu .ctx-row { display: flex; align-items: center; gap: 2px; padding: 2px 12px 2px; }
.ctx-menu .ctx-row > span { flex: none; width: 36px; color: var(--muted); }
.ctx-menu .ctx-chip { min-width: 30px; height: 24px; padding: 0 6px; border: 1px solid transparent; background: none; color: var(--ink); font: 12px var(--mono); }
.ctx-menu .ctx-chip.on { background: var(--ink); color: #fff; }
.ctx-menu .ctx-chip.on:focus, .ctx-menu .ctx-chip.on:hover { background: var(--ink); }
.ctx-menu .ctx-chip[aria-disabled] { color: var(--line); }
#pop .pop-title { font-weight: bold; }
#pop label { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#pop input { width: 120px; font: inherit; }
#pop .pop-row { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
#pop .pop-row .grow { flex: 1; }
#pop button { height: 26px; border: 1px solid var(--line); background: #fff; padding: 0 10px; color: var(--ink); }
#pop button:hover { border-color: var(--ink-soft); }
#pop button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
/* The account menu: who on the panel ground (name in serif, the plan as a small tag, the phone under it), then
   sections under small labels (the watch capacity as three meters, what the 幕僚 understands, in its sea blue),
   then rows; 修改密码 opens its fields under it; 退出登录 last and quiet. Signed out, the same head over the forms. */
#pop:has(.acct) { width: 300px; padding: 0; }
#pop .acct { display: grid; }
#pop .acct-head { display: grid; gap: 2px; padding: 12px 14px 10px; background: var(--panel); border-bottom: 1px solid var(--rule); }
#pop .acct-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
#pop .acct-head b { font: 700 15px var(--serif); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pop .acct-plan { flex: none; padding: 0 5px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-size: 11px; line-height: 17px; }
#pop .acct-sub { color: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
#pop .acct-sec { display: grid; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
#pop .acct-label { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
#pop .acct-profile .acct-label { color: var(--sea); }
#pop .acct-quota { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
#pop .acct-quota .q { display: grid; gap: 3px; min-width: 0; }
#pop .acct-quota .q span { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
#pop .acct-quota .q b { font: 600 14px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
#pop .acct-quota .q b i { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
#pop .acct-quota .q s { display: block; height: 3px; background: linear-gradient(var(--ink-soft), var(--ink-soft)) no-repeat 0 0 / var(--q) 100%, var(--rule); }
#pop .acct-quota .q.near b { color: var(--mustard); }
#pop .acct-quota .q.near s { background: linear-gradient(var(--mustard), var(--mustard)) no-repeat 0 0 / var(--q) 100%, var(--rule); }
#pop button.link { height: auto; border: 0; padding: 0; background: none; color: var(--muted); font-size: 12px; }
#pop button.link:hover { color: var(--seal); }
/* Signed out: the WeChat QR first, the phone form behind a small link, 用账号密码登录 further behind. */
#pop .acct-lede { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 18px; }
#pop .acct-phone-toggle { padding: 0; text-align: inherit; }
#pop .acct-phone-toggle[hidden] { display: none; }
#pop .acct-tabs { display: flex; gap: 20px; padding: 0 14px; border-bottom: 1px solid var(--rule); }
#pop .acct-tabs[hidden] { display: none; }
#pop .acct-tabs button { height: 34px; border: 0; border-bottom: 2px solid transparent; padding: 0; background: none; color: var(--muted); }
#pop .acct-tabs button.on { border-bottom-color: var(--mag); color: var(--ink); }
#pop .acct-tabs button:hover { color: var(--ink); }
#pop .acct-inline { display: flex; gap: 6px; }
#pop .acct-inline input { flex: 1; min-width: 0; }
#pop .acct-inline button { flex: none; height: 28px; }
#pop button.acct-go { height: 32px; margin-top: 2px; }
#pop .acct-fine { margin: 0; color: var(--muted); font-size: 11px; text-align: center; }
#pop .acct-note { margin: 0; padding: 6px 8px; border-left: 2px solid var(--mustard); background: var(--panel); color: var(--ink-soft); font-size: 12px; line-height: 18px; }
#pop .acct-note[hidden] { display: none; }
#pop .acct-alt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 10px; }
#pop .acct-alt .grow { flex: 1; }
#pop .acct-alt button { white-space: nowrap; }
#pop .acct-alt + .acct-form, #pop .acct-alt + .acct-form + .acct-forgot { border-top: 1px solid var(--rule); }
#pop .acct-head + .acct-pw { padding-top: 12px; }
/* The account service's page around the official 300px QR is 320 x 470; this window shows the QR and its margin only. */
#pop .acct-wx { display: grid; justify-items: center; gap: 6px; padding: 14px 14px 10px; }
#pop .acct-wx[hidden] { display: none; }
#pop .wx-box { width: 180px; height: 180px; overflow: hidden; background: #fff; }
#pop .wx-frame { width: 320px; transform: scale(calc(180 / 290)); transform-origin: top left; }
#pop .wx-frame iframe { display: block; width: 320px; max-width: none; border: 0; transform: translate(-15px, -87px); }
#pop .acct-items { display: grid; }
#pop button.acct-item, #pop a.acct-item { display: flex; align-items: center; gap: 8px; height: 36px; border: 0; border-bottom: 1px solid var(--rule); padding: 0 14px; text-align: left; text-decoration: none; color: var(--ink); background: none; font: 13px var(--sans); }
#pop button.acct-item:hover, #pop button.acct-item.on, #pop a.acct-item:hover { background: var(--hover); }
#pop .acct-item .muted { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; text-align: right; }
#pop .acct-item i { margin-left: auto; font-style: normal; color: var(--muted); transition: transform .15s; }
#pop .acct-item .muted + i { margin-left: 0; }
#pop .acct-item.on i { transform: rotate(90deg); }
#pop button.acct-item.acct-out { border-bottom: 0; color: var(--muted); }
#pop button.acct-item.acct-out:hover { color: var(--ink); }
#pop .acct-items .acct-form { border-bottom: 1px solid var(--rule); background: var(--panel); }
#pop .acct-form { display: grid; gap: 8px; padding: 12px 14px; }
#pop .acct-form[hidden] { display: none; }
#pop .acct-form label { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: 12px; color: var(--ink-soft); }
#pop .acct-form input { width: auto; height: 28px; padding: 0 6px; border: 1px solid var(--line); color: var(--ink); }
#pop .acct-form input:focus { outline: none; border-color: var(--ink-soft); }
#pop .acct-forgot { border-top: 1px solid var(--rule); }
#pop .acct-forgot p { margin: 0; font-size: 12px; line-height: 18px; }
#pop .acct-form hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--rule); }
#pop .acct-err { color: var(--seal); font-size: 12px; }
#pop .acct-err.notice { color: var(--ink-soft); }
#pop .acct-err:empty { display: none; }
/* 邀请朋友 (invite.mjs ownInvites) */
#pop .acct-invite p { margin: 0; font-size: 12px; line-height: 18px; }
#pop .ivo-left { color: var(--ink); }
#pop .ivo-left b { font-family: var(--serif); font-size: 15px; color: var(--mag); font-variant-numeric: tabular-nums; }
#pop .ivo-make { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#pop .ivo-make label { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; color: var(--muted); font-size: 11px; }
#pop .ivo-make input, #pop .ivo-make select { width: 100%; min-width: 0; height: 30px; padding: 0 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
#pop [name="ivo-note"] { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
#pop .ivo-actions { display: block; }
#pop .ivo-actions .primary { width: 100%; height: 32px; }
#pop .ivo-msg { font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
#pop .ivo-msg.err { color: var(--seal); }
#pop .ivo-msg:empty { display: none; }
#pop .ivo-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 200px; overflow-y: auto; font-size: 12px; }
#pop .ivo-links li { display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
#pop .ivo-links li > span { flex: 1; min-width: 0; display: grid; }
#pop .ivo-links button { height: 24px; padding: 0 8px; font-size: 12px; }
#pop .ivo-hint { font-size: 11px; line-height: 16px; color: var(--muted); }
#pop .ivo-make .primary:disabled { opacity: .6; cursor: default; }
/* The invite sign-in: the same account panel, moved into a native dialog so it is one modal step, not a bubble. */
#auth { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 0; background: transparent; overscroll-behavior: contain; }
#auth::backdrop { background: rgba(39,32,27,.56); overscroll-behavior: contain; }
#pop.pop-modal { position: static; width: 100%; max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; padding: 0; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
#pop.pop-modal .acct-head { position: relative; padding-right: 42px; }
#pop .acct-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
#pop .acct-x:hover { color: var(--ink); }
#pop .acct-code { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }
#pop .acct-code b { color: var(--ink); font: 600 12px var(--mono); letter-spacing: .04em; }
#pop .acct-code span:last-child { margin-left: auto; color: var(--mag); }
#pop .pop-profile { max-height: 220px; overflow-y: auto; display: grid; gap: 6px; font-size: 12px; line-height: 18px; color: var(--ink); }
#pop .pf { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; }
#pop .pf .k { color: var(--muted); white-space: nowrap; }
#pop .pf .t { cursor: pointer; min-width: 0; }
#pop .pf .t:hover { color: var(--sea); }
#pop .pf .t input { width: 100%; height: 24px; padding: 0 4px; border: 1px solid var(--line); font: inherit; }
#pop .pf .x { cursor: pointer; color: var(--muted); opacity: .4; padding: 0 2px; }
#pop .pf:hover .x { opacity: 1; }
#pop .pf .x:hover { color: var(--seal); }
#pop .pf-asked { color: var(--muted); font-size: 11px; padding-top: 2px; }
/* Market tape at the bottom (tape.mjs): indexes left, wrapping onto a hidden second line when the page is narrow;
   涨跌家数 and the quotes' update time right. */
#tape { display: flex; align-items: center; gap: 12px; height: 22px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#tape .tl { flex: 1; min-width: 0; height: 22px; display: flex; flex-wrap: wrap; column-gap: 18px; overflow: hidden; }
#tape .ti { display: flex; gap: 6px; align-items: center; height: 22px; cursor: pointer; }
#tape .ti:hover b { text-decoration: underline; }
#tape .ti b { font-weight: normal; color: var(--ink); }
#tape .ti i { font-style: normal; color: var(--muted); }
#tape .tr { display: flex; gap: 14px; align-items: center; }
#tape .tb { display: flex; gap: 3px; align-items: center; color: var(--muted); }
#tape .tb b { font-weight: normal; color: var(--ink); margin-right: 4px; }
#tape .bar { display: flex; width: 60px; height: 6px; background: var(--down); }
#tape .bar .up { background: var(--up); }
#tape .bar .flat { background: var(--muted); }
#tape .tf { color: var(--muted); }
#tape .tf.late { color: var(--seal); }
#tape .up { color: var(--up); }
#tape .down { color: var(--down); }
@media (max-width: 720px) {
  #cols { display: none; }
  #cols.mobile-open:not([hidden]) { position: absolute; inset: 0 0 0 auto; z-index: 6; display: grid; width: min(100%, 380px); grid-template-columns: minmax(0, 1fr) !important; overflow: auto; }
  #cols.mobile-open > .bcol { min-height: 240px; }
  #cols.mobile-open .bcol-pill, #cols.mobile-open .bcol-act-btn, #cols.mobile-open .rows li[data-s] { min-height: 44px; }
  #cols.mobile-open .cgrip { display: none; }
  #status { display: none; }
  #tape .tb { display: none; }
}
#boards { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; outline: none; }
#boards[hidden] { display: none; }
#boards .dlg { position: relative; width: min(820px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid #9A9A9A; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#boards .dlg-title { display: flex; justify-content: space-between; padding: 5px 10px; background: var(--ink); color: #fff; }
#boards .dlg-title span { cursor: pointer; padding: 0 4px; }
#boards .dlg-pane { flex: 1; display: flex; gap: 8px; padding: 8px; min-height: 0; }
#boards .grid { flex: 1; overflow-y: auto; background: #fff; border: 1px solid var(--line); padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-content: start; gap: 1px 6px; }
#boards .grid > div { padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; user-select: none; }
#boards .grid > div:hover { background: var(--hover); }
#boards .grid > div.on { background: var(--sel); }
#boards .boards > div::before { content: "📁 "; }
#boards .boards > div.cur { color: var(--sea); font-weight: bold; }
/* Boards an agent made (by: agent, src/tools.mjs board_save). */
#boards .boards > div.agent::after { content: " AI"; font-size: 10px; }
#boards .boards > div.holdings::after { content: " 持仓"; font-size: 10px; color: var(--mag); }
#boards .stocks > div.over { box-shadow: inset 0 -2px 0 var(--sea); }
#boards .stocks i { color: var(--muted); font-style: normal; font-size: 11px; margin-left: 6px; }
#boards .grid > div.empty { grid-column: 1 / -1; color: var(--muted); white-space: normal; }
#boards .grid input.rename { font: inherit; width: 100%; }
#boards .btns { width: 128px; display: flex; flex-direction: column; gap: 6px; }
#boards .btns button { width: 100%; padding: 4px 0; border: 1px solid var(--line); background: #fff; }
#boards .btns button:disabled { color: var(--muted); }
#boards .pair { display: flex; gap: 6px; }
#boards .drop-btn { position: relative; }
#boards .menu { position: absolute; right: 0; top: 100%; z-index: 2; min-width: 150px; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#boards .menu div { padding: 4px 10px; cursor: pointer; white-space: nowrap; }
#boards .menu div:hover { background: var(--sel); }
#boards .dlg-mid { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; padding: 0 8px; }
#boards .dlg-mid .find { width: 90px; font: inherit; }
#boards .board-provenance { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 4px 8px 0; font-size: 12px; color: var(--ink-soft); }
#boards .board-provenance label { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 220px; }
#boards .board-why-input { flex: 1; min-width: 140px; font: inherit; padding: 2px 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
#boards .board-formula-note { max-width: 100%; font: 11px var(--mono); color: var(--sea); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#boards .dlg-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
#boards .dlg-foot .msg { color: var(--muted); }
#boards .dlg-foot .msg.warn { color: var(--seal); }
#boards .dlg-foot button { padding: 3px 28px; border: 1px solid var(--line); background: #fff; }
#boards .imp { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border: 1px solid #9A9A9A; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
#boards .imp[hidden] { display: none; }
#boards .imp-title { font-weight: bold; }
#boards .imp-drop { padding: 14px; border: 1px dashed #9A9A9A; text-align: center; color: var(--muted); }
#boards .imp-drop[hidden], #boards .imp-board[hidden] { display: none; }
#boards .imp textarea { height: 150px; font: 12px/1.5 Consolas, monospace; resize: vertical; }
#boards .imp-preview { max-height: 220px; overflow-y: auto; font-size: 12px; }
#boards .imp-preview .old { color: var(--muted); text-decoration: line-through; }
#boards .imp-preview .missed { color: #B05A00; margin-top: 4px; }
#boards .imp-preview .sug { display: inline-block; margin: 1px 2px; padding: 0 4px; border: 1px solid #D0B090; color: var(--ink, #3C3C3C); cursor: pointer; }
#boards .imp-preview .sug.on { background: #FFE8C8; border-color: #B05A00; }
#boards .imp-btns { display: flex; justify-content: flex-end; gap: 8px; }
#boards .imp-btns button { padding: 3px 16px; border: 1px solid var(--line); background: #fff; }
#layouts { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; outline: none; }
#layouts[hidden] { display: none; }
#layouts .dlg { width: min(520px, calc(100vw - 32px)); height: min(400px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid #9A9A9A; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#layouts .dlg-title { display: flex; justify-content: space-between; padding: 5px 10px; background: var(--ink); color: #fff; }
#layouts .dlg-title span { cursor: pointer; padding: 0 4px; }
#layouts .dlg-pane { flex: 1; display: flex; gap: 8px; padding: 8px; min-height: 0; }
#layouts .list { flex: 1; overflow-y: auto; background: #fff; border: 1px solid var(--line); }
#layouts table { width: 100%; border-collapse: collapse; }
#layouts th { position: sticky; top: 0; background: #F4F4F4; font-weight: normal; color: var(--muted); text-align: left; padding: 2px 8px; border-bottom: 1px solid var(--line); }
#layouts td { padding: 2px 8px; white-space: nowrap; cursor: default; user-select: none; }
#layouts tr:hover td { background: var(--hover); }
#layouts tr.on td { background: var(--sel); }
#layouts tr.cur td:first-child { color: var(--sea); font-weight: bold; }
#layouts td input.rename { font: inherit; width: 100%; }
#layouts .btns { width: 128px; display: flex; flex-direction: column; gap: 6px; }
#layouts .btns button { width: 100%; padding: 4px 0; border: 1px solid var(--line); background: #fff; }
#layouts .btns button:disabled { color: var(--muted); }
#layouts .drop-btn { position: relative; }
#layouts .menu { position: absolute; right: 0; top: 100%; z-index: 2; min-width: 150px; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#layouts .menu[hidden] { display: none; }
#layouts .menu div { padding: 4px 10px; cursor: pointer; white-space: nowrap; }
#layouts .menu div:hover { background: var(--sel); }
#layouts .links { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 0 8px 8px; }
#layouts .links[hidden] { display: none; }
#layouts .links b { font-weight: normal; color: var(--muted); }
#layouts .links label { white-space: nowrap; }
#layouts .dlg-foot button { white-space: nowrap; }
#layouts .dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
#layouts .dlg-foot .msg { color: var(--muted); }
#layouts .dlg-foot button { padding: 3px 28px; border: 1px solid var(--line); background: #fff; }
#formulas { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; outline: none; }
#formulas[hidden], #formulas [hidden] { display: none !important; }
#formulas .dlg { width: min(920px, calc(100vw - 32px)); height: min(620px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid #9A9A9A; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#formulas .dlg-title { display: flex; justify-content: space-between; padding: 5px 10px; background: var(--ink); color: #fff; }
#formulas .dlg-title [data-a] { cursor: pointer; padding: 0 4px; }
#formulas .dlg-pane { flex: 1; display: flex; gap: 8px; padding: 8px; min-height: 0; }
#formulas .nav { width: 150px; display: flex; flex-direction: column; gap: 1px; }
#formulas .nav .h { color: var(--muted); font-size: 12px; padding: 8px 8px 2px; }
#formulas .nav [data-sec] { padding: 4px 10px; cursor: pointer; user-select: none; }
#formulas .nav [data-sec]:hover { background: var(--hover); }
#formulas .nav [data-sec].on { background: var(--sel); font-weight: bold; }
#formulas .nav button { margin-top: 6px; }
#formulas .main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#formulas .find { font: inherit; padding: 4px 8px; border: 1px solid var(--line); }
#formulas .chips { display: flex; flex-wrap: wrap; gap: 4px; }
#formulas .chips span { padding: 1px 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12px; }
#formulas .chips span.on { background: var(--ink); border-color: var(--ink); color: #fff; }
#formulas .rows { flex: 1; overflow-y: auto; background: #fff; border: 1px solid var(--line); }
#formulas .item { display: grid; grid-template-columns: 22px 110px 1fr auto auto; gap: 2px 8px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--rule); }
#formulas .item:hover, #formulas .item.sel { background: var(--hover); }
#formulas .item.sel .acts { visibility: visible; }
#formulas .item .star { color: var(--mustard); cursor: pointer; text-align: center; }
#formulas .item .nm { font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
#formulas .item .ti { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#formulas .item .ti i { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--rule); padding: 0 4px; margin-left: 6px; }
#formulas .item .by { color: var(--muted); font-size: 12px; white-space: nowrap; }
#formulas .item .acts { display: flex; gap: 4px; visibility: hidden; }
#formulas .item:hover .acts { visibility: visible; }
#formulas .item .acts button { padding: 1px 8px; font-size: 12px; }
#formulas .item .desc { grid-column: 3 / -1; color: var(--muted); font-size: 12px; }
#formulas .item .desc .pv { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#formulas .item .desc .full, #formulas .item .desc.open .pv { display: none; }
#formulas .item .desc.open .full { display: block; color: var(--ink); line-height: 1.6; }
#formulas .item .desc .full p, #formulas .item .desc .full ul { margin: 2px 0; }
#formulas .item .desc .full ul { padding-left: 18px; }
#formulas .item .desc[data-a=more] { cursor: pointer; }
#formulas .item .desc a { cursor: pointer; text-decoration: underline; }
#formulas .rows .empty { padding: 16px; color: var(--muted); }
#formulas .row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
#formulas .grow { flex: 1; }
#formulas label { display: inline-flex; gap: 6px; align-items: center; }
#formulas label.wide input { flex: 1; }
#formulas input, #formulas select, #formulas textarea { font: inherit; }
#formulas input[name=name] { width: 110px; text-transform: uppercase; }
#formulas textarea { flex: 1; min-height: 140px; resize: none; font-family: Consolas, 'Noto Sans Mono CJK SC', monospace; font-size: 13px; padding: 6px; border: 1px solid var(--line); }
#formulas .tabs [data-tab] { padding: 2px 12px; border: 1px solid var(--line); border-bottom: none; cursor: pointer; color: var(--muted); }
#formulas .tabs [data-tab].on { color: inherit; background: #fff; font-weight: bold; }
#formulas .row.tabs { gap: 0 4px; margin-bottom: -6px; }
#formulas textarea.usage { font-family: inherit; font-size: 13px; line-height: 1.6; }
/* The formula field (code-field.mjs): the textarea's text is transparent over a <pre> of the same text, coloured;
   both in one grid cell with the same font, padding and no wrapping, so each character sits over its colour. */
.code-field { min-height: 140px; display: grid; grid-template: minmax(0, 1fr) / auto minmax(0, 1fr); border: 1px solid var(--line); background: #fff; }
#formulas .code-field { flex: 1; }
.code-field[hidden] { display: none; }
.code-field > * { grid-area: 1 / 2; margin: 0; min-height: 0; border: 0; padding: 6px 6px 6px 10px; font: 13px/1.5 Consolas, 'Noto Sans Mono CJK SC', monospace; white-space: pre; tab-size: 4; }
.code-field pre { overflow: hidden; padding: 6px 26px 6px 10px; color: var(--ink); pointer-events: none; }
.code-field pre.lines { grid-area: 1 / 1; padding: 6px 6px 6px 8px; min-width: 2ch; text-align: right; color: var(--muted); background: var(--panel); border-right: 1px solid var(--line); user-select: none; }
.code-field pre.lines b { color: var(--seal); }
.code-field textarea { color: transparent; caret-color: var(--ink); background: transparent; overflow: auto; resize: none; }
.code-field textarea:disabled { cursor: default; }
.code-field .op, .code-field .attr, .code-field .color { color: var(--slate); }
.code-field .comment { color: var(--muted); font-style: italic; }
.code-field .drawn { position: relative; font-weight: 600; }
.code-field .drawn::before { content: ''; position: absolute; left: -8px; top: 2px; bottom: 2px; width: 4px; background: var(--c, var(--line)); }
.code-field .mid { opacity: .45; }
.code-field .err, .code-field .bad { text-decoration: underline wavy var(--seal); text-decoration-skip-ink: none; }
.code-field .gap { position: relative; }
.code-field .gap::after { content: ''; position: absolute; left: 0; bottom: -3px; width: 1ch; border-bottom: 2px solid var(--seal); }
/* The 用法 field (md-field.mjs): full Markdown preview by default; clicking switches to full Markdown textarea. */
#formulas .md-field { flex: 1; min-height: 140px; display: flex; flex-direction: column; position: relative; }
#formulas .md-field[hidden] { display: none; }
#formulas .md-view { flex: 1; overflow: auto; padding: 6px 10px; background: #fff; border: 1px solid var(--line); line-height: 1.65; cursor: text; }
#formulas .md-view:not(.off):hover { border-color: var(--ink-soft); }
#formulas .md-view.off { cursor: default; background: var(--card); }
#formulas .md-view p { margin: 4px 0; }
#formulas .md-view h4 { margin: 10px 0 2px; font-size: 13px; }
#formulas .md-view ul, #formulas .md-view ol { margin: 4px 0; padding-left: 20px; }
#formulas .md-view code { font-family: var(--mono); font-size: 12px; background: var(--panel); padding: 0 3px; }
#formulas .md-view .blk.empty { color: var(--muted); }
#formulas textarea.usage { padding: 6px 10px; line-height: 1.65; background: #fff; border: 1px solid var(--ink); outline: none; }
#formulas .live { font-size: 12px; color: var(--muted); min-height: 1.4em; }
#formulas .live.err { color: var(--seal); }
#formulas .out { margin: 0; max-height: 130px; overflow: auto; padding: 6px; background: #fff; border: 1px solid var(--line); font-size: 12px; white-space: pre-wrap; }
#formulas .out:empty { display: none; }
#formulas .out.err { color: var(--seal); }
#formulas .owner, #formulas .muted { color: var(--muted); }
#formulas .dlg:has(.main.tokens:not([hidden])) { height: min(740px, calc(100vh - 32px)); }
#formulas .main.tokens { overflow-y: auto; gap: 12px; padding: 4px 4px 8px; }
#formulas .tokens a { color: var(--sea); text-decoration: none; }
#formulas .tokens a:hover { text-decoration: underline; }
#formulas .tokens code { font: 12px var(--mono); background: var(--paper); padding: 1px 4px; border: 1px solid var(--rule); white-space: nowrap; }
#formulas .tk-sec { flex: none; display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); padding: 12px 14px; }
#formulas .tk-tbl-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); background: #fff; }
#formulas .tk-tbl-wrap table { border: 0; }
#formulas .tk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
#formulas .tk-head b { display: block; font: 600 14px/1.4 var(--serif); color: var(--ink); margin-bottom: 2px; }
#formulas .tk-head .muted { display: block; font-size: 12px; line-height: 1.5; }
#formulas .tk-doc { flex: none; font-size: 12px; padding: 3px 8px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
#formulas .tokens table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 12.5px; }
#formulas .tokens th { background: var(--panel); font-weight: 500; color: var(--ink-soft); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
#formulas .tokens td { padding: 6px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
#formulas .tokens tbody tr:last-child td { border-bottom: 0; }
#formulas .tokens .tk-act-col { text-align: right; width: 72px; white-space: nowrap; }
#formulas .tokens input:not([type=checkbox]), #formulas .tokens select { height: 28px; padding: 0 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
#formulas .tokens input:focus, #formulas .tokens select:focus { outline: none; border-color: var(--ink); }
#formulas .tk-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); }
#formulas .tk-row-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
#formulas .tk-name-lbl { flex: 1; min-width: 240px; font-weight: 500; }
#formulas .tk-name-lbl input { flex: 1; min-width: 180px; }
#formulas .tk-scopes { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12.5px; }
#formulas .tk-scopes label { gap: 4px; cursor: pointer; }
#formulas .tk-ops { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; border-left: 3px solid var(--mag); background: #fff; }
#formulas .tk-ops-main b { display: block; font: 600 14px/1.4 var(--serif); color: var(--ink); margin-bottom: 2px; }
#formulas .tk-ops-main .muted { display: block; font-size: 12px; }
#formulas a.tk-ops-btn { flex: none; padding: 5px 12px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
#formulas a.tk-ops-btn:hover { background: var(--ink-soft); text-decoration: none; }
#formulas .tk-staff-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; }
#formulas .tk-staff-bar .names { display: flex; flex-wrap: wrap; gap: 6px; }
#formulas .tk-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
#formulas .tk-chip button { padding: 0 5px; height: 20px; border: 0; border-left: 1px solid var(--rule); background: none; color: var(--muted); }
#formulas .tk-chip button:hover { color: var(--seal); background: var(--paper); }
#formulas .tk-admin-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; background: var(--paper); border: 1px solid var(--rule); }
#formulas .tk-target { font-weight: 500; }
#formulas .tk-target input { width: 140px; }
#formulas .tk-action-group { display: inline-flex; align-items: center; gap: 4px; }
#formulas .betas .num, #formulas .tokens .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
#formulas .betas .low { color: var(--mustard); font-weight: 600; }
#formulas .betas .out { color: var(--seal); font-weight: 600; }
#formulas .tk-beta-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#formulas .tk-beta-add [name=bname] { flex: 1; min-width: 240px; }
#formulas .betas [name=bamount], #formulas .invites [name=iamount] { width: 5.5em; font-family: var(--mono); }
#formulas .invites [name=iphone] { width: 9.5em; font-family: var(--mono); }
#formulas .invites [name=inote] { flex: 1; min-width: 180px; }
#formulas .invites .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
#formulas button { padding: 3px 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
#formulas button:disabled { opacity: .6; cursor: default; }
#formulas button.pri { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
#formulas button.pri.ok { background: var(--ink); border-color: var(--ink); color: #fff; }
#formulas button.pri.err { background: var(--seal); border-color: var(--seal); color: #fff; }
#formulas .edit .status { font-size: 12px; color: var(--muted); transition: opacity .15s; }
#formulas .edit .status.ok { color: var(--ink); font-weight: 500; }
#formulas .edit .status.err { color: var(--seal); font-weight: 500; }
#formulas .edit .status.pulse { animation: formulaStatusPulse .35s ease-out; }
@keyframes formulaStatusPulse { 0% { opacity: .25; } 100% { opacity: 1; } }
#formulas .dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
#formulas .dlg-foot .msg { color: var(--muted); }
#formulas .dlg-foot .msg.err { color: var(--seal); font-weight: 500; }
#formulas .dlg-foot .msg.ok { color: var(--ink); }
@media (max-width: 600px) {
  #formulas .dlg { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  #formulas .dlg-pane { flex-direction: column; overflow-y: auto; }
  #formulas .nav { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
  #formulas .nav .h, #formulas .nav .grow { display: none; }
  #formulas .nav button { margin-top: 0; }
}
#skills { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; outline: none; }
#skills[hidden], #skills [hidden] { display: none !important; }
#skills .dlg { width: min(920px, calc(100vw - 32px)); height: min(620px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid #9A9A9A; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#skills .dlg-title { display: flex; justify-content: space-between; padding: 5px 10px; background: var(--ink); color: #fff; }
#skills .dlg-title [data-a] { cursor: pointer; padding: 0 4px; }
#skills .dlg-pane { flex: 1; display: flex; gap: 8px; padding: 8px; min-height: 0; }
#skills .nav { width: 150px; display: flex; flex-direction: column; gap: 1px; }
#skills .nav .h { color: var(--muted); font-size: 12px; padding: 8px 8px 2px; }
#skills .nav [data-sec] { padding: 4px 10px; cursor: pointer; user-select: none; }
#skills .nav [data-sec]:hover { background: var(--hover); }
#skills .nav [data-sec].on { background: var(--sel); font-weight: bold; }
#skills .nav button { margin-top: 6px; }
#skills .main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#skills .find { font: inherit; padding: 4px 8px; border: 1px solid var(--line); }
#skills .rows { flex: 1; overflow-y: auto; background: #fff; border: 1px solid var(--line); }
#skills .item { display: grid; grid-template-columns: 22px 110px 1fr auto auto; gap: 2px 8px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--rule); }
#skills .item:hover { background: var(--hover); }
#skills .item .star { color: var(--mustard); cursor: pointer; text-align: center; }
#skills .item .nm { font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
#skills .item .ti { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#skills .item .ti i { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--rule); padding: 0 4px; margin-left: 6px; }
#skills .item .by { color: var(--muted); font-size: 12px; white-space: nowrap; }
#skills .item .acts { display: flex; gap: 4px; visibility: hidden; }
#skills .item:hover .acts { visibility: visible; }
#skills .item .acts button { padding: 1px 8px; font-size: 12px; }
#skills .item .desc { grid-column: 3 / -1; color: var(--muted); font-size: 12px; }
#skills .item .desc .pv { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#skills .item .desc .full, #skills .item .desc.open .pv { display: none; }
#skills .item .desc.open .full { display: block; color: var(--ink); line-height: 1.6; }
#skills .item .desc .full p, #skills .item .desc .full ul { margin: 2px 0; }
#skills .item .desc .full ul { padding-left: 18px; }
#skills .item .desc[data-a=more] { cursor: pointer; }
#skills .item .desc a { cursor: pointer; text-decoration: underline; }
#skills .rows .empty { padding: 16px; color: var(--muted); }
#skills .row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
#skills .grow { flex: 1; }
#skills label { display: inline-flex; gap: 6px; align-items: center; }
#skills label.wide input { flex: 1; }
#skills input, #skills select, #skills textarea { font: inherit; }
#skills textarea { flex: 1; min-height: 140px; resize: none; font-family: Consolas, 'Noto Sans Mono CJK SC', monospace; font-size: 13px; padding: 6px; border: 1px solid var(--line); }
#skills button { padding: 3px 14px; border: 1px solid var(--line); background: #fff; }
#skills .dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
#skills .dlg-foot .msg { color: var(--muted); }
#skills input[name=name] { width: 130px; }
#skills textarea { font-family: inherit; line-height: 1.6; }
#skills .item .ti { color: var(--muted); }
/* 策略 panel (strategy-tester.mjs), on the right: its width is dragged at the left edge (--side-w, one width for 策略
   and 盯住, which take turns in the same place, so switching does not move the chart). Its home lists strategies; an
   opened one has a head (back, name, kind), the scope (这只股 / 全市场组合) and the tabs. */
:root { --side-w: 440px; }
#strat { position: relative; width: var(--side-w); flex: none; border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; font-size: 13px; }
#strat[hidden], #strat [hidden] { display: none !important; }
#strat.on { box-shadow: inset 3px 0 0 var(--sea); } /* strategy mode (main.mjs) */
#strat .sgrip { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; z-index: 3; cursor: col-resize; }
#strat .sgrip:hover, body.resizing #strat .sgrip { background: linear-gradient(to right, transparent 2px, var(--sea) 2px, var(--sea) 4px, transparent 4px); }
#strat .sview { display: flex; flex-direction: column; min-height: 0; flex: none; max-height: 100%; }
#strat:has(.sigs[hidden]) .sview { flex: 1; }
#strat button { font: inherit; font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 2px 10px; cursor: pointer; }
#strat button:hover { border-color: var(--ink-soft); }
#strat .muted { color: var(--muted); font-size: 12px; font-weight: normal; }
#strat .grow { flex: 1; }
/* Head as the other side panels' (幕僚, 行情): a 36px bar on --panel, the name in bold serif. */
#strat .shead, .macro-follow-head { display: flex; align-items: center; gap: 8px; height: 36px; flex: none; padding: 0 6px 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
#strat .shead .stitle, .macro-follow-head strong { font: 700 14px var(--serif); letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#strat .shead > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#strat .beta { flex: none; font: 500 10px/14px var(--mono); letter-spacing: .04em; color: var(--mustard); border: 1px solid currentColor; padding: 0 4px; }
#strat .shead .back { border: 0; padding: 0; color: var(--muted); background: none; }
#strat .shead .back:hover { color: var(--ink); }
#strat .shead [data-act=close] { border: 0; color: var(--muted); padding: 0 2px; background: none; }
#strat .seg { display: inline-flex; }
#strat .seg button + button { border-left: 0; }
#strat .seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#strat .scope { padding: 6px 12px; }
#strat .stabs { display: flex; gap: 18px; padding: 0 12px; border-bottom: 1px solid var(--line); }
#strat .stabs button { border: 0; border-bottom: 2px solid transparent; padding: 4px 0; font-size: 13px; color: var(--ink-soft); background: none; }
#strat .stabs button.on { border-bottom-color: var(--mag); color: var(--ink); font-weight: 500; }
#strat .err { padding: 2px 12px; color: #B05A00; background: #FFF6E5; font-size: 12px; white-space: pre-wrap; max-height: 64px; overflow: auto; }
#strat .sbody { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
#strat .sbody > * { flex-shrink: 0; }
#strat .sbody:empty { display: none; }
#strat .empty { color: var(--muted); padding: 4px 0; }
#strat .empty button { margin-left: 6px; }
#strat .hint, #strat .foot, #strat .info { color: var(--muted); font-size: 12px; margin: 0; }
#strat .info { font-variant-numeric: tabular-nums; }
#strat .bad { color: var(--seal); }
/* Home & 新建策略 (4 entries) */
#strat .shead .link-btn { border: 0; padding: 0 4px; color: var(--sea); background: none; font-size: 12px; }
#strat .shead .link-btn:hover { text-decoration: underline; }
/* The home's groups are cards like 盯住's (see "策略 and 盯住 lists, one look" below). */
#strat .home { gap: 0; }
#strat .home h4 { margin: 0; min-height: 36px; padding: 0 12px; border-bottom: 1px solid var(--rule); font: 600 14px var(--serif); letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
#strat .home h4 .muted { letter-spacing: 0; }
#strat .home h4 button { margin-left: auto; }
#strat .home .srow { padding: 7px 12px; }
#strat .home .srow:last-child { border-bottom: 0; }
#strat .home .grp > p { margin: 0; padding: 8px 12px 10px; }
#strat .grp.mine { --gc: var(--mag); }
#strat .grp.central { --gc: var(--sea); }
#strat .home h4 a { font: 12px var(--sans); color: var(--sea); text-decoration: none; }
#strat .home h4 a:hover { text-decoration: underline; }
#strat .srow { display: grid; gap: 1px; text-align: left; border: 0; border-bottom: 1px solid var(--rule); padding: 7px 0; background: none; width: 100%; }
#strat .srow:hover { background: var(--hover); }
#strat .srow b { font-weight: 500; font-size: 13px; }
#strat .srow span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#strat .srow i { font-style: normal; font-variant-numeric: tabular-nums; }
#strat .create-view { gap: 12px; }
#strat .create-sec { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
#strat .create-sec:last-of-type { border-bottom: 0; padding-bottom: 2px; }
#strat .create-sec h4 { margin: 0; font-family: var(--serif); font-size: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
#strat .tpl-list { display: grid; gap: 5px; }
#strat .tpl-btn { display: grid; gap: 2px; width: 100%; text-align: left; padding: 7px 9px; background: var(--card); border: 1px solid var(--line); }
#strat .tpl-btn:hover { border-color: var(--ink-soft); background: var(--hover); }
#strat .tpl-btn b { font-weight: 500; font-size: 13px; color: var(--ink); line-height: 1.4; }
#strat .tpl-btn span { font-size: 12px; color: var(--muted); line-height: 1.4; }
#strat .create-stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#strat .create-stack select, #strat .create-stack input, #strat .create-stack textarea { width: 100%; min-width: 0; font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 5px 7px; }
#strat .create-stack textarea { resize: vertical; line-height: 1.5; }
#strat .file-btn { display: inline-flex; align-items: center; font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 2px 10px; cursor: pointer; }
#strat .file-btn:hover { border-color: var(--ink-soft); }
#strat .cfile-names { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#strat .create-msg { font-size: 12px; line-height: 1.5; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); padding: 6px 8px; overflow-wrap: anywhere; }
#strat .create-msg:empty { display: none; }
/* 结果 */
#strat .verdict { margin: 0; font-size: 15px; line-height: 1.6; }
#strat .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
#strat .card { display: flex; flex-direction: column; background: var(--card); padding: 6px 10px; }
#strat .card span { color: var(--muted); font-size: 12px; }
#strat .card b { font-family: var(--num); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
#strat .card i { font-style: normal; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#strat .curves { width: 100%; height: 110px; display: block; }
#strat .legend { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); margin-top: -6px; }
#strat .legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin: 0 3px 0 0; }
#strat .legend .bh { margin-left: 10px; }
#strat .legend .eq { background: var(--sea); } #strat .legend .bh { background: var(--series-bench); }
#strat .rquick { display: inline-flex; gap: 2px; }
#strat .rquick button { border: 0; background: none; color: var(--muted); font-size: 11px; padding: 1px 5px; }
#strat .rquick button:hover { color: var(--ink); }
#strat .rquick button.on { color: var(--ink); background: var(--sel); font-weight: 500; }
#strat .more { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
#strat .more summary { cursor: pointer; color: var(--ink); }
#strat .claimed { color: var(--ink-soft); font-size: 12px; }
#strat .idea { color: var(--ink-soft); margin: 0; }
#strat .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#strat .acts a { color: var(--ink-soft); font-size: 12px; border: 1px solid var(--line); padding: 1px 10px; text-decoration: none; }
#strat .acts a:last-child:not(:first-child) { margin-left: auto; }
#strat .acts .danger { color: var(--seal); }
/* 信号 of 这只股 */
#strat table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
#strat .tt { width: 100%; }
#strat .tt th { position: sticky; top: -10px; background: var(--panel); color: var(--muted); font-weight: normal; text-align: left; padding: 2px 6px; }
#strat .tt td { padding: 1px 6px; white-space: nowrap; }
#strat .tt tr:hover td { background: var(--hover); cursor: pointer; }
/* 参数 */
#strat .from { color: var(--muted); font-size: 12px; }
#strat .from input { font: inherit; font-size: 12px; }
#strat .ps { display: grid; gap: 6px; }
#strat .ps label { display: grid; grid-template-columns: 76px 1fr 64px 52px; gap: 6px; align-items: center; }
#strat .ps span { overflow: hidden; text-overflow: ellipsis; }
#strat .ps input[type=number] { font: inherit; width: 100%; }
#strat .ps i { font-style: normal; color: var(--muted); font-size: 11px; }
/* 规则: Layer 1 规则卡 -> Layer 2 公式源码 -> Layer 3 高级 JSON */
#strat .rule-card-host { display: flex; flex-direction: column; gap: 8px; }
#strat .src { color: var(--ink-soft); font-size: 12px; }
#strat .src a { color: var(--sea); text-decoration: none; }
#strat .rule-card { background: var(--card); border: 1px solid var(--line); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
#strat .rule-stat { font-size: 12px; color: var(--ink-soft); padding-bottom: 4px; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
#strat .rule-stat .ok { color: var(--sea); } #strat .rule-stat .substitute { color: var(--mustard); } #strat .rule-stat .missing { color: var(--seal); }
#strat .map { list-style: none; margin: 0; padding: 0; }
#strat .map li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 0 6px; padding: 6px 0; border-bottom: 1px solid var(--rule); line-height: 1.5; }
#strat .map li:last-child { border-bottom: 0; }
#strat .map li > i { font-style: normal; font-weight: 600; }
#strat .map .ok > i { color: var(--sea); } #strat .map .substitute > i { color: var(--mustard); } #strat .map .missing > i { color: var(--seal); }
#strat .map .rtag { display: inline-block; font-size: 11px; font-weight: 500; color: var(--ink-soft); border: 1px solid var(--line); background: #fff; padding: 0 4px; margin-right: 6px; vertical-align: 1px; }
#strat .map em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
#strat .map code { display: block; font: 11px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; margin-top: 1px; }
#strat .exec-line { margin: 2px 0 0; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 11px; line-height: 1.5; color: var(--muted); }
#strat .code-sec, #strat .def { border-top: 1px solid var(--rule); padding-top: 8px; }
#strat .code-sec summary, #strat .def summary { cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 500; user-select: none; }
#strat .def summary { color: var(--ink-soft); font-weight: normal; }
#strat .sec-body { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
#strat .code-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
#strat .code-meta label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); min-width: 0; }
#strat .code-meta label.wide { grid-column: 1 / -1; }
#strat .code-meta input, #strat .code-meta select { flex: 1; min-width: 0; font: inherit; font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 2px 6px; }
#strat .code-field { height: 210px; min-height: 150px; }
#strat .code-status { font-size: 12px; color: var(--muted); min-height: 16px; white-space: pre-wrap; }
#strat .code-status.err { color: var(--seal); }
#strat button.pri { background: var(--ink); color: #fff; border-color: var(--ink); }
#strat .def textarea { min-height: 200px; font: 12px/1.4 var(--mono); resize: vertical; border: 1px solid var(--line); padding: 4px 6px; color: var(--ink); background: #fff; }
#strat .def textarea[readonly] { background: var(--panel); }
/* 信号 of 全市场组合: a portfolio run's symbols and trades (strategy.mjs) */
#strat .sigs { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#strat .sigs .tools { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 6px 12px 4px; color: var(--muted); }
#strat .sigs .tools > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#strat .sigs .tools .t-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#strat .sigs .tools a { border: 1px solid var(--line); background: #fff; padding: 2px 8px; font-size: 12px; color: var(--ink); text-decoration: none; white-space: nowrap; }
#strat .sigs .tools a:hover { border-color: var(--ink-soft); }
#strat .sigs .filter { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 12px 4px; }
#strat .sigs .filter button, #strat .sigs .period button { font-size: 12px; border: 0; background: none; color: var(--muted); padding: 1px 6px; }
#strat .sigs .filter .seg { border: 1px solid var(--line); }
#strat .sigs .filter .seg button.on { background: var(--ink); color: #fff; }
#strat .sigs .filter > button.on { color: var(--ink); background: var(--sel); }
#strat .sigs .period { display: flex; align-items: center; gap: 4px; padding: 0 12px 4px; color: var(--muted); }
#strat .sigs .period input { flex: 1; min-width: 0; font: inherit; font-size: 12px; }
#strat .sigs .warn { padding: 2px 12px; color: #B05A00; background: #FFF6E5; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#strat .sigs .empty { padding: 8px 12px; }
#strat .sigs .rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 3; min-height: 80px; }
#strat .sigs .rows li { display: grid; grid-template-columns: 60px 1fr 36px 72px; gap: 4px; padding: 1px 12px; cursor: default; font-variant-numeric: tabular-nums; }
#strat .sigs .rows li:hover, #strat .sigs tr:hover td { background: var(--hover); }
#strat .sigs .rows li.on { background: var(--sel); }
#strat .sigs .n { color: var(--muted); text-align: right; }
#strat .sigs .trips { flex: 2; min-height: 60px; overflow-y: auto; border-top: 1px solid var(--line); }
#strat .sigs .trips .sub { position: sticky; top: 0; padding: 2px 12px; background: var(--panel); color: var(--muted); }
#strat .sigs .trips table { width: 100%; }
#strat .sigs .trips td { padding: 1px 12px; white-space: nowrap; cursor: pointer; }
#strat .sigs .hint { padding: 4px 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  #strat:not([hidden]) { position: absolute; inset: 0; width: auto; z-index: 19; border-left: 0; }
  #strat .sgrip { display: none; }
}
/* The quote list leaves the 幕僚 panel in view: the assistant opens boards while the user reads its answer. */
:root { --chat-w: 360px; }
/* 幕僚 (chat.mjs): a panel on the right on the warm card ground; the user's words dark, the assistant's steps
   quiet with what each found, its answer plain. Its width is dragged at the left edge (--chat-w); the answer keeps a
   reading measure, the extra width goes to steps and cards. */
#chat { position: relative; width: var(--chat-w); max-width: 100%; flex-shrink: 0; min-width: 0; border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
#chat[hidden], #chat [hidden] { display: none !important; }
#chat .ch-grip { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; z-index: 3; cursor: col-resize; }
#chat .ch-grip:hover, body.resizing #chat .ch-grip { background: linear-gradient(to right, transparent 2px, var(--sea) 2px, var(--sea) 4px, transparent 4px); }
body.resizing { cursor: col-resize; user-select: none; }
#chat .grow { flex: 1; }
#chat button { height: 24px; border: 1px solid var(--line); background: #fff; padding: 0 8px; color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
#chat button:hover { border-color: var(--ink-soft); }
#chat button[type=submit] { background: var(--ink); border-color: var(--ink); color: #fff; }
/* Head: the name, 历史 as a tab underlined in magenta when open, 我的技能, then quiet actions and 新对话. */
#chat .ch-head { display: flex; align-items: center; height: 36px; padding: 0 6px 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
#chat .ch-name { display: inline-flex; align-items: center; font: 700 14px var(--serif); letter-spacing: .06em; margin-right: 6px; flex-shrink: 0; }
#chat .ch-name .mark { width: 16px; height: 16px; margin-right: 6px; color: var(--sea); }
#chat .ch-title { padding: 4px 12px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat .ch-title:empty { display: none; }
/* The card of first things after the welcome: a short list, each ticked off in sea blue (the 幕僚's colour) once done. */
#chat .ch-start { margin: 8px 10px 0; padding: 6px 10px 8px; border: 1px solid var(--line); border-left: 3px solid var(--sea); background: #fff; display: grid; gap: 3px; }
#chat .ch-start[hidden] { display: none; }
#chat .ch-start-h { display: flex; gap: 8px; align-items: baseline; font: 700 13px var(--serif); }
#chat .ch-start-h .muted { font: 12px var(--mono); }
#chat .ch-start-h .x { margin-left: auto; cursor: pointer; color: var(--muted); font-weight: normal; }
#chat .ch-start-i { display: flex; gap: 7px; align-items: center; color: var(--ink); }
#chat .ch-start-i[data-a] { cursor: pointer; }
#chat .ch-start-i[data-a]:hover { color: var(--sea); }
#chat .ch-start-i i { flex: none; width: 11px; height: 11px; border: 1px solid var(--ink-soft); }
#chat .ch-start-i.done { color: var(--muted); text-decoration: line-through; }
#chat .ch-start-i.done i { background: var(--sea); border-color: var(--sea); }
#chat .ch-head .ch-view, #chat .ch-head .ch-quiet, #chat .ch-head .ch-x { height: 35px; border: 0; border-bottom: 2px solid transparent; background: none; padding: 2px 5px 0; color: var(--ink-soft); }
#chat .ch-head .ch-view:hover, #chat .ch-head .ch-quiet:hover { color: var(--ink); }
#chat .ch-head .ch-view.on { color: var(--ink); border-bottom-color: var(--mag); }
#chat .ch-head .ch-new { margin-left: 4px; padding: 0 6px; }
#chat .ch-head button, #chat .ch-head b { white-space: nowrap; }
#chat .ch-head .ch-x { padding: 2px 6px 0; font-size: 16px; color: var(--muted); }
#chat .ch-head .ch-x:hover { color: var(--ink); }
#chat .ch-log { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
#chat .ch-hint { color: var(--muted); max-width: 40em; display: grid; gap: 8px; }
#chat .ch-starters { display: flex; flex-wrap: wrap; gap: 6px; }
#chat .ch-starter { height: 24px; padding: 0 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font: 12px var(--sans); cursor: pointer; }
#chat .ch-starter:hover { border-color: var(--sea); color: var(--sea); }
#chat .ch-q-turn { align-self: flex-end; max-width: min(90%, 36em); min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }
#chat .ch-q-turn.editing { width: 100%; max-width: 100%; align-items: stretch; }
#chat .ch-q { max-width: 100%; min-width: 0; background: var(--ink); color: #fff; padding: 5px 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
#chat .ch-q-acts { display: flex; gap: 4px; margin-top: 2px; font-size: 12px; }
#chat .ch-q-acts button { padding: 0 5px; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); opacity: .6; cursor: pointer; }
#chat .ch-q-acts button:hover { opacity: 1; color: var(--ink); }
#chat .ch-q-edit { display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); }
#chat .ch-q-edit textarea { width: 100%; min-height: 60px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); padding: 4px 6px; resize: vertical; }
#chat .ch-q-keep-att { font-size: 11px; }
#chat .ch-q-edit-btns { display: flex; justify-content: flex-end; gap: 6px; }
#chat .ch-q-edit-btns button { padding: 2px 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
#chat .ch-q-edit-btns button.primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
#chat .ch-a { max-width: 100%; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
#chat .ch-steps { color: var(--muted); font-size: 12px; line-height: 18px; min-width: 0; overflow-wrap: anywhere; }
#chat .ch-steps > summary { cursor: pointer; width: max-content; max-width: 100%; }
#chat .ch-lead { font-size: 16px; line-height: 1.5; margin: 2px 0 8px; }
#chat .ch-step-res { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
#chat .ch-step-err { color: var(--copper); white-space: pre-wrap; }
#chat .ch-wait { color: var(--muted); }
#chat .ch-text { max-width: 40em; min-width: 0; line-height: 1.6; overflow-wrap: anywhere; word-break: break-word; }
#chat .ch-text p { margin: 4px 0; }
#chat .ch-text h4 { margin: 10px 0 2px; font-size: 13px; }
#chat .ch-text ul { margin: 4px 0; padding-left: 18px; }
#chat .ch-text code { font-family: var(--mono); font-size: 12px; background: var(--panel); padding: 0 3px; }
#chat .ch-text pre { margin: 0; font-family: var(--mono); font-size: 11px; white-space: pre; overflow-x: auto; }
:is(#chat .ch-text, .sh-text, .desc .full, .md-view) a { color: var(--sea); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
:is(#chat .ch-text, .sh-text) .ch-meta { margin-top: 8px; font-size: 12px; color: var(--muted); }
#chat .ch-text .ch-meta-sym { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
#chat .ch-text .ch-meta-sym:hover { color: var(--ink); text-decoration-color: currentColor; }
:is(#chat .ch-text, .sh-text) .ch-sources { margin-top: 8px; padding-top: 4px; border-top: 1px dotted var(--rule); font-size: 12px; color: var(--muted); }
:is(#chat .ch-text, .sh-text) .ch-sources > summary { cursor: pointer; width: fit-content; color: var(--muted); user-select: none; }
:is(#chat .ch-text, .sh-text) .ch-sources > summary:hover { color: var(--ink); }
:is(#chat .ch-text, .sh-text) .ch-sources :is(ul, ol) { margin: 4px 0 0; padding-left: 16px; }
/* Tables, rules and numbered lists of markdown() (chat.mjs), wherever it is shown. */
:is(#chat .ch-text, .desc .full, .md-view) :is(ul, ol) { margin: 4px 0; padding-left: 18px; }
:is(#chat .ch-text, .desc .full, .md-view) :is(ul, ol) :is(ul, ol) { margin: 0; }
:is(#chat .ch-text, .desc .full, .md-view) table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 4px 0; font-size: 12px; font-variant-numeric: tabular-nums; }
:is(#chat .ch-text, .desc .full, .md-view) :is(th, td) { border-bottom: 1px solid var(--rule); padding: 2px 10px 2px 0; text-align: left; vertical-align: top; }
:is(#chat .ch-text, .desc .full, .md-view) th { border-bottom-color: var(--line); color: var(--ink-soft); font-weight: 600; }
:is(#chat .ch-text, .desc .full, .md-view) hr { border: 0; border-top: 1px solid var(--rule); margin: 8px 0; }
#chat .ch-err { color: var(--seal); }
#chat .ch-prop { margin-top: 6px; padding: 5px 8px; background: var(--panel); border-left: 2px solid var(--sea); min-width: 0; overflow-wrap: anywhere; }
#chat .ch-map { display: block; margin-top: 6px; max-width: 360px; }
#chat .ch-map img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; }
/* A report: a paper slip with the brand's magenta rule on top, to open or download. */
#chat .ch-report { display: flex; align-items: baseline; gap: 10px; max-width: 40em; margin: 6px 0 2px; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-top: 2px solid var(--mag); color: var(--ink); font-size: 13px; }
#chat .ch-report .k { font: 11px var(--mono); letter-spacing: .14em; color: var(--muted); }
#chat .ch-report b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); }
#chat .ch-report a { color: var(--sea); text-decoration: none; }
#chat .ch-report a:hover { text-decoration: underline; }
#chat .ch-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; }
#chat .ch-acts button { padding: 0 5px; opacity: .55; }
#chat .ch-acts button:hover { opacity: 1; }
#chat .ch-rate { display: flex; align-items: center; flex: 1; min-width: 0; gap: 4px; }
#chat .ch-rate textarea { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--line); font: inherit; line-height: 1.5; resize: vertical; }
#chat .ch-rate:has(textarea) { flex-basis: 100%; flex-wrap: wrap; justify-content: flex-end; }
#chat .ch-rate:has(textarea) textarea { flex-basis: 100%; }
#chat .ch-rate:has(textarea) button { opacity: 1; }
#chat .ch-hist { max-height: 45%; overflow-y: auto; border-bottom: 1px solid var(--line); padding: 4px 12px; background: var(--panel); }
#chat .ch-hrow { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; border-bottom: 1px dotted var(--line); }
#chat .ch-hrow.on .t { font-weight: 600; }
#chat .ch-hrow .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#chat .ch-hrow .t:hover { color: var(--sea); }
#chat .ch-hrow .x { cursor: pointer; color: var(--muted); padding: 0 3px; }
#chat .ch-hrow .x:hover { color: var(--seal); }
#chat .ch-share { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 12px; font-size: 12px; border-bottom: 1px solid var(--line); }
#chat .ch-share a { color: var(--sea); word-break: break-all; }
#chat .ch-ask { border-top: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--panel); }
#chat textarea { width: 100%; font: inherit; border: 1px solid var(--line); padding: 4px 6px; resize: vertical; background: #fff; }
#chat .ch-prop pre { white-space: pre-wrap; font: inherit; margin: 4px 0; }
/* A watch proposal (#148): magenta rule on the left and a halftone paper ground so it stands apart from the answer text. */
#chat .ch-watch { padding: 7px 10px; border: 1px solid var(--line); border-left: 3px solid var(--mag); background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px); background-size: 5px 5px; }
#chat .ch-watch button { margin-top: 4px; }
#chat .ch-watch-status:not(:empty) { margin-top: 6px; padding: 6px 8px; border-left: 2px solid var(--sea); background: var(--card); overflow-wrap: anywhere; }
#chat .ch-watch-status strong { display: block; color: var(--ink); }
#chat .ch-watch-status.ch-err { border-left-color: var(--seal); }
#chat .ch-sym { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
#chat .ch-sym:hover { text-decoration-color: currentColor; }
#chat .ch-watch .pick { float: right; }
#chat .ch-watch-sel { margin-top: 6px; }
#chat .ch-topic-watch .ch-tw-head { font-size: 13px; margin-bottom: 3px; }
#chat .ch-topic-watch .ch-tw-thesis { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; line-height: 1.5; }
#chat .ch-topic-watch .ch-tw-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 6px; padding: 6px 8px; background: var(--card); border: 1px solid var(--rule); }
#chat .ch-topic-watch .ch-tw-item { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.5; cursor: pointer; }
#chat .ch-topic-watch .ch-tw-item input { margin-top: 3px; flex-shrink: 0; }
#chat .ch-topic-watch .ch-tw-badge { font-size: 11px; padding: 0 4px; border: 1px solid var(--rule); background: var(--panel); white-space: nowrap; }
#chat .ch-topic-watch .ch-tw-badge.price { color: var(--ink-soft); border-color: var(--line); }
#chat .ch-topic-watch .ch-tw-badge.fact { color: var(--sea); border-color: var(--line); }
#chat .ch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
#chat .ch-row button.on { border-color: var(--sea); color: var(--sea); }
/* 深度 | 快读: the chosen half lit and lifted over the other, which sits in the shade (the panel ground, muted ink). */
#chat .ch-mode { display: inline-flex; padding: 1px; border: 1px solid var(--line); background: var(--panel); box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
#chat .ch-mode button { height: 22px; border: 0; background: none; color: var(--muted); padding: 0 9px; }
#chat .ch-mode button:hover { color: var(--ink-soft); }
#chat .ch-row .ch-mode button.on { position: relative; background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0,0,0,.18); }
#chat .ch-files { display: flex; flex-wrap: wrap; gap: 4px; }
#chat .ch-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 6px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
#chat .ch-skill-chip { border-color: var(--sea); color: var(--sea); }
#chat .ch-chip i { font-style: normal; font-size: 11px; }
#chat .ch-chip b { font-weight: normal; cursor: pointer; color: var(--muted); }
#chat .ch-skill-pick { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); background: #fff; padding: 4px 6px; font-size: 12px; }
#chat .ch-srow { display: flex; align-items: center; gap: 6px; padding: 3px 4px; cursor: pointer; border-bottom: 1px dotted var(--rule); }
#chat .ch-srow:hover { background: var(--hover); }
#chat .ch-srow i { width: 12px; font-style: normal; color: var(--sea); font-weight: bold; }
#chat .ch-srow b { white-space: nowrap; }
#chat .ch-srow .muted { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat .ch-sfoot { padding: 4px 4px 2px; text-align: right; }
#chat .ch-sfoot a { color: var(--sea); cursor: pointer; }
#chat .ch-sfoot a:hover { text-decoration: underline; }
#chat .ch-orig { font-size: 11px; color: var(--sea); text-decoration: none; margin-left: 4px; } #chat .ch-orig:hover { text-decoration: underline; }
#chat .ch-q details { margin-top: 4px; }
#chat .ch-q summary { cursor: pointer; opacity: .8; font-size: 12px; }
#chat .ch-q pre { max-height: 240px; overflow: auto; white-space: pre-wrap; font: 12px/1.4 var(--sans); margin: 4px 0 0; }
#chat .ch-cost { font-size: 11px; flex-basis: 100%; order: 2; text-align: right; font-variant-numeric: tabular-nums; }
#chat .ch-cost:empty { display: none; }
@media (max-width: 720px) { #chat { position: absolute; right: 0; top: 0; bottom: 0; z-index: 9; width: min(var(--chat-w), 100%); } }

/* 盯住 (alerts.mjs): a panel on the right in 策略's place and width (--side-w), dragged at the left edge. Four groups under
   a header each (正在盯, 市场主线 open; 触发记录, 已结束 folded); a row opens its chart and drills into its detail. 新建
   and 推送设置 are dialogs over the page (.alert-dlg). */
#alerts { position: relative; width: var(--side-w); flex: none; min-width: 0; border-left: 1px solid var(--line); background: var(--card); color: var(--ink); display: flex; flex-direction: column; min-height: 0; font-size: 13px; }
#alerts[hidden], #alerts [hidden], .alert-dlg [hidden] { display: none !important; }
#alerts .agrip { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; z-index: 3; cursor: col-resize; }
#alerts .agrip:hover, body.resizing #alerts .agrip { background: linear-gradient(to right, transparent 2px, var(--sea) 2px, var(--sea) 4px, transparent 4px); }
#alerts button, .alert-dlg button { font: inherit; font-size: 12px; min-height: 26px; padding: 2px 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
#alerts button:hover, .alert-dlg button:hover { border-color: var(--ink-soft); }
#alerts button.primary, .alert-dlg button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
#alerts button:disabled, .alert-dlg button:disabled { opacity: .55; cursor: default; }
#alerts :is(button, input, select, textarea, summary, .item):focus-visible, .alert-dlg :is(button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
#alerts .ahead { display: flex; align-items: center; gap: 6px; height: 36px; flex: none; padding: 0 6px 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
#alerts .ahead .t { font: 700 14px var(--serif); letter-spacing: .06em; }
#alerts .grow { flex: 1; }
#alerts .ahead :is(.icon, .back), .alert-dlg .dlg-head .icon { border: 0; background: none; color: var(--muted); padding: 0 6px; font-size: 15px; }
#alerts .ahead :is(.icon, .back):hover, .alert-dlg .dlg-head .icon:hover { color: var(--ink); }
#alerts .apane { flex: 1; min-height: 0; overflow: auto; }
#alerts .afoot { flex: none; padding: 0 12px; }
#alerts .afoot .msg { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; padding: 6px 0; }
#alerts .afoot:has(.msg:empty) { display: none; }
#alerts .muted, #alerts .by, .alert-dlg .muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
#alerts .err, .alert-dlg .err { color: var(--seal); }
#alerts a { color: var(--sea); }
/* Group headers: a fold mark, the name, the count; 触发记录's unread in seal red. */
/* 策略 and 盯住 lists, one look: each group is a card on the paper ground, its header tinted with the group's colour
   under a 2px line of it, so the header reads apart from the rows. Magenta is the user's own (正在盯, 我的策略), sea the
   public library (市场主线, 中央策略), seal the warnings (触发记录), the rest none. A header stays at the top while its rows
   scroll. The mustard / seal edge on a row still means "needs you" / "unread". */
:is(#alerts .lists, #strat .home) { background: var(--paper); padding: 8px; }
:is(#alerts, #strat) .grp { --gc: var(--line); background: var(--card); border: 1px solid var(--line); border-top: 0; }
:is(#alerts, #strat) .grp + .grp { margin-top: 8px; }
:is(#alerts .ghead, #strat .home h4) { border-top: 2px solid var(--gc); background-color: color-mix(in srgb, var(--gc) 7%, var(--card)); }
#alerts .grp.events { --gc: var(--seal); }
#alerts .grp.topics { --gc: var(--sea); }
#alerts .ghead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-top: 2px solid var(--gc); background-color: color-mix(in srgb, var(--gc) 7%, var(--card)); font: 600 14px var(--serif); letter-spacing: .04em; text-align: left; }
#alerts .grp.open .ghead { border-bottom: 1px solid var(--rule); }
#alerts .ghead:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
#alerts .ghead i { width: 0; height: 0; border: 4px solid transparent; border-left: 5px solid var(--gc); border-right: 0; transition: transform .12s; }
#alerts .grp.open .ghead i { transform: rotate(90deg); }
#alerts .ghead .n, #alerts .detail .n { color: var(--muted); font: 400 12px var(--mono); letter-spacing: 0; }
#alerts .ghead .unread { color: var(--seal); font: 400 12px var(--sans); letter-spacing: 0; }
#alerts .grp:not(.open) .rows { display: none; }
#alerts .quota { margin: 0; padding: 10px 12px 14px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* Rows: name, code and state on one line (state right), the condition, then how it is checked. */
#alerts .item { display: block; padding: 9px 12px; border-top: 1px solid var(--rule); cursor: pointer; }
#alerts .rows .item:first-child { border-top: 0; }
#alerts .item:hover { background: var(--hover); }
#alerts .item.new { box-shadow: inset 3px 0 var(--seal); }
#alerts .item-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
#alerts .item-heading strong { font-size: 14px; }
#alerts .code { font: 12px var(--mono); color: var(--muted); }
#alerts .item-heading .state { margin-left: auto; color: var(--muted); font-size: 12px; }
#alerts .condition { margin: 3px 0; overflow-wrap: anywhere; line-height: 1.6; }
#alerts .empty { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 12px; }
#alerts .event-item.expanded { background: var(--hover); cursor: default; }
#alerts .event-item .event-summary { cursor: pointer; }
#alerts .event-inline-detail { margin-top: 8px; padding: 8px 10px; background: var(--card); border: 1px solid var(--rule); border-left: 2px solid var(--mag); }
#alerts .event-inline-detail p { margin: 4px 0; }
#alerts .mine { font-size: 11px; line-height: 16px; padding: 0 4px; border: 1px solid currentColor; color: var(--mag); align-self: center; }
#alerts .chain { font-size: 12px; color: var(--muted); line-height: 1.5; }
#alerts .lists .thesis { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-soft); }
#alerts .syms { font-size: 12px; color: var(--ink-soft); margin: 2px 0; }
#alerts .progress { margin: 4px 0 2px; font-size: 12px; line-height: 1.6; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#alerts .progress .next { color: var(--muted); }
#alerts .progress .done { font-weight: 600; }
#alerts :is(.progress span, .tstat, .state).due { color: var(--mustard); font-weight: 600; }
#alerts :is(.progress span, .tstat, .state).bad { color: var(--seal); font-weight: 600; }
#alerts .ktag { flex: none; align-self: center; font-size: 11px; line-height: 16px; padding: 0 4px; border: 1px solid var(--line); color: var(--ink-soft); background: var(--card); }
#alerts .state.done { color: var(--ink); }
/* One item's detail, in the panel. */
#alerts .detail { padding: 12px; }
#alerts .detail h2 { font: 600 18px var(--serif); margin: 0 0 6px; }
#alerts .detail h2 + .chain { margin: -4px 0 6px; }
#alerts .detail h3 { font-size: 13px; margin: 14px 0 4px; }
#alerts .detail p { margin: 4px 0; overflow-wrap: anywhere; }
#alerts .detail ol, #alerts .detail ul { padding-left: 18px; margin: 4px 0; }
#alerts .detail li { padding: 2px 0; }
/* Shared by 盯住 and the 幕僚's 盯 card: conditions one to a line under a label column. */
.conds { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 8px; margin: 4px 0; line-height: 1.6; }
.conds dt { align-self: start; margin-top: 1px; padding: 0 4px; border: 1px solid var(--ink-soft); color: var(--ink); font-size: 11px; line-height: 17px; }
.conds dt:is(.stop, .invalid) { border-style: dashed; border-color: var(--muted); color: var(--ink-soft); }
.conds dt.anomaly { border-color: var(--mustard); color: var(--mustard); }
.conds dd { margin: 0; overflow-wrap: anywhere; }
#alerts .row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 10px 0; }
#alerts .topic-thesis { padding: 8px 10px; margin: 8px 0; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--sea); line-height: 1.6; }
#alerts .topic-syms button { min-height: 24px; padding: 1px 8px; }
#alerts .tw-detail-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
#alerts .tw-detail-item { padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper); }
#alerts .tw-detail-item.due { border-color: var(--mustard); }
#alerts .tw-detail-item.bad { border-color: var(--seal); }
#alerts .tw-detail-item > .by { margin-top: 1px; }
#alerts .tw-finding { margin: 6px 0 0; padding: 6px 8px; background: var(--card); border-left: 2px solid var(--sea); font-size: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#alerts .tw-finding b, #alerts .more b { font-weight: 600; color: var(--ink); }
#alerts .more { margin-top: 4px; }
#alerts .more summary { font-size: 12px; color: var(--sea); cursor: pointer; width: max-content; }
#alerts .more p { font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
#alerts .detail details.sec { border-top: 1px solid var(--rule); padding: 8px 0; }
#alerts .detail details.sec summary { font-weight: 600; cursor: pointer; }
#alerts .detail h3 .n { margin-left: 2px; }
#alerts .topic-evidence li { font-size: 12px; line-height: 1.6; }
@media (max-width: 720px) {
  #alerts:not([hidden]) { position: absolute; inset: 0; width: auto; z-index: 19; border-left: 0; }
  #alerts .agrip { display: none; }
  #alerts button { min-height: 36px; }
  #alerts .ghead { min-height: 44px; }
  #alerts .ahead { height: 44px; }
}
/* 新建 / 修改 and 推送设置: dialogs; the sentence and 转成公式 first, the formula folded under 公式. */
.alert-dlg { padding: 0; border: 1px solid var(--line); background: var(--card); color: var(--ink); width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); font-size: 13px; }
.alert-dlg[open] { display: flex; flex-direction: column; }
.alert-dlg::backdrop { background: rgba(39, 32, 27, .25); }
.alert-dlg form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.alert-dlg .dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.alert-dlg .dlg-head .t { font: 600 18px var(--serif); }
.alert-dlg .dlg-body { flex: 1; padding: 14px 16px; overflow: auto; min-height: 0; }
.alert-dlg .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); flex: none; }
.alert-dlg .field { display: flex; flex-direction: column; align-items: stretch; gap: 6px; font-weight: 600; margin: 0 0 12px; }
.alert-dlg input, .alert-dlg select, .alert-dlg textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--card); border: 1px solid var(--line); padding: 6px 8px; max-width: 100%; min-width: 0; }
.alert-dlg .field select { align-self: flex-start; }
.alert-dlg input[type=radio] { margin: 0 4px 0 0; }
.alert-dlg textarea[name=intent] { height: 64px; resize: vertical; font-family: var(--sans); }
.alert-dlg .row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0; }
.alert-dlg .row label { display: inline-flex; align-items: center; gap: 4px; }
.alert-dlg .row.gen { margin-top: -4px; }
.alert-dlg .ai-result { font-size: 12px; color: var(--muted); white-space: pre-wrap; flex: 1; min-width: 0; }
.alert-dlg .formula-summary { margin: 0 0 10px; padding: 8px 10px; background: var(--paper); border-left: 3px solid var(--mag); white-space: pre-wrap; line-height: 1.6; }
.alert-dlg .formula-summary:empty { display: none; }
.alert-dlg .formula-box { margin: 0 0 10px; }
.alert-dlg .formula-box summary { cursor: pointer; color: var(--ink-soft); font-size: 12px; padding: 2px 0; }
.alert-dlg .formula-box[open] summary { margin-bottom: 6px; }
.alert-dlg .formula-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line); border-bottom: 0; background: var(--paper); font-size: 12px; }
.alert-dlg .formula-tools label { display: flex; align-items: center; gap: 6px; }
.alert-dlg textarea[name=formula] { display: block; width: 100%; height: 120px; resize: vertical; font: 13px/1.65 var(--mono); margin-bottom: 10px; }
.alert-dlg .out { font: 12px/1.7 var(--mono); white-space: pre-wrap; border: 1px solid var(--line); padding: 8px 10px; margin: 10px 0 0; background: var(--paper); overflow-wrap: anywhere; }
.alert-dlg .out:empty { display: none; }
.alert-dlg .mode-help { margin: 0; }
@media (max-width: 600px) {
  .alert-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; }
  .alert-dlg button { min-height: 40px; }
}
#alertBtn.added{border-color:var(--mag);box-shadow:inset 3px 0 var(--mag)}
#skills .item .facts, #skills .item .props { grid-column: 3 / -1; color: var(--muted); font-size: 12px; }
#skills .item .facts a, #skills .item .props a { cursor: pointer; text-decoration: underline; }

/* The welcome (welcome.mjs): the intro deck's cover (docs/marketing) as a sheet over the page, which shows dimmed
   around it, so what comes after it is in view: warm paper under a double magenta rule, serif titles, the demo chart
   beside a chat of bubbles (me on the right in ink, the 幕僚 on the left in sea blue). The questions are big square
   tiles; the chosen one an ink block. */
#welcome { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(39, 32, 27, .38); color: var(--ink); font-family: var(--sans); overflow-y: auto; }
#welcome[hidden] { display: none; }
#welcome .wl { width: min(1060px, 100%, calc((100vh - 300px) * 2 + 330px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 14px 28px 22px; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--ink-soft); }
#welcome .wl-top { display: flex; align-items: baseline; gap: 16px; padding-bottom: 10px; border-bottom: 3px double var(--mag); }
#welcome .wl-top b { font: 900 20px var(--serif); letter-spacing: .08em; }
#welcome .wl-prog { font: 13px var(--mono); color: var(--muted); }
#welcome button { font: inherit; cursor: pointer; }
#welcome .wl-skip { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 14px; }
#welcome .wl-skip:hover { color: var(--ink); text-decoration: underline; }
#welcome .wl-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#welcome .wl-go { height: 44px; padding: 0 22px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 16px; }
#welcome .wl-go:hover { background: var(--ink-soft); }
#welcome .wl-go:disabled { opacity: .35; cursor: default; }
/* The one thing to click on the first sheet: magenta, the page's one accent, big, with an arrow that nudges. */
#welcome .wl-cta { height: 54px; padding: 0 26px; border-color: var(--mag); background: var(--mag); color: #fff; font: 700 18px var(--sans); display: inline-flex; align-items: center; gap: 12px; }
#welcome .wl-cta:hover { background: var(--mag); filter: brightness(.92); }
#welcome .wl-cta i { font-style: normal; font-size: 22px; animation: wl-nudge 1.4s ease-in-out infinite; }
@keyframes wl-nudge { 50% { transform: translateX(5px); } }
#welcome .wl-back, #welcome .wl-quiet { height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); font-size: 14px; }
#welcome .wl-back { border-color: transparent; background: none; padding: 0 4px; }
#welcome .wl-back:hover, #welcome .wl-quiet:hover { color: var(--ink); border-color: var(--ink-soft); }
#welcome .wl-back:hover { border-color: transparent; }
#welcome .wl-hint { color: var(--muted); font-size: 15px; line-height: 1.6; }
#welcome .wl-capabilities { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
#welcome .wl-capabilities summary { cursor: pointer; width: fit-content; }
#welcome .wl-capabilities summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#welcome .wl-capabilities p { margin: 8px 0 0; }
/* hello */
#welcome .wl-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin: clamp(12px, 2.4vh, 22px) 0 clamp(12px, 2vh, 18px); }
#welcome h1 { margin: 0; font: 900 clamp(26px, min(3.2vw, 4.8vh), 42px)/1.2 var(--serif); letter-spacing: .01em; }
#welcome h1 em { font-style: normal; color: var(--mag); }
#welcome .wl-lead { max-width: 340px; display: grid; gap: 12px; justify-items: start; }
#welcome .wl-lead p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-soft); }
/* the three slides, one 理念 each: which one plays, and what it shows */
#welcome .wl-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
#welcome .wl-kind { position: relative; display: inline-flex; align-items: baseline; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 13px; cursor: pointer; }
#welcome .wl-kind b { color: var(--ink); font-size: 14px; }
#welcome .wl-kind:hover { border-color: var(--ink-soft); }
#welcome .wl-kind[aria-selected=true] { border-color: var(--mag); color: var(--ink-soft); }
/* while a slide plays, the line under its tab draws from left to right */
#welcome .wl-kind-bar { position: absolute; left: -1px; right: -1px; bottom: -1px; height: 3px; background: var(--mag); transform: scaleX(0); transform-origin: left; }
#welcome .wl-kind[aria-selected=true] .wl-kind-bar { transform: scaleX(1); }
@keyframes wl-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
#welcome .wl-kind[aria-selected=true] b { color: var(--mag); }
#welcome .wl-kind:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#welcome .wl-kind-note { margin-left: auto; font-size: 12px; color: var(--muted); }
#welcome .wl-kind-line { flex-basis: 100%; margin: 2px 0 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
#welcome .wl-kinds[hidden], #welcome .wl-key[hidden] { display: none; }
#welcome .wl-live { position: relative; flex: none; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
#welcome .wl-live[hidden] { display: none; }
#welcome .wl-graph { margin-right: 280px; border-right: 1px solid var(--rule); }
#welcome .wl-bar { display: flex; align-items: baseline; gap: 12px; padding: 7px 14px; border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
#welcome .wl-bar b { font-size: 15px; color: var(--ink); }
#welcome .wl-key { margin-left: auto; font-size: 12px; }
/* the chart, the pointer and what it shows */
#welcome .wl-stage { position: relative; display: flex; }
#welcome .wl-stage .plot { flex: 1; min-width: 0; }
#welcome .wl-tip { position: absolute; z-index: 2; width: 250px; padding: 8px 11px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--ink); font-size: 13px; line-height: 1.55; color: var(--ink-soft); pointer-events: none; animation: wl-fade .3s both; }
#welcome .wl-tip[hidden] { display: none; }
#welcome .wl-tip b { display: block; color: var(--ink); } #welcome .wl-tip i { display: block; margin-top: 4px; font-style: normal; color: var(--sea); }
#welcome .wl-hand { position: absolute; z-index: 3; left: 0; top: 0; line-height: 0; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); transition: transform .7s cubic-bezier(.4, 0, .2, 1); pointer-events: none; }
#welcome .wl-hand[hidden] { display: none; }
#welcome .ax { font: 11px var(--mono); fill: var(--muted); } #welcome .lg { font: 12px var(--sans); fill: var(--muted); } #welcome .rt { font: 600 12px var(--sans); }
#welcome .sig { opacity: 0; } #welcome .sig.on { opacity: 1; }
#welcome .et { font: 600 11.5px var(--sans); fill: #fff; } #welcome .ev { opacity: 0; } #welcome .ev.on { opacity: 1; animation: wl-fade .5s both; }
#welcome .sig.on .vl { animation: wl-drop .5s ease-out; } #welcome .sig.on .tag { animation: wl-fade .5s .25s both; }
#welcome .live-dot { animation: wl-pulse 1.6s ease-in-out infinite; }
/* the chat as tall as the chart beside it; older bubbles go out at the top */
#welcome .chat { position: absolute; top: 0; right: 0; bottom: 0; width: 280px; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding: 12px 14px; background: var(--panel); overflow: hidden; }
#welcome .chat .m { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.55; }
#welcome .chat .m:not(.on) { display: none; }
#welcome .chat .m.on { animation: wl-rise .35s ease-out; }
#welcome .chat .av { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--sea); }
#welcome .chat .me { justify-content: flex-end; }
#welcome .chat .me .av { background: var(--ink); font-size: 13px; }
#welcome .chat p, #welcome .chat .m > div { margin: 0; padding: 7px 11px; border-radius: 12px; max-width: 240px; }
#welcome .chat .m > div > p { padding: 0; max-width: none; }
#welcome .chat .me p { background: var(--ink); color: var(--paper); border-top-right-radius: 3px; }
#welcome .chat .bot p, #welcome .chat .bot > div { background: #fff; border: 1px solid var(--rule); border-top-left-radius: 3px; }
#welcome .chat .bot > div p { border: 0; background: none; }
#welcome .chat .bot.cont { margin-top: -4px; } #welcome .chat .bot.cont .av { visibility: hidden; }
#welcome .chat .typing p { display: flex; gap: 5px; padding: 12px 13px; }
#welcome .chat .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: wl-pulse 1s infinite; }
#welcome .chat .typing i:nth-child(2) { animation-delay: .15s; } #welcome .chat .typing i:nth-child(3) { animation-delay: .3s; }
#welcome .chat .dm { margin-top: 7px; border: 1px solid var(--line); border-left: 3px solid var(--mag); padding: 5px 9px; font-size: 13px; background: var(--paper); }
#welcome .chat .dm .th { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); } #welcome .chat .dm .th b { color: var(--ink); }
#welcome .chat .dm .tl { font-size: 12px; color: var(--sea); }
@keyframes wl-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wl-drop { from { stroke-dashoffset: -300; opacity: 0; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes wl-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes wl-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { #welcome .sig.on .vl, #welcome .sig.on .tag, #welcome .live-dot, #welcome .chat .m.on, #welcome .wl-cta i, #welcome .wl-tip { animation: none; } }
/* questions and the last step */
#welcome .wl-q { width: 100%; max-width: 760px; margin: clamp(20px, 5vh, 48px) auto clamp(8px, 3vh, 28px); display: grid; gap: 14px; }
#welcome .wl-q h2 { margin: 0; font: 700 clamp(28px, 4.4vh, 40px)/1.3 var(--serif); }
#welcome .wl-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
#welcome .wl-opts.two { grid-template-columns: repeat(2, 1fr); } /* four 理念: two by two, none left alone on a row */
#welcome .wl-opt { min-height: 64px; padding: 0 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 17px; text-align: left; }
#welcome .wl-opt:hover { border-color: var(--ink-soft); }
#welcome .wl-opt.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
#welcome .wl-nav { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
#welcome .wl-nav .wl-go { margin-left: auto; }
#welcome .wl-nav .grow { flex: 1; }
#welcome .wl-nav .grow ~ .wl-go { margin-left: 0; }
#welcome .wl-idea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 17px/1.6 var(--sans); resize: vertical; }
#welcome .wl-idea:focus, #welcome .wl-acct input:focus { outline: none; border-color: var(--ink-soft); }
#welcome .wl-notes { padding: 10px 14px; border-left: 3px solid var(--sea); background: var(--card); display: grid; gap: 3px; font-size: 15px; }
#welcome .wl-notes-h { display: flex; align-items: center; color: var(--sea); font: 700 14px var(--serif); }
#welcome .wl-notes .wl-hint { font-size: 13px; margin-top: 4px; }
#welcome .wl-acct { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
#welcome .wl-acct .wl-hint, #welcome .wl-acct .wl-nav, #welcome .wl-acct .wl-err { grid-column: 1 / -1; margin: 0; }
#welcome .wl-acct label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-soft); }
#welcome .wl-acct input { height: 40px; padding: 0 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 16px; }
#welcome .wl-err { color: var(--seal); font-size: 14px; }
#welcome .wl-err:empty { display: none; }
/* 竖版: what docs/marketing/welcome.html shows by default, on a computer (wider than 900px; phones stay as they are): a portrait card, the chat under the chart */
@media (min-width: 901px) {
  #welcome.tall .wl { width: min(700px, 100%); max-height: none; }
  #welcome.tall h1 { font-size: 28px; }
  #welcome.tall .wl-hero { gap: 24px; }
  #welcome.tall .wl-lead { max-width: 290px; }
  #welcome.tall .wl-lead p { font-size: 14px; }
  #welcome.tall .wl-graph { margin-right: 0; border-right: 0; }
  #welcome.tall .chat { position: static; width: auto; height: 220px; border-top: 1px solid var(--rule); }
  #welcome.tall .chat p, #welcome.tall .chat .m > div { max-width: 72%; }
}
@media (max-width: 900px) {
  #welcome { padding: 0; }
  #welcome .wl { max-height: 100vh; padding: 14px 16px 20px; border: 0; }
  #welcome .wl-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  #welcome .chat { display: none; }
  #welcome .wl-kind span { display: none; }
  #welcome .wl-graph { margin-right: 0; border-right: 0; }
  #welcome .wl-opts, #welcome .wl-acct { grid-template-columns: 1fr; }
}

/* The invite card (invite.mjs): a native modal dialog, so focus stays in the card and Esc/back close it.
   A ticket-like card over the dimmed workbench: brand header, serial, the gift, then one action. */
#invite { width: min(660px, calc(100vw - 32px)); max-width: none; max-height: none; margin: auto; padding: 0; border: 0; background: transparent; color: var(--ink); font-family: var(--sans); overscroll-behavior: contain; }
#invite::backdrop { background: rgba(39, 32, 27, .56); overscroll-behavior: contain; }
#invite .iv { width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--ink-soft); border-top: 4px solid var(--mag); border-radius: 4px; box-shadow: 0 28px 70px rgba(39, 32, 27, .28), 0 2px 0 rgba(255, 255, 255, .55) inset; animation: iv-in .18s ease-out; }
@keyframes iv-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
#invite .iv-top { display: flex; align-items: baseline; gap: 10px; padding: 13px 24px 11px; border-bottom: 1px solid var(--line); background: var(--paper); }
#invite .iv-top b { font: 900 18px var(--serif); letter-spacing: .08em; }
#invite .iv-top span { font-size: 12px; color: var(--mag); letter-spacing: .22em; }
#invite .iv-top .iv-tagline { color: var(--muted); letter-spacing: .02em; }
#invite button { font: inherit; cursor: pointer; }
#invite .iv-skip { margin-left: auto; min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--muted); font-size: 13px; }
#invite .iv-skip:hover { color: var(--ink); text-decoration: underline; }
#invite .iv-body { padding: 20px 24px 24px; }
#invite .iv-meta { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); color: var(--muted); font: 11px var(--mono); letter-spacing: .08em; }
#invite .iv-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 18px 0 12px; }
#invite h1 { margin: 0; font: 900 clamp(26px, 4vw, 38px)/1.25 var(--serif); letter-spacing: -.02em; }
#invite h1 em { font-style: normal; color: var(--mag); font-size: .72em; }
#invite h1.iv-title-invite { color: var(--mag); font-size: clamp(32px, 5vw, 46px); letter-spacing: .08em; }
#invite .iv-sub { margin: 7px 0 0; color: var(--mag); font-size: 15px; }
#invite .iv-seal { flex: none; width: 62px; height: 62px; display: grid; place-content: center; gap: 1px; border: 1px solid var(--mag); outline: 1px solid var(--mag); outline-offset: 3px; color: var(--mag); font: 700 12px/1.25 var(--serif); letter-spacing: .12em; text-align: center; transform: rotate(-6deg); opacity: .9; }
#invite .iv-lead { margin: 0 0 18px; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
#invite .iv-lead b { color: var(--ink); font-weight: 600; }
#invite .iv-gift { display: grid; grid-template-columns: 1.35fr 1fr; border: 1px solid var(--line); background: var(--paper); }
#invite .iv-gift--single { grid-template-columns: 1fr; }
#invite .iv-gift-pro, #invite .iv-gift-credit { padding: 14px 16px; display: grid; gap: 3px; align-content: start; }
#invite .iv-gift-credit { border-left: 1px solid var(--line); background: var(--card); }
#invite .iv-kicker { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
#invite .iv-gift strong { font: 700 24px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
#invite .iv-gift span:last-child { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
#invite .iv-do { margin-top: 18px; }
#invite .iv-h { margin-bottom: 8px; font-size: 11px; color: var(--muted); letter-spacing: .12em; }
#invite .iv-do ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: iv-do; }
#invite .iv-do li { display: grid; grid-template-columns: 18px 1fr; gap: 7px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; counter-increment: iv-do; }
#invite .iv-do li::before { content: counter(iv-do, decimal-leading-zero); color: var(--mag); font: 700 11px var(--mono); padding-top: 2px; }
#invite .iv-foot { margin: 20px -24px -24px; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--paper); }
#invite .iv-valid { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
#invite .iv-valid b { color: var(--ink); font: 600 13px var(--mono); }
#invite .iv-go { width: 100%; height: 52px; justify-content: center; border: 1px solid var(--mag); background: var(--mag); color: #fff; font: 700 17px var(--sans); display: inline-flex; align-items: center; gap: 12px; box-shadow: 0 8px 18px rgba(213, 21, 98, .22); transition: filter .15s, transform .15s; }
#invite .iv-go:hover { filter: brightness(.92); transform: translateY(-1px); }
#invite .iv-go:active { transform: translateY(0); }
#invite .iv-go:focus-visible { outline: 2px solid var(--mag); outline-offset: 3px; }
#invite .iv-skip:focus-visible, #invite .iv-quiet:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#invite .iv-go i { font-style: normal; font-size: 20px; }
#invite .iv-quiet { height: 50px; padding: 0 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); font-size: 14px; }
#invite .iv-quiet:hover { color: var(--ink); border-color: var(--ink-soft); }
#invite .iv-hint { margin: 9px 0 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
#invite .iv-nav { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
#invite .iv-nav .iv-hint { flex-basis: 100%; }
#invite .iv-cols { display: grid; grid-template-columns: 1fr 1.5fr; gap: 28px; }
#invite .iv-gifts { margin: 0; display: grid; gap: 14px; }
#invite .iv-gifts dt { font: 700 22px var(--serif); font-variant-numeric: tabular-nums; }
#invite .iv-gifts dd { margin: 2px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
#invite .iv-ask ol { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
#invite .iv-ask li::marker { font: 700 14px var(--serif); color: var(--ink); }
@media (max-width: 640px) {
  #invite { width: 100vw; max-width: 100vw; margin: 0; }
  #invite .iv { max-height: 100dvh; min-height: 100dvh; border: 0; border-top: 4px solid var(--mag); border-radius: 0; box-shadow: none; }
  #invite .iv-body { padding: 18px 18px 20px; }
  #invite .iv-foot { margin: 18px -18px -20px; padding: 13px 18px 18px; }
  #invite .iv-seal { width: 54px; height: 54px; font-size: 11px; }
  #invite .iv-gift { grid-template-columns: 1fr; }
  #invite .iv-gift-credit { border-left: 0; border-top: 1px solid var(--line); }
  #invite .iv-cols { grid-template-columns: 1fr; gap: 20px; }
}
@media (prefers-reduced-motion: reduce) { #invite .iv { animation: none; } #invite .iv-go { transition: none; } }

/* Read-only Central Strategy Center details in the existing strategy panel. */

.central-info { padding: 8px; border-top: 1px solid var(--faint); max-height: 320px; overflow: auto; font-size: 12px; flex-shrink: 0; }
.central-info summary { cursor: pointer; }
.central-table, .public-table { overflow: auto; max-height: 220px; }
.central-info table { border-collapse: collapse; white-space: nowrap; font-size: 11px; }
.central-info td, .central-info th { padding: 3px 7px; text-align: left; border-bottom: 1px solid var(--faint); }
.central-info p { margin: 6px 0; }

.factor-dialog { position:fixed; inset:0; z-index:120; background:#0005; display:flex; align-items:center; justify-content:center; }
.factor-dialog[hidden] { display:none; }
.factor-box { background:var(--bg,#fcfcfc); color:var(--text,#333); width:min(740px,94vw); max-height:85vh; overflow:auto; padding:18px; border:1px solid #aaa; box-shadow:0 8px 40px #0003; }
.factor-box header { display:flex; justify-content:space-between; align-items:center; }
.factor-box input { width:96%; padding:8px; margin:6px 0; }
.factor-box p { font-size:12px; line-height:1.6; color:#666; }
.factor-items { max-height:55vh; overflow:auto; }
.factor-items article { padding:12px 4px; border-bottom:1px solid #ddd; }
.factor-items article button { float:right; }
.factor-items small { display:block; color:#777; margin-top:4px; }

/* Factor overlays share the main pane, with a quiet observation strip below the price. */
.lg.factor-row { border-top:1px solid #e0e6ed; padding:6px 0 0; gap:5px 14px; align-items:center; font-size:11px; }
.factor-tag { color:#718096; font-size:10px; letter-spacing:.12em; }
.lg .ind.factor-chip { gap:0 6px; align-items:center; }
.factor-chip .cap { color:#64748b; font-size:10px; }
.factor-chip .factor-value { font-variant-numeric:tabular-nums; font-weight:600; }
.factor-chip .rm { color:#a0aab8; font-size:11px; }
.factor-note { color:#94a0b0; font-size:10px; }

.factor-axis-mask { position:absolute; right:0; background:#fcfcfc; border-left:1px solid #e8edf2; z-index:2; pointer-events:none; }
.factor-axis-mask[hidden] { display:none; }

/* Unsupported periods stay visible so users can understand the daily-only option coverage. */
#bar #periods button:disabled, #bar select:disabled { opacity: .45; cursor: not-allowed; }

/* Options workspace: one selection controls a standard chart above the compact T-chain. */
#optionsMarket { position:absolute; inset:0; z-index:6; display:flex; flex-direction:column; min-width:0; overflow:auto; background:var(--card); scrollbar-gutter:stable; }
#optionsMarket[hidden] { display:none; }
.options-mode #tape { height:23px; flex:none; }
.options-mode #bar :is(#periods,#adj,#layoutBtn,#formulaBtn,#note,#status) { display:none; }
/* Active state for #optionsMarketBtn is unified in ui.css (#bar button[aria-pressed="true"]) */
#optionsMarket button,#optionsMarket select { min-height:28px; border:1px solid var(--line); background:var(--card); color:var(--ink); font:inherit; padding:2px 8px; }
#optionsMarket button:hover { border-color:var(--ink); }
#optionsMarket :focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.om-toolbar { display:flex; align-items:center; gap:8px; min-width:0; }
.om-toolbar[hidden] { display:none; }
.om-toolbar select { width:150px; }
.om-toolbar :focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.om-info { position:relative; color:var(--muted); font-size:12px; }
.om-info summary { cursor:pointer; }
.om-info>div { position:absolute; top:28px; left:0; z-index:10; width:300px; padding:12px; border:1px solid var(--line); background:var(--card); color:var(--ink-soft); line-height:1.7; }
.om-workspace { display:grid; grid-template-columns:minmax(0,1fr) clamp(670px,50%,800px); align-items:start; flex:none; min-width:0; }
.om-chart-panel { position:sticky; top:0; min-width:0; border-right:1px solid var(--line); background:var(--card); }
.om-chain-panel { min-width:0; }
.om-chart-tools { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:36px; padding:4px 10px; border-bottom:1px solid var(--line); }
.om-selected-title { font-size:12px; font-weight:600; color:var(--ink); min-width:0; overflow-wrap:anywhere; }
.om-periods { position:absolute; top:4px; right:74px; z-index:4; display:inline-flex; border:1px solid var(--line); background:var(--card); }
#optionsMarket .om-periods button { min-height:22px; padding:1px 7px; border:0; font-size:11px; color:var(--ink-soft); background:transparent; }
#optionsMarket .om-periods button + button { border-left:1px solid var(--line); }
#optionsMarket .om-periods button:hover { color:var(--ink); background:var(--hover); }
#optionsMarket [data-tf][aria-pressed="true"],#optionsMarket button[data-side][aria-pressed="true"] { background:var(--ink); color:var(--card); }
.om-expiries { display:flex; align-items:center; gap:4px; min-height:36px; padding:4px 8px; overflow-x:auto; white-space:nowrap; border-bottom:1px solid var(--line); }
#optionsMarket .om-expiries button { flex:none; min-height:26px; border-color:transparent; }
#optionsMarket .om-expiries [aria-selected="true"] { border-bottom:2px solid var(--ink); font-weight:600; }
.om-chart-shell { display:flex; position:relative; flex-direction:column; height:440px; background:var(--bg); }
.om-axis-labels { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:2px 8px; height:28px; min-height:28px; padding:0 8px; font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; flex:none; border-bottom:1px solid var(--rule); background:var(--panel); }
.om-underlying-legend { display:flex; align-items:center; gap:4px; color:var(--sea); }
.om-underlying-hidden :is(.om-overlay-name,.om-underlying-value) { color:var(--muted); }
#optionsMarket [data-overlay] { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; min-height:24px; padding:3px; border:0; background:transparent; }
[data-overlay] svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.5; }
[data-overlay][aria-pressed="true"] .om-eye-slash { display:none; }
.om-chart-view { flex:1; min-height:0; }
.om-chart-view .lg .star,.om-chart-view .dl,.om-chart-view .legends .title { display:none; }
.om-chart-view .legends { right:152px; font-size:11px; }
.om-chart-view .lg { font-size:11px; gap:2px 6px; padding:1px 4px; background:rgba(252,252,252,.88); }
.om-chart-view .lg > span { white-space:normal; }
.om-chart-view .lg[data-pane="0"] { padding-right:4px; }
.om-chart-message { position:absolute; inset:32px 0 0; display:flex; align-items:center; justify-content:center; gap:10px; color:var(--muted); background:var(--bg); }
.om-chart-shell[data-state="ready"] .om-chart-message { display:none; }
.om-chart-shell:not([data-state="ready"]) .om-chart-view { visibility:hidden; }
.om-body { min-height:160px; background:var(--bg); }
#optionsMarket[aria-busy] .om-body { opacity:.6; }
.om-body table { border-collapse:separate; border-spacing:0; width:100%; font-variant-numeric:tabular-nums; }
.om-body th,.om-body td { height:28px; padding:3px 2px; border-bottom:1px solid var(--rule); white-space:nowrap; text-align:right; }
.om-body td { font:12px var(--mono); cursor:pointer; }
.om-body thead { position:sticky; top:0; z-index:2; }
.om-body thead th { background:var(--panel); color:var(--ink-soft); font-weight:normal; }
.om-body .om-group { text-align:center; color:var(--ink); }
.om-body .om-strike { background:var(--paper); border-left:1px solid var(--line); border-right:1px solid var(--line); text-align:center; font-family:var(--mono); }
.om-strike small { display:block; font:10px var(--sans); color:var(--muted); }
.om-body .om-name { text-align:left; }
#optionsMarket .om-name button { border:none; background:none; padding:0; min-height:20px; text-align:left; font:12px var(--sans); }
.om-body tr:hover td:not(.om-selected) { background:var(--hover); }
.om-body td.om-selected { background:var(--sel); }
.om-selected.om-name { box-shadow:inset 2px 0 var(--sea); }
.om-special { color:var(--muted); font-size:10px; }
.om-up { color:var(--up); }.om-down { color:var(--down); }
.om-foot { display:flex; flex-wrap:wrap; gap:4px 18px; padding:5px 12px; flex:none; border-top:1px solid var(--line); color:var(--muted); font-size:11px; }
.om-unit-note { margin-left:auto; }
.om-error { padding:6px 12px; flex:none; background:var(--paper-warm); color:var(--ink-soft); font-size:12px; }
.om-empty { padding:30px 12px; color:var(--muted); }
.om-mobile-side { display:none; }
.om-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
@container (max-width:1100px) {
  .om-workspace { grid-template-columns:minmax(0,1fr); }
  .om-chart-panel { position:static; border-right:0; border-bottom:1px solid var(--line); }
  .om-chart-shell { height:360px; }
}
@container (max-width:800px) {
  .om-chart-tools { min-height:36px; padding:6px 8px; }
  .om-chart-shell { height:320px; }
  #optionsMarket .om-periods button { min-height:26px; padding:2px 8px; }
  .om-mobile-side { display:flex; gap:6px; padding:4px 8px; }
  #optionsMarket[data-side="call"] .om-put,#optionsMarket[data-side="put"] .om-call { display:none; }
  .om-body th,.om-body td { height:36px; padding:4px; font-size:11px; }
  .om-body .om-strike { font-size:11px; }.om-strike small { font-size:9px; }
  #optionsMarket .om-name button { font-size:11px; min-height:32px; }
  .om-foot { padding:4px 8px; }.om-unit-note { margin-left:0; }
  #optionsMarket .om-expiries button { min-height:36px; }
}
/* Sidebars are siblings of the workspace, so every foreground view leaves room for the assistant. */
@media (max-width:720px) { #chat:not([hidden]) { position:absolute; inset:0; width:auto; z-index:20; } }

/* Upstream price events: a temporal layer, independent of price adjustment and user notes. */
.market-events-toggle, .chart-odds-toggle { font-size:12px; color:var(--ink-soft); background:var(--panel); border:1px solid var(--line); cursor:pointer; }
.market-events-toggle[aria-expanded="true"], .chart-odds-toggle[aria-pressed="true"] { border-color:var(--ink); color:var(--ink); box-shadow:inset 0 -2px var(--ink); }

/* In-chart Historical Odds Trigger Chip & Right Y-Axis Return Tags (P162) */
.chart-odds-chip { position:absolute; top:4px; right:96px; z-index:5; display:inline-flex; align-items:center; pointer-events:auto; }
.om-chart-view .chart-odds-chip { display:none; }
.co-pill-open { display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 9px; border:1px solid #C89B9C; border-radius:3px; background:rgba(252,251,249,.94); color:#231D18; font:600 12px/1 var(--sans); cursor:pointer; box-shadow:0 1px 2px rgba(35,29,24,.06); transition:border-color .14s, background .14s, color .14s; }
.co-pill-open .co-play-ico { color:#9E2A2B; font-size:10px; line-height:1; }
.co-pill-open:hover, .co-pill-open:focus-visible { border-color:#9E2A2B; background:#FDF6F6; color:#9E2A2B; outline:none; }
.co-pill-bar { display:inline-flex; align-items:center; gap:2px; height:24px; padding:0 4px 0 8px; border:1px solid #9E2A2B; border-radius:3px; background:rgba(252,251,249,.96); font:12px/1 var(--sans); box-shadow:0 1px 3px rgba(35,29,24,.08); }
.co-active-summary { color:#231D18; font-size:11.5px; margin-right:4px; font-variant-numeric:tabular-nums; }
.co-active-summary b { color:#C82337; font-weight:700; }
.co-pill-bar button { height:20px; padding:0 6px; border:0; border-radius:2px; background:transparent; color:var(--ink-soft); font:600 11.5px/1 var(--sans); cursor:pointer; }
.co-pill-bar button:hover, .co-pill-bar button:focus-visible { background:var(--hover); color:var(--ink); outline:none; }
.co-pill-bar button.co-close { color:#9E2A2B; }
.chart-odds-axis-tag { position:absolute; right:1px; z-index:4; height:20px; padding:0 5px; display:flex; align-items:center; justify-content:center; border-radius:2px; color:#fff; font:700 11.5px/1 var(--mono); font-variant-numeric:tabular-nums; pointer-events:none; box-shadow:0 1px 2px rgba(0,0,0,.14); }
.chart-odds-axis-tag[hidden] { display:none; }
.chart-odds-axis-tag.is-win { background:#C82337; }
.chart-odds-axis-tag.is-lose { background:#0F8A5F; }
.market-events-panel { position:absolute; top:53px; left:12px; z-index:8; width:min(340px,calc(100% - 78px)); max-height:min(650px,calc(100% - 65px)); display:flex; flex-direction:column; background:var(--panel); border:1px solid var(--line); font-size:12px; }
.market-events-panel[hidden] { display:none; }
.market-events-panel header { display:flex; justify-content:space-between; align-items:center; padding:7px 12px; border-bottom:1px solid var(--line); flex-shrink:0; }
.market-events-panel header > strong { font:600 16px var(--serif); }
.market-events-panel header button { border:0; background:none; font-size:16px; width:30px; height:30px; color:var(--ink-soft); cursor:pointer; }
.market-events-panel button:focus-visible,.market-events-panel summary:focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.me-body { overflow-y:auto; min-height:0; overscroll-behavior:contain; }
.me-intro { padding:12px; background:var(--card); border-bottom:1px solid var(--line); }
.me-intro p { margin:6px 0; line-height:1.7; }
.me-intro > span,.me-draft { color:var(--muted); font-size:11px; }
.me-tools { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:9px 12px; }
.me-tools .me-source,.me-tools .me-layer { font-size:11px; color:var(--muted); }
.me-tools .me-layer { display:flex; align-items:center; gap:3px; white-space:nowrap; }
.me-window { display:flex; justify-content:space-between; gap:8px; padding:0 12px 9px; border-bottom:1px solid var(--line); font-size:11px; }
.me-window span,.me-period,.me-why dd,.me-row time,.me-row b { font-variant-numeric:tabular-nums; }
.me-window span { color:var(--muted); }
.me-notice { color:var(--muted); line-height:1.6; font-size:11px; margin:9px 12px; }
.me-detail { padding:12px; border-bottom:1px solid var(--line); line-height:1.6; background:var(--card); }
.me-title { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.me-title button,.me-group button { border:0; background:none; color:var(--muted); font-size:11px; padding:4px 0 4px 8px; white-space:nowrap; }
.me-period { margin:4px 0; }
.me-state,.me-hint { color:var(--muted); font-size:11px; }
.me-hint { margin:9px 12px; }
.me-caveat { margin:7px 0; font-size:12px; }
.me-meta { margin:5px 0 8px; font-size:11px; }
.me-meta summary { color:var(--muted); cursor:pointer; }
.me-detail dl { display:grid; grid-template-columns:65px 1fr; font-size:11px; margin:7px 0; }
.me-detail dl.me-why { grid-template-columns:repeat(2,max-content minmax(0,1fr)); gap:2px 10px; }
.me-detail dl.me-why dd { font-family:var(--mono); }
.me-detail dt { color:var(--muted); } .me-detail dd { margin:0; overflow-wrap:anywhere; }
.me-detail .me-notice { margin:6px 0; }
.me-why-items { margin:6px 0; padding-left:16px; font-size:11px; max-height:120px; overflow:auto; }
.me-why-items li { margin:2px 0; overflow-wrap:anywhere; }
.me-ask { padding:7px 10px; background:var(--ink); color:var(--card); border:0; cursor:pointer; }
.me-draft { display:block; margin-top:5px; }
.me-filter { display:flex; gap:4px; padding:10px 12px; }
.me-filter button { padding:5px 9px; background:transparent; border:1px solid var(--line); color:var(--ink-soft); }
.me-filter button[aria-pressed="true"] { background:var(--ink); border-color:var(--ink); color:var(--card); }
.me-group { display:flex; align-items:center; justify-content:space-between; margin:0 12px 8px; }
.me-list { overflow-y:auto; max-height:280px; padding:0; overscroll-behavior:contain; }
.me-row { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; text-align:left; padding:9px 12px; border:0; border-top:1px solid var(--rule); background:transparent; cursor:pointer; font-size:12px; color:var(--ink); }
.me-row-label { display:block; }
.me-row-label i { font-style:normal; font-size:11px; color:var(--muted); }
.me-row.is-follows .me-row-label { color:var(--muted); }
.me-row.is-follows b { opacity:.6; }
.me-row time { display:block; font-size:11px; color:var(--muted); margin-top:3px; }
.me-row b { font-family:var(--mono); }
.me-row:hover { background:var(--hover); }
.me-row[aria-pressed="true"] { box-shadow:inset 3px 0 var(--sea); background:var(--sel); }
.me-up { color:var(--up); } .me-down { color:var(--down); }
.me-empty { margin:12px; line-height:1.7; }
.me-empty p { color:var(--muted); margin:5px 0; }
.me-fallback { padding:0 12px 12px; }
@media (max-width:600px) {
  .market-events-panel { top:auto; bottom:30px; left:12px; width:calc(100% - 24px); max-height:48%; }
  .market-events-panel header { padding:2px 4px 2px 12px; }
  .market-events-panel header button { width:44px; height:44px; }
  .me-tools .me-layer { min-height:36px; }
  .me-row { min-height:48px; }
  .me-filter button,.me-title button,.me-group button { min-height:36px; }
}
@media (max-width:600px) and (max-height:650px) {
  .market-events-panel { max-height:52%; }
}
#chat .ch-q { overflow-wrap:anywhere; min-width:0; }
@media (max-width:800px) {
  .om-toolbar { gap:6px; }
  .om-toolbar select { width:112px; }
  .om-info>div { position:fixed; top:42px; left:12px; right:12px; width:auto; }
}
/* Pre-IPO instruments keep their unit, source and freshness visible even in a mixed board. */
.preipo-note { padding: 6px 10px; color: var(--ink-soft); background: var(--panel); border-bottom: 1px solid var(--rule); font-size: 12px; line-height: 1.5; }
.preipo-caption { padding: 3px 6px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--rule); }
.board-why { padding: 2px 6px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-why { padding: 4px 10px; font-size: 12px; color: var(--ink-soft); background: var(--paper); border-bottom: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bpanel .rows li.preipo-row, .bpanel .rows li.valuation-head { grid-template-columns: minmax(72px, 1fr) 54px 58px 64px 58px; min-width: 334px; }
.bpanel .rows li.preipo-row { cursor: pointer; }
.bpanel .rows li.preipo-row > span, .bpanel .rows li.valuation-head > span { display: block; }
.bpanel .rows li.valuation-head > span:nth-child(n+3) { text-align: right; }
.preipo-mixed small { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: normal; }
.bpanel .rows li.preipo-mixed > span:nth-child(2) { white-space: normal; }
.preipo-value { font-weight: 600; }
.preipo-name { color: var(--sea); }
.preipo-board-foot { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 3px 6px; border-top: 1px solid var(--rule); font-size: 11px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.preipo-board-foot .late, .preipo-chart-state.late { color: var(--seal); }
.preipo-row:focus-visible, .preipo-mixed:focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }
.legends .lg .preipo-chart-note, .legends .lg .preipo-chart-state { flex-basis: 100%; white-space: normal; display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.5; }
@media (max-width: 720px) {
  #boards .dlg-foot button { flex-shrink: 0; white-space: nowrap; min-height: 44px; padding: 3px 16px; }
  #sideToggle { min-height: 44px; min-width: 44px; }
  .preipo-chart .lg[data-pane="0"] { padding-right: 0; }
  .preipo-chart .lg .title { padding-right: 60px; }
  .preipo-chart .lg > span { white-space: normal; max-width: 100%; }
  .preipo-chart .lg .preipo-chart-note, .preipo-chart .lg .preipo-chart-state { padding-right: 40px; }
}
.preipo-load { position: absolute; z-index: 8; top: 0; left: 0; right: 0; padding: 10px; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.preipo-load button { margin-left: 8px; padding: 5px 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.chart-load-status { position:absolute; z-index:8; left:var(--prim-space-2); right:72px; bottom:32px; display:flex; flex-wrap:wrap; align-items:center; gap:var(--prim-space-2); padding:var(--prim-space-2); background:var(--panel); border:1px solid var(--line); color:var(--ink-soft); font:12px var(--sans); }
/* Stay above the time axis and leave the price axis visible while retaining the old chart. */
.chart-load-status > span { flex:1; min-width:0; overflow-wrap:anywhere; }
.chart-load-status.is-error { border-left:3px solid var(--seal); }
.chart-load-status button { flex:none; background:var(--card); border:1px solid var(--line); color:var(--ink); padding:4px 8px; cursor:pointer; font:inherit; }
@media (max-width:720px) { .chart-load-status { right:8px; } .chart-load-status button { min-width:44px; min-height:44px; } }
@media (max-width: 720px) { .preipo-load button { min-height: 44px; } }

.realtime-state { color: var(--muted); font-size: 11px; margin-inline: 8px; }
#bar #periods button { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 600px) {
  #bar #periods { max-width: 100%; overflow-x: auto; margin-right: 0; }
  #bar #periods button { padding-inline: 6px; }
}

/* Multi-chart layouts and per-chart series settings (图表设置, chart right-click). */
#charts.quad {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));}
#workspaceDialog {border:1px solid var(--line);border-radius:0;background:var(--paper);color:var(--ink);width:min(850px,95vw);max-height:90vh;padding:0;}
#workspaceDialog::backdrop {background:var(--hover);}
#workspaceDialog header,#workspaceDialog footer {display:flex;align-items:center;justify-content:space-between;padding:10px;border-bottom:1px solid var(--line);gap:8px;}
#workspaceDialog footer {justify-content:flex-end;border-top:1px solid var(--line);}
.workspace-form {padding:12px;overflow:auto;max-height:70vh;}
.workspace-form label {display:flex;gap:6px;align-items:center;margin:8px 0;}
.workspace-form input,.workspace-form select {min-width:0;max-width:100%;background:var(--card);color:var(--ink);border:1px solid var(--line);font:inherit;padding:5px;}
.workspace-form p {color:var(--muted);}
.series-row {display:flex;flex-wrap:wrap;gap:6px;border:1px solid var(--line);margin:8px 0;padding:6px;}
.series-row input {width:160px;}
/* Macro uses its own right-hand slot alongside the chart, independently of follow boards. */
.macro-blocks { display:flex; flex-direction:column; flex:none; width:var(--side-w); max-width:45vw; min-width:0; min-height:0; overflow:hidden; background:var(--bg); border-left:1px solid var(--line); font-size:13px; }
.macro-blocks > :not([data-groups]) { flex:none; }
.macro-blocks > [data-groups] { flex:1; min-height:0; overflow:auto; }
.macro-follow-head > span { color:var(--muted); font:11px var(--mono); }
.macro-follow-head [data-retry] { margin-left:auto; min-height:24px; padding:0 8px; }
.macro-follow-head [data-close] { min-width:28px; font-size:18px; border:0; }
.macro-follow-search select { flex:none; max-width:40%; background:var(--bg); color:var(--ink); border:1px solid var(--line); font:inherit; padding:3px 4px; }
.macro-blocks button { color:var(--ink); background:transparent; border:1px solid var(--line); font:inherit; cursor:pointer; }
.macro-blocks button:hover { background:var(--hover); }
.macro-blocks :is(button,input,summary):focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.macro-follow-search { display:flex; align-items:center; gap:6px; padding:6px 12px; border-bottom:1px solid var(--line); }
.macro-follow-search input { flex:1; width:0; min-width:0; padding:3px 4px; border:1px solid var(--line); background:var(--chart-bg); color:var(--ink); font:inherit; }
.macro-follow-search input::placeholder { color:var(--muted); }
/* Keep the explicit, keyboard-accessible 清除 action as the single clear control. */
.macro-follow-search input::-webkit-search-cancel-button { -webkit-appearance:none; appearance:none; }
.macro-follow-status,.macro-follow-empty { margin:0; padding:4px 6px; color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.macro-follow-status:empty { display:none; }
.macro-blocks details { border-top:1px solid var(--line); }
.macro-blocks summary { padding:5px 6px; cursor:pointer; background:var(--panel); font-weight:600; }
.macro-blocks summary > span { float:right; color:var(--muted); font:11px var(--mono); }
.macro-follow-columns { display:flex; justify-content:space-between; padding:2px 46px 2px 26px; color:var(--muted); font-size:11px; border-bottom:1px solid var(--line); }
.macro-follow-row { display:flex; align-items:center; gap:4px; padding:0 6px; min-height:28px; border-bottom:1px solid var(--rule); }
.macro-follow-row:hover,.macro-follow-row:focus-within { background:var(--hover); }
.macro-follow-pick { display:flex; align-items:center; justify-content:center; flex:none; min-width:20px; min-height:28px; cursor:pointer; }
.macro-follow-pick > input { flex:none; width:14px; height:14px; accent-color:var(--ink); margin:0; }
.macro-follow-row > [data-macro-symbol] { display:flex; align-items:center; justify-content:space-between; gap:8px; flex:1; min-width:0; min-height:28px; padding:2px 0; border:0; text-align:left; }
.macro-follow-row [data-macro-symbol] > span { min-width:0; overflow-wrap:anywhere; }
.macro-follow-row:has(> [aria-current="true"]) { background:var(--sel); }
.macro-follow-row > button:hover { background:transparent; }
.macro-follow-row > .macro-compare { flex:none; padding:0 4px; min-width:36px; border:0; color:var(--muted); }
.macro-follow-row time { flex:none; color:var(--muted); font:11px var(--mono); font-variant-numeric:tabular-nums; }
.macro-follow-selection { display:flex; align-items:center; flex-wrap:wrap; gap:6px; position:sticky; bottom:0; padding:6px; background:var(--panel); border-top:1px solid var(--line); }
.macro-blocks[hidden],.macro-follow-selection[hidden],.macro-blocks [hidden] { display:none; }
.macro-series #quoteDetail,.macro-series #quoteDetailBtn { display:none; }
@media(max-width:720px) {
  /* Confine chart-library splitters to the workspace while the macro panel covers it. */
  #workspace:has(+ #macroCatalog:not([hidden])) { isolation:isolate; }
  .macro-blocks { position:absolute; inset:0; z-index:20; width:auto; max-width:none; border:0; }
  .macro-follow-search input { font-size:16px; }
  .macro-follow-search select { min-height:44px; font-size:16px; }
  .macro-follow-head :is([data-retry],[data-close]) { min-height:44px; min-width:44px; }
  #macroBtn { min-height:44px; min-width:44px; }
  .macro-blocks :is(button,summary),.macro-follow-search input,.macro-follow-row { min-height:44px; }
  .macro-follow-row { position:relative; gap:10px; }
  .macro-follow-pick { min-width:44px; min-height:44px; }
  .macro-follow-row > .macro-compare,.macro-follow-head button,.macro-follow-search button { min-width:44px; }
  .macro-blocks summary { padding-top:12px; padding-bottom:12px; }
  #charts.quad {display:flex;flex-direction:column;overflow-y:auto;}
  #charts.quad .chart {flex:none;min-height:300px;}
  .series-row label {flex:1 1 45%;}
  .workspace-form input {max-width:60vw;}
}

/* Price basis stays beside the option chart; explanations expand without covering it. */
.om-chart-tools select {flex-shrink:0;}
.om-price-context {padding:4px 10px;border-bottom:1px solid var(--line);font-size:11px;color:var(--muted);}
.om-price-basis {margin:0;line-height:1.5;}
.om-adjustment-info summary {cursor:pointer;line-height:1.8;}
.om-adjustment-info p {margin:5px 0;line-height:1.6;overflow-wrap:anywhere;}
@media(max-width:700px){.om-adjustment-info summary {min-height:44px;display:flex;align-items:center;}#optionsMarket [data-option-adj]{min-height:44px;}}

/* 持仓 (holdings.mjs): the 盯住 dialog's frame; rows sorted worst first; on a phone the quantity and weight drop. */
#holdings{position:fixed;inset:0;z-index:20;background:rgba(39,32,27,.25);display:flex;align-items:center;justify-content:center;outline:none}
#holdings[hidden],#holdings [hidden]{display:none!important}
#holdings.drop .dlg{outline:2px dashed var(--mag);outline-offset:-8px}
#holdings .dlg{width:min(980px,calc(100vw - 32px));height:min(760px,calc(100dvh - 32px));display:flex;flex-direction:column;background:var(--card);border:1px solid var(--line);color:var(--ink)}
#holdings .dlg-title{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--line)}
#holdings .t{font:600 23px var(--serif)}
#holdings .dlg-title>div{display:flex;gap:8px;align-items:center}
#holdings button{font:inherit;min-height:30px;padding:3px 12px;border:1px solid var(--line);background:var(--card);cursor:pointer;color:var(--ink)}
#holdings button:hover{background:var(--select)}
#holdings button.primary{background:var(--ink);color:var(--card);border-color:var(--ink)}
#holdings button.sea{border-color:var(--sea);color:var(--sea);font-weight:600}
#holdings button.seal{border-color:var(--seal);background:var(--seal);color:var(--card)}
#holdings :is(button,input,select):focus-visible{outline:2px solid var(--sea);outline-offset:2px}
#holdings input,#holdings select{font:inherit;color:var(--ink);background:var(--card);border:1px solid var(--line);padding:4px 6px;min-width:0;max-width:100%}
#holdings input[type=number]{width:96px}
#holdings .dlg-pane{flex:1;min-height:0;overflow:auto;padding:0 20px 16px}
#holdings .dlg-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding:10px 20px;min-height:48px}
#holdings .msg{font-size:12px;color:var(--muted);overflow-wrap:anywhere}
#holdings .msg[data-kind="success"]{color:var(--ink);border-left:3px solid var(--mag);padding-left:8px}
#holdings .msg[data-kind="error"]{color:var(--seal)}
#holdings .muted{color:var(--muted);font-size:12px;line-height:1.6}
#holdings .row{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:12px 0}
#holdings label{display:inline-flex;align-items:center;gap:4px}
#holdings h3{font:600 18px var(--serif);margin:20px 0 8px}
#holdings .consent,#holdings .empty-shot{max-width:640px;line-height:1.7}
#holdings .consent li{margin:4px 0}
#holdings .empty-shot{margin:24px auto;padding:24px;border:1px dashed var(--line);background:var(--paper);cursor:pointer;text-align:left}
#holdings .accts{display:flex;gap:20px;border-bottom:1px solid var(--rule);margin-top:4px;overflow-x:auto}
#holdings .accts button{border:0;border-bottom:2px solid transparent;background:none;padding:8px 0;white-space:nowrap}
#holdings .accts button.on{border-bottom-color:var(--mag);font-weight:600}
#holdings .checkup{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin:14px 0;padding:10px 12px;background:var(--paper);border-left:3px solid var(--mag)}
#holdings .checkup p{margin:0;line-height:1.6;min-width:0;overflow-wrap:anywhere}
#holdings table.hold{width:100%;border-collapse:collapse;font-size:13px}
#holdings table.hold th{text-align:left;font-weight:400;color:var(--muted);font-size:12px;padding:6px 6px;border-bottom:1px solid var(--line);white-space:nowrap}
#holdings table.hold td{padding:8px 6px;border-bottom:1px solid var(--rule);vertical-align:middle}
#holdings table.hold tr[data-s]{cursor:pointer}
#holdings table.hold tr[data-s]:hover{background:var(--select)}
#holdings .num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
#holdings .up{color:var(--up)}
#holdings .down{color:var(--down)}
#holdings .code{font:12px var(--mono);color:var(--muted)}
#holdings .acct{margin-left:6px;font-size:11px;color:var(--muted);border:1px solid var(--rule);padding:0 4px}
#holdings .guard{font-size:12px;color:var(--ink-soft);min-width:0;overflow-wrap:anywhere}
#holdings .bare{color:var(--muted)}
#holdings td.acts{white-space:nowrap;text-align:right}
#holdings td.acts button{min-height:26px;padding:1px 8px;font-size:12px}
#holdings tr.editing td{background:var(--paper)}
#holdings tr.editing label{margin-right:12px}
#holdings tr.miss td{background:rgba(165,122,30,.12)}
#holdings .shots{display:flex;gap:8px;align-items:flex-end;overflow-x:auto;margin:8px 0}
#holdings .shots img{height:120px;border:1px solid var(--line);object-fit:contain;background:var(--paper)}
#holdings .whole{margin:12px 0;font-size:13px}
#holdings .leaving{margin:0 0 12px;padding:8px 10px;border-left:3px solid var(--seal);background:var(--paper);font-size:13px;line-height:1.6}
#holdings .settings .acct-row{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;padding:12px 0;border-bottom:1px solid var(--rule)}
#holdings .danger{margin-top:24px;padding:12px;border-left:3px solid var(--seal);background:var(--paper)}
#holdings .danger p{margin:0 0 4px}
#holdings .reading{max-width:640px;margin:32px auto;line-height:1.7}
#holdings .reading .shots img{height:160px}
#holdings .reading h3{margin:16px 0 10px}
#holdings .reading .bar{height:2px;background:var(--rule);overflow:hidden}
#holdings .reading .bar i{display:block;width:30%;height:100%;background:var(--mag);animation:holdings-read 1.6s ease-in-out infinite}
#holdings .reading .sec{font:600 15px var(--mono);font-variant-numeric:tabular-nums}
@keyframes holdings-read{from{transform:translateX(-100%)}to{transform:translateX(340%)}}
@media(prefers-reduced-motion:reduce){#holdings .reading .bar i{animation:none;width:100%;opacity:.5}}
@media(max-width:600px){
 #holdings .dlg{width:calc(100vw - 16px);height:calc(100dvh - 16px)}
 #holdings .dlg-title{padding:12px;align-items:flex-start}
 #holdings .t{font-size:20px}
 #holdings .dlg-title>div{gap:4px;flex-wrap:wrap;justify-content:flex-end}
 #holdings .dlg-title button{padding:3px 7px}
 #holdings .dlg-pane{padding:0 12px 12px}
 #holdings .wide{display:none}
 #holdings td.acts button{min-height:44px;min-width:44px}
 #holdings tr.editing td[colspan]{display:flex;flex-wrap:wrap;gap:8px}
 #holdings button{min-height:44px}
 #holdings table.hold td,#holdings table.hold th{padding:8px 4px}
 #holdings .guard{max-width:110px}
 #holdings .confirm-rows input[type=number]{width:72px}
}

/* A quote-only workspace reuses the saved board columns and their title/edge drags. */
body.boards-only #charts, body.boards-only #quoteDetail, body.boards-only #tape,
body.boards-only #periods, body.boards-only #adj, body.boards-only #factorBtn,
body.boards-only #formulaBtn, body.boards-only #note, body.boards-only #eventControls,
body.boards-only #quoteDetailBtn { display: none; }
#cols.overview { flex:1; min-width:0; border-left:0; background:var(--bg); overflow:auto; }
/* Subgrid keeps every horizontal cut shared, even with 4 boards in one column and 3 in another. */
#cols.overview .bcol { container-type:normal; display:grid; grid-row:1 / -1; grid-template-rows:subgrid; overflow:visible; }
#cols.overview .bcol:first-child > .cgrip { display:none; }
#cols.overview .bpanel { container-type:inline-size; min-height:0; overflow:hidden; }
#cols.overview .bhead { min-height:26px; align-items:center; padding:2px 8px; font-weight:600; }
#cols.overview .bhead i { margin-left:6px; color:var(--muted); font:11px var(--mono); }
#cols.overview .bhead .agent { color:var(--sea); }
#cols.overview .bgrip { bottom:0; height:5px; }
#cols.overview .board-why { display:none; }
#cols.overview .bcol > select { align-self:center; margin:2px 4px; }
#cols.overview .bpanel:not(.preipo-panel) .rows li { grid-template-columns:18px 78px minmax(0,1fr) 62px 70px; column-gap:8px; padding:1px 8px; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > span { grid-row:1; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(1) { grid-column:1; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(2) { grid-column:3; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(3) { grid-column:2; display:block; font-family:var(--mono); }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(4) { grid-column:4; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(5) { grid-column:5; display:block; }
#cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(6) { display:none; }
#cols.overview .rows .num { font-family:var(--mono); }
#cols.overview .rows li.empty { display:block; }
.bpanel .head button { border:0; padding:0; background:transparent; color:inherit; font:inherit; white-space:nowrap; }
.bpanel .head button:hover { color:var(--ink); text-decoration:underline; }
.bhead button { flex-shrink:0; }
.bhead .board-close { border:0; padding:0; background:transparent; color:var(--muted); font:inherit; }
.bhead button:focus-visible { outline:1px solid var(--sea); outline-offset:1px; }
.bpanel .rows li:focus-visible { outline:1px solid var(--sea); outline-offset:-1px; }
body.board-row-sizing { cursor:row-resize; user-select:none; }
@container (max-width:340px) {
  #cols.overview .bpanel:not(.preipo-panel) .rows li { grid-template-columns:18px minmax(0,1fr) 58px 64px; column-gap:6px; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(2) { grid-column:2; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(3) { display:none; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(4) { grid-column:3; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(5) { grid-column:4; }
}
@container (max-width:230px) {
  #cols.overview .bpanel:not(.preipo-panel) .rows li { grid-template-columns:minmax(0,1fr) 58px; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(1),
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(5) { display:none; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(2) { grid-column:1; }
  #cols.overview .bpanel:not(.preipo-panel) .rows li > :nth-child(4) { grid-column:2; }
}
@media (max-width:720px) {
  #cols.overview { display:flex; flex-direction:column; overflow-y:auto; }
  #cols.overview .bcol { display:flex; flex-direction:column; flex:none; overflow:visible; }
  #cols.overview .bpanel { flex:none; height:300px; }
  #cols.overview .cgrip, #cols.overview .bgrip { display:none; }
  #cols.overview .bhead { min-height:44px; padding:0 8px; align-items:center; }
  #cols.overview .bhead button { min-width:44px; min-height:44px; }
  #cols.overview .bhead .x { text-align:center; }
}

body.boards-only.cloudmap-mode #charts { display:flex; }
body.boards-only.cloudmap-mode #cols { display:none; }

.board-quote-date { flex:none; padding:2px 6px; border-top:1px solid var(--line); color:var(--muted); font:11px var(--mono); }

/* What the team told the user on closing their feedback (feedback-replies.mjs) */
.feedback-replies { position:fixed; top:56px; right:16px; z-index:110; width:min(360px, calc(100vw - 32px)); max-height:60vh; overflow:auto; background:var(--paper); border:1px solid var(--line); border-left:3px solid var(--sea); padding:10px 12px; font-size:13px; color:var(--ink); }
.feedback-replies header { font-weight:600; margin-bottom:6px; }
.feedback-replies ul { list-style:none; margin:0 0 8px; padding:0; display:grid; gap:8px; }
.feedback-replies li { overflow-wrap:anywhere; }
.feedback-replies .fr-ref { font-family:var(--mono); color:var(--muted); font-size:11.5px; }
.feedback-replies .fr-what { color:var(--muted); }
.feedback-replies p { margin:2px 0 0; line-height:1.5; }
.feedback-replies .fr-ok { min-height:36px; padding:0 14px; border:1px solid var(--line); background:#fff; color:var(--ink); font:inherit; cursor:pointer; }

/* 左上角「有图」→ 六个页面一览（弹窗）。自包含，不依赖引导样式。 */
#bar #brandLearn { background:none; border:0; margin:0; padding:0 6px 0 2px; cursor:pointer; -webkit-appearance:none; appearance:none;
  height:100%; display:inline-flex; align-items:center; font-family:var(--sans); font-weight:800;
  font-size:var(--ref-text-sm); line-height:1.4; letter-spacing:.03em; color:var(--sys-actor-user); }
#bar #brandLearn:hover, #bar #brandLearn:focus-visible { color:var(--sys-actor-user); text-decoration:underline; text-underline-offset:3px; background:none; }

/* 每帧进度：6 秒走完自动翻页 */
@keyframes learnbar { from { width:0 } to { width:100% } }
body.learn-open { overflow:hidden; }
.learn-mask { position:fixed; inset:0; z-index:400; background:rgba(28,20,16,.42); display:flex; align-items:center; justify-content:center; padding:24px; }
.learn-shell { position:relative; width:min(1120px,100%); max-height:92vh; display:flex; }
.learn-sheet { width:100%; max-height:92vh; overflow:auto; background:#fdfbf9; border-radius:16px; box-shadow:0 24px 64px rgba(40,25,18,.28); padding:20px 26px 18px; }
.learn-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:10px; border-bottom:1px solid #f0e7e2; }
.learn-title { margin:0; font-family:var(--sans); font-weight:800; letter-spacing:-.01em; color:var(--sys-actor-user); font-size:20px; }
.learn-x { width:30px; height:30px; border:0; background:none; color:#8d857d; font-size:20px; line-height:1; cursor:pointer; border-radius:8px; }
.learn-x:hover { background:#f3ece7; color:#3b2f2a; }
.learn-body { position:relative; }
.learn-frame { display:grid; grid-template-columns:minmax(0,1fr) 372px; gap:24px; align-items:stretch; padding-top:16px; }
.learn-shot { background:#f7f4f1; border:1px solid #efe6e0; border-radius:10px; aspect-ratio:16/10; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.learn-shot img { width:100%; height:100%; object-fit:contain; display:block; }
.learn-copy { display:flex; flex-direction:column; min-height:0; }
.learn-copy h3 { margin:2px 0 6px; font-size:23px; font-weight:800; }
.learn-fn { margin:0 0 10px; color:#6f6660; font-size:13.5px; line-height:1.65; }
.learn-claim { margin:0 0 12px; padding-left:9px; border-left:3px solid #c4214f; color:#3b2f2a; font-size:14px; font-weight:700; line-height:1.55; }
.learn-cmp { display:grid; grid-template-columns:1fr 1fr; grid-auto-rows:1fr; flex:1; border:1px solid #f0e2e6; border-radius:10px; overflow:hidden; }
.learn-cmp-h { display:flex; align-items:baseline; padding:7px 12px; font-size:12px; background:#f7f2ef; border-bottom:1px solid #f0e2e6; color:#8d857d; }
.learn-cmp-h b { font-weight:700; }
.learn-cmp-h small { margin-left:6px; font-size:11px; font-weight:500; color:inherit; opacity:.85; }
.learn-cmp-h small:before { content:'· '; }
.learn-cmp-h.on { color:#a01a52; background:#fdeef3; }
.learn-cmp span { display:flex; align-items:center; padding:9px 12px; font-size:13px; line-height:1.55; border-bottom:1px solid #f4eae5; }
.learn-cmp span.them { color:#8d857d; background:#fcfaf9; }
.learn-cmp span.them:before { content:'—'; margin-right:7px; color:#c3b8b0; }
.learn-cmp span.us { color:#7a2340; background:#fdf2f6; font-weight:600; border-left:1px solid #f7dce6; }
.learn-cmp span.us:before { content:'✓'; margin-right:7px; color:#c4214f; font-weight:800; }
.learn-cmp span:nth-last-child(-n+2) { border-bottom:0; }
.learn-nav { display:flex; align-items:center; justify-content:center; gap:8px; margin-top:14px; }
.learn-dots { display:flex; gap:8px; }
.learn-dot { position:relative; width:34px; height:4px; padding:0; border:0; border-radius:2px; background:#e8ded8; cursor:pointer; overflow:visible; }
.learn-dot b { position:absolute; inset:0 auto 0 0; display:block; width:0; background:#c4214f; border-radius:2px; overflow:hidden; }
.learn-dot::after { content:''; position:absolute; inset:-9px 0; }
.learn-dot.done b { width:100%; }
.learn-dot.on b { animation:learnbar var(--learn-ms,6000ms) linear forwards; }
.learn-dot:hover b { background:#a01a52; }
.learn-dot:focus-visible { outline:2px solid #c4214f; outline-offset:3px; }
.learn-cnt { font-family:var(--mono); font-size:11.5px; color:#9b8f88; margin-left:4px; }
.learn-sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.learn-arw { position:absolute; top:50%; transform:translateY(-50%); z-index:2; width:42px; height:42px; display:flex; align-items:center; justify-content:center; border:1px solid #e8ded8; background:#fff; border-radius:50%; cursor:pointer; color:#5d5149; font-size:22px; line-height:1; box-shadow:0 6px 20px rgba(40,25,18,.16); }
.learn-arw:hover:not(:disabled) { border-color:#c4214f; color:#c4214f; }
.learn-arw:focus-visible { outline:2px solid #c4214f; outline-offset:2px; }
.learn-arw:disabled { opacity:.28; cursor:default; box-shadow:none; }
.learn-prev { left:-21px; }
.learn-next { right:-21px; }
@media (min-width:1240px) {
  .learn-prev { left:-56px; }
  .learn-next { right:-56px; }
}
@media (max-width:900px) {
  .learn-mask { padding:10px; }
  .learn-shell { max-height:94vh; }
  .learn-sheet { width:100%; max-height:94vh; padding:16px 16px 12px; border-radius:12px; }
  .learn-frame { grid-template-columns:1fr; gap:14px; padding-top:12px; }
  .learn-copy { order:-1; }
  .learn-intro .learn-copy { order:0; } /* 新用户：先看界面，再看对比 */
  .learn-title { font-size:17px; }
  .learn-copy h3 { font-size:19px; }
  .learn-claim { font-size:13.5px; }
  .learn-dot { width:22px; }
  .learn-arw { display:none; }
  .learn-cta { margin:10px auto 0; padding:8px 12px; font-size:12.5px; }
  .learn-intro .learn-shot { aspect-ratio:16/9; }
}
.learn-frame[hidden] { display:none !important; }

/* 新用户版（.learn-intro）：右上「跳过」、末帧「让幕僚认识你」、引导里「它还能干什么」入口 */
.learn-sheet:focus { outline:none; }
.learn-skip { border:0; background:none; color:#8d857d; font-size:13px; cursor:pointer; padding:5px 10px; border-radius:8px; }
.learn-skip:hover { background:#f3ece7; color:#3b2f2a; }
.learn-cta { display:flex; width:fit-content; align-items:center; gap:6px; margin:12px auto 2px; border:0; border-radius:9px; background:#c4214f; color:#fff;
  font:inherit; font-weight:800; font-size:13.5px; padding:9px 16px; cursor:pointer; box-shadow:0 6px 16px rgba(196,33,79,.22); }
.learn-cta i { font-style:normal; }
.learn-cta:hover { background:#a01a52; }
.learn-cta[hidden] { display:none; }
.wl-learnlink { margin-left:auto; border:0; background:none; color:#a01a52; font:inherit; font-size:13px; cursor:pointer;
  text-decoration:underline; text-underline-offset:3px; padding:4px 2px; }
.wl-learnlink:hover { color:#7a1a3e; }

/* The rail is part of the workbench's white work surface (docs/design.md): the ground is --bg, the same near-white
   paper the chart is drawn on, and its title is a panel head (--panel), like the 板块 column heads beside it.
   --card belongs to the 幕僚 panel, never to this one. */
/* The rail is a first-class workstation column pane (docs/design.md): its top header aligns to the exact 28px
   (--comp-panebar-h) horizontal row of #chartToolbar and .bcol-tabbar; sub-sections wear 22px .bhead section bars;
   and its left edge carries a .cgrip resize handle + [↗ 浮窗] pop-out button. */
#quoteDetail { position:relative; width:228px; flex:0 0 228px; border-left:1px solid var(--line); background:var(--bg); display:flex; flex-direction:column; min-height:0; overflow:auto; }
#quoteDetail[hidden] { display:none; }
/* Keep the chart's local toggle outside the scrolling toolbar, always at its right edge. */
#charts > #chartToolbar { margin-right:28px; }
#charts > #quoteDetailBtn {
  position:absolute; top:0; right:0; z-index:5;
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:var(--comp-panebar-h); padding:0;
  border:0; border-left:1px solid var(--line); border-bottom:1px solid var(--line);
  background:var(--panel); color:var(--muted); cursor:pointer;
}
#charts > #quoteDetailBtn:hover { color:var(--ink); background:var(--sys-state-hover); }
#charts > #quoteDetailBtn:focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
#charts > #quoteDetailBtn[aria-expanded="true"] { color:var(--ink); }
#quoteDetailBtn[aria-expanded="true"] .qd-toggle-chevron { transform:rotate(180deg); transform-origin:6.25px 8px; }
body:is(.today-mode,.world-mode,.watch-mode,.cloudmap-mode,.options-mode,.prediction-mode,.macro-mode,.macro-series) #charts > #quoteDetailBtn,
#workspace:has(> #quotes:not([hidden])) #quoteDetailBtn { display:none; }
#quoteDetail > header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  height:var(--comp-panebar-h, 28px);
  min-height:var(--comp-panebar-h, 28px);
  padding:0 8px;
  background:var(--sys-surface-panebar, var(--panel));
  border-bottom:1px solid var(--line);
  flex:none;
}
#quoteDetail .qd-title { display:inline-flex; align-items:center; gap:5px; min-width:0; overflow:hidden; }
#quoteDetail strong { display:inline; font-size:12px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#quoteDetail small { display:inline; color:var(--muted); font:11px/1 var(--mono); margin:0; white-space:nowrap; }
#quoteDetail .qd-acts { display:inline-flex; align-items:center; gap:4px; flex:none; }
#quoteDetail header .qd-float-btn {
  height:18px;
  padding:0 5px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--ink-soft);
  font:11px/1 var(--sans);
  white-space:nowrap;
}
#quoteDetail header .qd-float-btn:hover { border-color:var(--ink); color:var(--ink); background:var(--sys-surface-float, #fff); }
@media(max-width:720px) {
  #charts > #chartToolbar { margin-right:44px; height:44px; min-height:44px; }
  #charts > #quoteDetailBtn { width:44px; height:44px; }
}
.qd-overview { flex-shrink:0; border-bottom:1px solid var(--line); }
.qd-sec-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:22px;
  padding:0 8px;
  background:var(--panel);
  border-bottom:1px solid var(--rule);
  font:600 11px/1 var(--sans);
  color:var(--ink);
}
#quoteDetail dl { margin:0; padding:4px 8px; }
#quoteDetail dl > div { display:flex; justify-content:space-between; align-items:baseline; gap:6px; padding:3px 0; font-size:11px; }
#quoteDetail dt { color:var(--muted); white-space:nowrap; }
#quoteDetail dd { margin:0; font-family:var(--mono); font-variant-numeric:tabular-nums; text-align:right; font-size:11.5px; }
#quoteDetail .quote-last { display:flex; justify-content:space-between; align-items:baseline; padding:4px 0 6px; border-bottom:1px solid var(--rule); margin-bottom:2px; grid-column:1 / -1; }
#quoteDetail .quote-last dd { font-size:18px; font-weight:700; text-align:right; line-height:1.2; }
#quoteDetail .up { color:var(--up); } #quoteDetail .down { color:var(--down); }
.quote-asof { color:var(--muted); font:400 10px/1 var(--mono); padding:0; margin:0; }
.quote-trades { border-top:0; padding:0; flex:1 1 260px; min-height:160px; display:flex; flex-direction:column; overflow:hidden; }
.quote-trades[hidden] { display:none; }
.quote-tick-rows { flex:1 1 auto; min-height:0; overflow:auto; padding:0 8px; }
.quote-trades h3,.quote-trade-head,.quote-tick-status { flex-shrink:0; }
.quote-trades h3 {
  display:flex;
  align-items:center;
  height:22px;
  padding:0 8px;
  margin:0;
  background:var(--panel);
  border-bottom:1px solid var(--rule);
  font:600 11px/1 var(--sans);
  color:var(--ink);
}
.quote-trade-head { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; padding:3px 8px; border-bottom:1px solid var(--rule); background:var(--bg); }
.quote-trades p { color:var(--muted); text-align:center; font-size:11px; padding:10px 8px; }
body:is(.today-mode,.world-mode,.watch-mode,.cloudmap-mode,.options-mode,.prediction-mode,.macro-mode,.macro-series) #quoteDetail { display:none; }
.bar-inspector { position:absolute; z-index:8; width:210px; max-width:calc(100% - 8px); max-height:calc(100% - 8px); overflow:auto; border:1px solid var(--mag); background:var(--card); font-size:11px; line-height:1.4; user-select:none; }
.bar-inspector[hidden] { display:none; }
.bar-inspector header { display:flex; justify-content:space-between; gap:8px; align-items:center; padding:3px 6px; background:var(--mag); color:var(--card); cursor:move; touch-action:none; }
.bar-inspector header button { border:0; background:transparent; color:inherit; font-size:14px; padding:0 2px; }
.bar-inspector dl { margin:0; padding:5px 7px; }
.bar-inspector dl > div { display:flex; justify-content:space-between; gap:8px; padding:1px 0; }
.bar-inspector dt { color:var(--muted); white-space:nowrap; }
.bar-inspector dd { margin:0; font-family:var(--mono); font-variant-numeric:tabular-nums; text-align:right; }
.bar-inspector dd.up { color:var(--up); } .bar-inspector dd.down { color:var(--down); }
.bar-inspector > p { margin:0; padding:3px 7px 5px; font-size:9px; color:var(--muted); border-top:1px solid var(--rule); }
/* The overlay leaves the shared chart toggle and toolbar reachable while it is open. */
@media(max-width:900px) { #quoteDetail { position:absolute; right:0; top:var(--comp-panebar-h); bottom:0; z-index:12; } }
@media(max-width:720px) { #quoteDetail { top:44px; } }

.company-events {position:relative;border-top:1px solid var(--line);padding:0;flex:0 0 116px;min-height:116px;max-height:116px;display:flex;flex-direction:column;overflow:hidden;}
.company-events .company-range,.company-events .company-footnote {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.company-events .company-empty {margin:5px 8px;font-size:10px;line-height:1.4;}
.company-event-list {flex:1 1 auto;min-height:0;overflow:auto;padding:0 8px;}
.company-events[hidden] {display:none;}
#quoteDetail .company-events > header {display:flex;align-items:center;justify-content:space-between;gap:4px;height:22px;padding:0 8px;background:var(--panel);border-bottom:1px solid var(--rule);flex-shrink:0;}
.company-events h3 {font:600 11px/1 var(--sans);margin:0;white-space:nowrap;color:var(--ink);}
.company-events select {font:11px var(--sans);background:var(--bg);color:var(--ink);border:1px solid var(--line);height:18px;min-height:18px;padding:0 3px;max-width:110px;}
.company-range,.company-footnote,.company-empty {font-size:11px;color:var(--muted);line-height:1.5;}
.company-event-list ol {list-style:none;padding:0;margin:0;}
.company-event-list li {border-top:1px solid var(--rule);padding:4px 0;}
.company-event-top {display:flex;align-items:center;justify-content:space-between;gap:6px;}
.company-event-top time {font:12px var(--mono);font-variant-numeric:tabular-nums;}
.date-status {font:11px var(--sans);padding:1px 3px;border:1px solid var(--line);color:var(--ink-soft);}
.date-status.estimated {color:var(--mustard);border-color:var(--mustard);}
.date-status.unverified {color:var(--muted);}
.company-event-label {font-size:11px;margin:2px 0;}
.company-event-list details {font-size:11px;overflow-wrap:anywhere;color:var(--ink-soft);}
.company-event-list summary {cursor:pointer;color:var(--muted);}
.company-event-list details p {margin:5px 0;white-space:pre-wrap;}
.company-event-list button {font:12px var(--sans);background:var(--card);color:var(--ink);border:1px solid var(--line);}
@media(max-width:700px){.company-events select,.company-event-list button,.company-event-list summary {min-height:44px;display:flex;align-items:center;}}

.quote-trade-head,.quote-tick-row {display:grid;grid-template-columns:54px minmax(0,1.15fr) minmax(0,.85fr);column-gap:12px;font-family:var(--mono);font-variant-numeric:tabular-nums;}
.quote-trade-head span:not(:first-child),.quote-tick-row span:not(:first-child) {text-align:right;}
.quote-tick-row {font-size:11px;padding:3px 0;border-bottom:1px solid var(--rule);}
.quote-trades .quote-tick-status {font:10px var(--sans);line-height:1.5;text-align:left;padding:4px 8px;margin:0;border-top:1px solid var(--rule);}

.quote-trade-head span,.quote-tick-row span {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

.order-book {flex-shrink:0;padding:0 0 4px;border-bottom:1px solid var(--line);}
.order-book[hidden] {display:none;}
#quoteDetail .order-book > header {display:flex;justify-content:space-between;align-items:center;height:22px;padding:0 8px;background:var(--panel);border-bottom:1px solid var(--rule);margin-bottom:2px;}
.order-book h3 {font:600 11px/1 var(--sans);margin:0;color:var(--ink);}
#quoteDetail .order-book small {font:10px var(--mono);margin:0;}
.order-book-row {display:grid;grid-template-columns:28px minmax(0,1fr) minmax(0,1fr);column-gap:10px;padding:2px 8px;font:11px/1.35 var(--mono);font-variant-numeric:tabular-nums;}
.order-book-row span {min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right;}
.order-book-row span:first-child {text-align:left;color:var(--muted);}
.order-book-bid-first {border-top:1px solid var(--line);margin-top:3px;padding-top:4px;}
.order-book-status {font:10px var(--sans);color:var(--muted);margin:4px 8px 0;}
#quoteDetail.quote-with-book dl {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:8px;padding:4px 8px;flex-shrink:0;}
#quoteDetail.quote-with-book dl > div {display:flex;gap:3px;padding:2px 0;min-width:0;margin:0;border:0;font-size:11px;}
#quoteDetail.quote-with-book dd {font-size:11px;line-height:1.4;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#quoteDetail.quote-with-book .quote-last {grid-column:1 / -1;padding:2px 0 4px;margin-bottom:2px;border-bottom:1px solid var(--rule);}
#quoteDetail.quote-with-book .quote-last dd {font-size:15px;font-weight:700;}
#quoteDetail.quote-with-book .quote-asof {margin:0;flex-shrink:0;}

#quoteDetail dl > div[hidden] {display:none;}

.quote-daily-asof {color:var(--muted);font:10px/1.5 var(--sans);padding:0 12px;margin:-3px 0 6px;flex-shrink:0;}

.quote-option-info {padding:0 12px 6px;color:var(--muted);font:10px/1.5 var(--sans);flex-shrink:0;}
.quote-option-info p {margin:3px 0;overflow-wrap:anywhere;}
.quote-option-info summary {cursor:pointer;}
.quote-option-info[hidden] {display:none;}
@media(max-width:700px){.quote-option-info summary {min-height:44px;display:flex;align-items:center;}}

.index-valuation {border-top:1px solid var(--line);padding:8px 12px;flex:0 0 auto;font:11px var(--sans);line-height:1.5;min-width:0;overflow-wrap:anywhere;}
.index-valuation[hidden] {display:none;}
.index-valuation > header {display:flex;align-items:center;justify-content:space-between;gap:4px;}
.index-valuation h3 {margin:0;font-size:12px;font-weight:500;}
.index-valuation select,.index-valuation button {font:11px var(--sans);min-height:26px;border:1px solid var(--line);background:var(--card);color:var(--ink);max-width:90px;}
.index-valuation p {margin:5px 0;color:var(--muted);}
#quoteDetail .iv-values {padding:0;}
#quoteDetail .iv-values > div {padding:2px 0;}
.iv-percentiles > div {display:flex;justify-content:space-between;gap:8px;}
.iv-percentiles b {font:12px var(--mono);font-variant-numeric:tabular-nums;}
.index-valuation .iv-warning {color:var(--mustard);}
.index-valuation details {margin-top:5px;}
.index-valuation summary {cursor:pointer;color:var(--ink-soft);}
@media(max-width:700px){.index-valuation select,.index-valuation button,.index-valuation summary {min-height:44px;}}

.chart-range-band { position:absolute; z-index:2; pointer-events:none; background:color-mix(in srgb,var(--sys-actor-user) 7%,transparent); border-inline:1px solid var(--sys-actor-user); box-sizing:border-box; }
.chart-range { position:absolute; z-index:9; width:252px; max-width:calc(100% - 8px); max-height:calc(100% - 8px); overflow:auto; border:1px solid var(--sys-actor-user); background:var(--sys-surface-card); color:var(--sys-text-primary); font-size:12px; line-height:1.5; user-select:none; }
.chart-range[hidden], .chart-range-band[hidden] { display:none; }
.chart-range header { display:flex; align-items:center; justify-content:space-between; padding:3px 8px; border-bottom:1px solid var(--sys-border-subtle); }
.chart-range header strong { font-weight:600; }
.chart-range header button { display:grid; place-items:center; width:24px; height:24px; padding:0; border:0; background:transparent; color:var(--sys-text-secondary); font-size:18px; }
.chart-range header button:hover { background:var(--sys-state-hover); }
.chart-range header button:focus-visible { outline:1px solid var(--sys-actor-user); outline-offset:-2px; }
.chart-range .range-dates { padding:5px 8px 0; color:var(--sys-text-secondary); font-size:11px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.chart-range .range-return { display:flex; align-items:baseline; gap:10px; padding:2px 8px 5px; font-family:var(--mono); font-variant-numeric:tabular-nums; }
.chart-range .range-return strong { font-size:20px; font-weight:600; }
.chart-range .range-return.up { color:var(--sys-market-up); }
.chart-range .range-return.down { color:var(--sys-market-down); }
.chart-range dl { display:grid; grid-template-columns:1fr 1fr; gap:2px 12px; margin:0; padding:5px 8px; border-top:1px solid var(--sys-border-subtle); }
.chart-range dl > div { display:flex; flex-wrap:wrap; justify-content:space-between; column-gap:6px; min-width:0; }
.chart-range dt { color:var(--sys-text-secondary); }
.chart-range dd { margin:0; margin-left:auto; text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.chart-range > p { margin:0; padding:4px 8px 6px; border-top:1px solid var(--sys-border-subtle); color:var(--sys-text-secondary); font-size:11px; }
.range-measuring, .range-measuring * { cursor:crosshair !important; user-select:none; }

#chat .ch-model-tag { border:1px solid var(--line); background:var(--card); color:var(--muted); font:11px var(--mono); padding:2px 5px; }
#chat .ch-model-tag[aria-expanded=true] { color:var(--ink); border-color:var(--mag); }
.ch-model-settings { flex:none; border-bottom:1px solid var(--line); background:var(--card); padding:8px 12px; max-height:55vh; overflow:auto; }
.ch-model-settings[hidden] { display:none; }
.ch-model-settings header { display:flex; align-items:center; justify-content:space-between; font-size:12px; margin-bottom:6px; }
.ch-model-settings header button { border:0; background:transparent; color:var(--muted); }
.ch-model-settings label { display:grid; grid-template-columns:54px minmax(0,1fr); align-items:center; gap:6px; margin:6px 0; font-size:12px; }
.ch-model-settings input,.ch-model-settings select { min-width:0; width:100%; box-sizing:border-box; border:1px solid var(--line); background:var(--paper); color:var(--ink); padding:4px 6px; font:12px var(--mono); }
.model-key-actions { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.model-key-actions button { border:1px solid var(--line); background:var(--paper); color:var(--ink); padding:3px 8px; font-size:12px; }
.model-key-status { font-size:12px; color:var(--ink); overflow-wrap:anywhere; margin:7px 0; }
.model-key-help { font-size:11px; color:var(--muted); margin:6px 0 0; line-height:1.5; }

.om-insights { flex:none; display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:12px; padding:8px; border-bottom:1px solid var(--line); background:var(--paper); }
.oi-series { min-width:0; }
.oi-caption { position:absolute; top:6px; left:8px; right:68px; z-index:2; pointer-events:none; }
.oi-heading { display:flex; align-items:baseline; gap:14px; }
.oi-heading h2 { font:14px var(--sans); font-weight:600; margin:0; }
.oi-date { color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.oi-summary { font-size:11px; line-height:16px; margin:2px 0 0; color:var(--ink-soft); }
.oi-plot { position:relative; height:210px; }
.oi-chart { width:100%; height:100%; }
.oi-message { position:absolute; inset:72px 0 26px; z-index:3; display:flex; align-items:center; justify-content:center; gap:10px; color:var(--muted); background:var(--bg); font-size:12px; }
.oi-message[hidden] { display:none; }
.oi-reading { position:absolute; left:8px; bottom:26px; z-index:2; pointer-events:none; background:var(--bg); margin:0; font:11px var(--mono); color:var(--muted); }
.oi-metrics { display:flex; flex-direction:column; min-width:0; }
#optionsMarket .oi-metrics button { flex:1; display:grid; grid-template-columns:minmax(0,1fr) auto; align-content:center; align-items:baseline; gap:2px 8px; text-align:left; padding:5px 8px; border:0; border-bottom:1px solid var(--line); background:transparent; }
#optionsMarket .oi-metrics button:last-child { border-bottom:0; }
#optionsMarket .oi-metrics button:hover { background:var(--hover); }
#optionsMarket .oi-metrics button[aria-pressed=true] { background:var(--sel); }
.oi-metrics strong { font:17px var(--num); font-variant-numeric:tabular-nums; text-align:right; }
.oi-metrics small { font-size:11px; color:var(--muted); }
.oi-metrics small:last-child { text-align:right; }
.oi-trial { margin-left:6px; }
.metric-edit>:not(.option-metric-editor):not(.out) { display:none; }
@container (max-width:800px) {
  .om-insights { grid-template-columns:minmax(0,1fr); gap:8px; padding:8px; }
  .oi-metrics { grid-row:1; }
  #optionsMarket .oi-metrics button { padding:5px 8px; min-height:48px; }
  .oi-heading { flex-wrap:wrap; gap:4px 10px; }
  .oi-plot { height:224px; }
}

/* The same bounded canvas and compact controls as the stock workspace. */
body.prediction-mode { overflow:hidden; }
.prediction-mode #bar :is(#periods,#adj,#layoutBtn,#formulaBtn,#note,#status) { display:none; }
.prediction-mode #workspace > :not(#predictionMarket) { display:none !important; }
/* Active state for #predictionMarketBtn is unified in ui.css (#bar button[aria-pressed="true"]) */
#predictionMarket { flex:1; min-width:0; min-height:0; overflow:hidden; color:var(--ink); background:var(--bg); }
#predictionMarket [hidden], #predictionMarket[hidden] { display:none !important; }
#predictionMarket :is(button,input,select) { font:inherit; color:var(--ink); border:1px solid var(--line); background:var(--bg); border-radius:0; min-height:26px; padding:2px 8px; }
#predictionMarket button { cursor:pointer; }
#predictionMarket button:hover { background:var(--paper); border-color:var(--ink-soft); }
#predictionMarket button:disabled { color:var(--muted); cursor:default; }
#predictionMarket :is(button,input,select,a,summary):focus-visible { outline:2px solid var(--sea); outline-offset:-2px; }
.pm-workspace { display:grid; grid-template-columns:minmax(0,1fr) 320px; height:100%; min-height:0; }
.pm-detail { grid-column:1; grid-row:1; min-width:0; min-height:0; }
.pm-detail-content { height:100%; display:flex; flex-direction:column; position:relative; }
.pm-detail-empty, .pm-empty { padding:20px 12px; color:var(--ink-soft); line-height:1.7; }
.pm-tools { display:flex; align-items:center; flex-wrap:wrap; gap:5px 8px; padding:5px 8px; background:var(--panel); border-bottom:1px solid var(--line); flex:none; }
.pm-range { display:flex; border:1px solid var(--line); }
#predictionMarket .pm-range button { border:0; background:transparent; min-height:24px; }
#predictionMarket .pm-range [aria-pressed="true"] { background:var(--ink); color:var(--card); }
.pm-tools [data-action="back"] { display:none; }
.pm-result { display:flex; align-items:center; gap:5px; color:var(--ink-soft); }
.pm-result select { max-width:140px; }
.pm-tool-secondary { margin-left:auto; display:flex; gap:5px; }
.pm-chart { flex:1; min-height:0; position:relative; overflow:hidden; }
.pm-probability { position:absolute; inset:0; z-index:0; }
.pm-legend { z-index:1; position:absolute; top:7px; left:12px; right:84px; pointer-events:none; font-size:12px; line-height:1.6; }
.pm-title-row { display:flex; align-items:flex-start; gap:8px; }
.pm-title { font:600 14px/1.6 var(--sans); margin:0; overflow-wrap:anywhere; }
#predictionMarket .pm-title-row button { pointer-events:auto; flex:none; min-height:24px; font-size:11px; padding:1px 6px; color:var(--ink-soft); }
.pm-quote-row { display:flex; flex-wrap:wrap; gap:2px 14px; margin-top:2px; font-variant-numeric:tabular-nums; }
.pm-quote-row > span { color:var(--ink-soft); }
.pm-quote-row strong { font-weight:500; color:var(--ink); }
.pm-quote-row .pm-current { color:var(--sea); font-weight:600; }
.pm-event-state { font-size:11px; }
.pm-live { margin:2px 0 0; color:var(--ink-soft); font-size:11px; font-variant-numeric:tabular-nums; }
.pm-crosshair { color:var(--ink-soft); min-height:18px; font-size:11px; font-variant-numeric:tabular-nums; }
.pm-asset-title { margin:2px 0; font-size:11px; color:var(--ink-soft); }
.pm-statusbar { flex:none; flex-wrap:wrap; display:flex; align-items:center; gap:8px; min-height:28px; border-top:1px solid var(--rule); padding:2px 8px; }
.pm-chart-status { flex:1; min-width:0; font-size:11px; color:var(--ink-soft); line-height:1.5; }
#predictionMarket .pm-statusbar button { border-color:transparent; font-size:11px; flex:none; }
.pm-action-status { position:absolute; right:84px; bottom:40px; background:var(--panel); font-size:12px; color:var(--ink-soft); padding:5px 8px; }
.pm-action-status:empty { display:none; }
/* The directory is the only persistent scroll area. */
.pm-directory { grid-column:2; grid-row:1; display:flex; flex-direction:column; min-height:0; min-width:0; border-left:1px solid var(--line); background:var(--bg); }
.pm-directory-head { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:5px 10px; background:var(--panel); border-bottom:1px solid var(--line); }
.pm-directory-head h2 { margin:0; font:600 13px var(--sans); }
.pm-tabs { display:flex; gap:4px; padding:4px 8px; }
#predictionMarket .pm-tabs button { flex:1; border-color:transparent; background:transparent; }
#predictionMarket .pm-tabs button[aria-pressed="true"] { border-bottom:2px solid var(--mag); font-weight:600; }
.pm-filter { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 10px 6px; font-size:12px; }
.pm-filter select { min-width:115px; }
.pm-list-status { color:var(--ink-soft); font-size:11px; padding:4px 10px; background:var(--panel); }
.pm-list-status:empty { display:none; }
.pm-list { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; }
.pm-group-title { margin:0; padding:4px 10px; font:500 11px/1.5 var(--sans); color:var(--ink-soft); background:var(--panel); border-block:1px solid var(--rule); }
.pm-row-head { display:flex; align-items:stretch; border-bottom:1px solid var(--rule); }
#predictionMarket .pm-expand { border:0; width:24px; flex:none; padding:0; background:transparent; }
#predictionMarket .pm-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:2px 8px; text-align:left; border:0; padding:7px 10px 7px 0; background:transparent; min-width:0; flex:1; }
#predictionMarket .pm-row[aria-pressed="true"] { background:var(--paper); color:var(--sea); }
.pm-row-title { grid-column:1/-1; font-size:12px; font-weight:600; overflow-wrap:anywhere; }
.pm-row-outcome { color:var(--ink-soft); font-size:11px; align-self:center; overflow-wrap:anywhere; }
.pm-row-numbers { display:flex; flex-direction:column; align-items:flex-end; color:var(--ink); font-variant-numeric:tabular-nums; font-size:10px; }
.pm-row-numbers strong { font:600 13px var(--sans); }
.pm-row-numbers span { color:var(--ink-soft); }
.pm-options { padding:0 10px 4px 24px; }
#predictionMarket .pm-options button { display:flex; justify-content:space-between; gap:8px; text-align:left; width:100%; border:0; border-top:1px solid var(--rule); background:transparent; padding:5px 6px; font-size:12px; }
#predictionMarket .pm-options button[aria-pressed="true"] { background:var(--paper); color:var(--sea); }
.pm-options strong { white-space:nowrap; font-weight:500; font-variant-numeric:tabular-nums; }
#predictionMarket .pm-more { display:block; width:100%; border:0; color:var(--ink-soft); text-align:left; padding:4px 10px; font-size:11px; }
/* Native top-layer panels keep secondary controls out of the canvas. */
.pm-popover { inset:80px 336px auto auto; margin:0; width:min(420px,calc(100vw - 24px)); max-height:calc(100dvh - 130px); overflow:auto; padding:16px; border:1px solid var(--line); background:var(--card); color:var(--ink); }
.pm-popover h3 { margin:0 0 12px; font:600 14px var(--sans); }
.pm-popover header { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.pm-filter-panel { right:12px; top:145px; width:290px; }
.pm-liquidity { display:flex; align-items:center; gap:6px; }
#predictionMarket .pm-liquidity input { min-height:0; width:16px; height:16px; accent-color:var(--ink); }
.pm-scope, .pm-meta, .pm-live-detail, .pm-rules { font-size:12px; line-height:1.8; color:var(--ink-soft); }
.pm-rules summary { cursor:pointer; padding:8px 0; color:var(--ink); }
.pm-rule-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.pm-resolution { overflow-wrap:anywhere; }
.pm-asset-status:empty { display:none; }
.pm-asset-status { font-size:12px; color:var(--ink-soft); flex-basis:100%; }
.pm-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; border-top:1px solid var(--line); margin-top:12px; padding-top:12px; }
.pm-actions a { color:var(--sea); }
.pm-search-dialog { width:min(600px,calc(100vw - 24px)); max-height:80dvh; overflow:auto; padding:18px; color:var(--ink); background:var(--card); border:1px solid var(--line); }
.pm-search-dialog::backdrop { background:var(--line); opacity:.65; }
.pm-search-dialog header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.pm-search-dialog h2 { margin:0; font:600 18px var(--sans); }
.pm-search { display:flex; gap:6px; }
.pm-search input { flex:1; min-width:0; }
.pm-search-status { color:var(--ink-soft); font-size:12px; line-height:1.6; }
.pm-search-result { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-top:1px solid var(--rule); }
.pm-search-result strong { font-size:14px; }
.pm-search-result small { display:block; margin-top:6px; color:var(--ink-soft); }
.pm-search-result button { flex-shrink:0; }
@media(max-width:1100px) and (min-width:721px) {
  .pm-workspace { grid-template-columns:minmax(0,1fr) 280px; }
  .pm-popover { right:292px; }
  .pm-filter-panel { right:12px; }
}
@media(max-width:720px) {
  #predictionMarket :is(button,input,select), .prediction-mode #bar button { min-height:44px; }
  .pm-workspace { display:block; }
  .pm-directory { height:100%; border:0; }
  .pm-detail { display:none; height:100%; }
  .pm-show-detail .pm-directory { display:none; }
  .pm-show-detail .pm-detail { display:block; }
  .pm-tools { gap:4px; padding:4px; }
  .pm-tools [data-action="back"] { display:block; }
  #predictionMarket .pm-range button { min-height:42px; padding-inline:7px; }
  .pm-tools [data-action="close"], .pm-tools [data-action="options"], .pm-turnover { display:none; }
  .pm-result { margin-right:auto; }
  .pm-result select { max-width:95px; }
  .pm-legend { left:8px; right:65px; }
  .pm-title { font-size:12px; line-height:1.4; }
  .pm-title-row { flex-wrap:wrap; gap:2px; }
  #predictionMarket .pm-title-row button { min-height:44px; }
  .pm-quote-row { gap:1px 8px; font-size:11px; }
  .pm-title-row [data-action="favorite"] { position:absolute; top:0; right:-60px; max-width:60px; }
  .pm-popover { inset:110px 12px auto; width:auto; }
  #predictionMarket .pm-expand { width:44px; }
  .pm-options { padding-left:44px; }
  #predictionMarket .pm-statusbar button { min-height:44px; }
  .pm-statusbar { align-items:flex-start; }
  .pm-rules summary, .pm-actions a { min-height:44px; display:flex; align-items:center; }
}

/* Daily Command Center 4.1 (今日作战指挥室, TODAY / daily-desk):
   Unified 2-Column Decision Workbench ("左：62% 交互K线(含右上叠加卡+行业收盘叠加线) + 38% 双栏认知底座 | 右：四段式导览列表").
   Follows docs/design.md & palette.css: warm paper ground, 1px square borders, 0px radius, zero drop-shadows,
   tabular numerals, red/green strictly on directional numbers, sea blue for 幕僚, magenta for user's own holdings. */
/* The 世界 view (#worldModel, public/app/world-model.mjs) shares this whole layout, so the two views feel the same. */
:is(#dailyDesk, #worldModel, #watchDesk) {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  caret-color: var(--mag);
  scrollbar-color: var(--line) var(--paper);
}
:is(#dailyDesk, #worldModel, #watchDesk)[hidden] {
  display: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) ::selection {
  background: var(--sel);
  color: var(--ink);
}
:is(#dailyDesk, #worldModel, #watchDesk) :is(button, input, a, summary, li[tabindex], .dd-chart-canvas):focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: -2px;
}
/* Active state for #todayBtn is unified in ui.css (#bar button[aria-pressed="true"]) */
body.today-mode #bar #periods button.on {
  background: var(--chart-bg);
  color: var(--ink-soft);
}
body:is(.today-mode, .watch-mode) #bar :is(#adj, #layoutBtn, #formulaBtn, #note, #eventControls) {
  display: none;
}
@media (max-width: 720px) {
  body:is(.today-mode, .watch-mode) #bar #periods {
    display: none;
  }
}

.dd-loading,
.dd-empty-hint {
  padding: 18px;
  color: var(--muted);
  font-size: 13.5px;
}

/* Master-Detail Split Layout: Left Stage (flex: 1) + Right 3-Section List (.dd-side.bcol, 384px) */
.dd-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.dd-stage {
  container-type: inline-size;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}
.dd-stage-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dd-side {
  flex: none;
  width: 384px;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--chart-bg);
  display: flex;
  flex-direction: column;
}

/* Base Buttons inside Daily Desk: 28px square 1px border on desktop */
:is(#dailyDesk, #worldModel, #watchDesk) button {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--chart-bg);
  color: var(--ink);
  font: 12.5px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
:is(#dailyDesk, #worldModel, #watchDesk) button:hover:not(:disabled) {
  border-color: var(--ink-soft);
  background: var(--hover);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.primary:hover:not(:disabled) {
  background: var(--ink-soft);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.sea {
  border-color: var(--sea);
  color: var(--sea);
  background: var(--chart-bg);
  font-weight: 600;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.sea:hover:not(:disabled) {
  background: var(--sel);
}
:is(#dailyDesk, #worldModel, #watchDesk) button:disabled {
  opacity: 0.55;
  cursor: default;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-link-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--sea);
  border-color: var(--line);
  background: var(--chart-bg);
}

/* Top Phase Bar inside Left Master Stage:
   Strict affordance discipline — non-clickable date, regime & engine status stay borderless;
   ONLY real buttons ([N项待拍板 →], [返回看图 Esc]) wear 1px keycap borders. */
.dd-phase-bar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 6px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.dd-phase-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.dd-room-title {
  font: 700 15px/1 var(--serif);
  color: var(--ink);
  letter-spacing: 0.03em;
}
.dd-date-pill {
  font: 12.5px/1 var(--mono);
  color: var(--muted);
  padding: 0 9px 0 0;
  border-right: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.dd-regime {
  display: inline-flex;
  align-items: center;
  padding: 2px 0 2px 9px;
  border-left: 3px solid var(--ink);
  font: 700 13px/1.15 var(--serif);
  color: var(--ink);
}
.dd-regime.tone-mustard {
  border-left-color: var(--mustard);
  color: var(--mustard);
}
.dd-regime.tone-up {
  border-left-color: var(--mag);
  color: var(--ink);
}
.dd-regime.tone-muted {
  border-left-color: var(--muted);
  color: var(--ink-soft);
}
.dd-command-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  max-width: 100%;
  min-width: 0;
}
.dd-status-note {
  font-size: 12.5px;
  color: var(--sea);
  max-width: 100%;
}
:is(#dailyDesk, #watchDesk) button[data-a="save-enter"] { min-width: 108px; }
:is(#dailyDesk, #watchDesk) button.dd-action-confirmed {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--ink);
  font-weight: 600;
}
.dd-action-error {
  flex-basis: 100%;
  grid-column: 1 / -1;
  order: 1;
  color: var(--seal);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 720px) {
  :is(#dailyDesk, #watchDesk) button[data-feedback-key] { min-height: 44px; }
}
.dd-status-note:empty {
  display: none;
}
.dd-radar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0 2px;
  font: 12.5px/1.3 var(--sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dd-radar-pill b {
  color: var(--ink);
  font-family: var(--mono);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-urgent-jump {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--seal);
  background: var(--card);
  color: var(--seal);
  font: 700 12px/1 var(--mono);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-urgent-jump:hover {
  background: color-mix(in srgb, var(--seal) 10%, var(--card));
}
.dd-radar-dot {
  width: 6px;
  height: 6px;
  background: var(--sea);
  flex: none;
}
.dd-radar-dot.is-live,
.dd-radar-pill.has-urgent .dd-radar-dot {
  background: var(--mag);
  animation: dd-pulse 2.2s ease-in-out infinite;
}
@keyframes dd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.32; }
}

/* ==========================================================================
   Persistent Embedded Interactive K-line Box (DeskChartBox -> ChartView)
   ========================================================================== */
.dd-chart-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 230px;
  background: var(--chart-bg);
}
.dd-chart-toolbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 10px;
  padding: 5px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.dd-chart-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  min-width: 0;
}
.dd-chart-tag {
  font: 600 12px/1.1 var(--sans);
  color: var(--muted);
  white-space: nowrap;
}
.dd-chart-tag[hidden] {
  display: none;
}
.dd-chart-sym {
  font: 700 14.5px/1.2 var(--sans);
  color: var(--ink);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-chart-code {
  font: 12px/1 var(--mono);
  color: var(--muted);
}
.dd-chart-code:empty {
  display: none;
}
.dd-chart-quote {
  font: 700 13.5px/1 var(--mono);
  color: var(--ink);
  white-space: nowrap;
}
.dd-chart-quote:empty {
  display: none;
}
.dd-chart-qtabs {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}
.dd-chart-qtabs[hidden] {
  display: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-qtab {
  height: 23px;
  padding: 0 7px;
  font-size: 12px;
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-qtab + button.dd-qtab {
  margin-left: -1px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-qtab.on {
  position: relative;
  z-index: 1;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--chart-bg);
}
.dd-chart-ctrls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-chart-act {
  height: 23px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-chart-act[hidden] {
  display: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-chart-act.is-mag {
  border-color: var(--mag);
  color: var(--mag);
  background: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-chart-act.is-mag:hover {
  background: color-mix(in srgb, var(--mag) 9%, var(--chart-bg));
}
.dd-chart-tfs,
.dd-chart-zooms {
  display: inline-flex;
  align-items: center;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-tf-btn,
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-zoom-btn {
  height: 23px;
  padding: 0 7px;
  font-size: 12px;
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-tf-btn + button.dd-tf-btn,
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-zoom-btn + button.dd-zoom-btn {
  margin-left: -1px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-tf-btn.on {
  position: relative;
  z-index: 1;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--chart-bg);
}
.dd-chart-canvas {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 200px;
  overflow: hidden;
  background: var(--chart-bg);
}
/* Date spans shaded over the price pane (DeskChartBox.drawSpans): an asset's big swings in the 世界 view. */
.dd-chart-spans { position: absolute; inset: 0 64px 0 0; pointer-events: none; z-index: 2; overflow: hidden; }
.dd-chart-span { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--mustard) 9%, transparent); border: 0 dashed color-mix(in srgb, var(--mustard) 55%, transparent); border-width: 0 1px; }
.dd-chart-span.on { background: color-mix(in srgb, var(--mustard) 22%, transparent); border-style: solid; }
.dd-chart-span span { position: absolute; left: 4px; top: 30px; font: 600 11.5px/16px var(--sans); color: var(--ink); background: color-mix(in srgb, var(--chart-bg) 85%, transparent); padding: 0 4px; white-space: nowrap; }
.dd-chart-tfs[hidden] { display: none; }
/* Inside embedded DeskChartBox, toolbar shows symbol/code/quote, so hide ChartView's duplicate star/camera/title */
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .dl,
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg [data-star],
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg [data-wt],
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg [data-rm],
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg [data-un],
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg[data-pane="0"] .title,
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg[data-pane="0"] .legend-period,
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg[data-pane="0"] .legend-adjustment {
  display: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) .dd-chart-canvas .lg {
  font-size: 12px;
  gap: 0 8px;
  background: color-mix(in srgb, var(--chart-bg) 88%, transparent);
  width: fit-content;
  max-width: calc(100% - 8px);
  padding: 2px 5px 2px 0;
}

/* ==========================================================================
   Reusable Chart Overlay Card Component (ChartOverlayCard)
   Anchored consistently at top-right (left of 64px right price scale) so
   clicking across the 3 stock buttons keeps buttons right under the cursor.
   ========================================================================== */
.dd-chart-overlay-card {
  position: absolute;
  top: 58px;
  right: 124px;
  z-index: 4;
  width: min(356px, calc(100% - 136px));
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line);
  border-top: 2px solid var(--ink);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.dd-chart-overlay-card[hidden] {
  display: none;
}
.dd-chart-overlay-card.is-top-left {
  right: auto;
  left: 10px;
}
.dd-ov-body {
  position: relative;
  padding: 7px 28px 7px 10px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-flip {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--chart-bg);
  color: var(--ink-soft);
  font: 13px/1 var(--mono);
  justify-content: center;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-flip:hover {
  border-color: var(--ink-soft);
  background: var(--chart-bg);
  color: var(--ink);
}
.dd-ov-bullets {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dd-ov-bullets li {
  font-size: 13px;
  line-height: 1.42;
  color: var(--ink-soft);
}
.dd-ov-lead {
  color: var(--ink);
}
.dd-ov-title {
  font: 700 14px/1.25 var(--serif);
  color: var(--ink);
  margin-right: 6px;
}
.dd-ov-pct {
  font: 700 13.5px/1.2 var(--mono);
  margin-right: 6px;
}
.dd-ov-mine {
  font: 700 11.5px/1 var(--sans);
  color: var(--mag);
  margin-right: 6px;
}
.dd-ov-idx-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 11.5px/1.1 var(--sans);
  color: var(--muted);
  vertical-align: middle;
}
.dd-ov-idx-hint i {
  display: inline-block;
  width: 12px;
  height: 2px;
  background: #0096A0;
}
.dd-ov-why {
  color: var(--ink-soft);
}
.dd-ov-why-txt {
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-ov-stocks {
  display: grid;
  grid-template-columns: repeat(var(--ov-cols, 3), minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
/* More than four (a topic's constituents): one row that scrolls sideways instead of squeezing the names. */
.dd-ov-stocks.is-scroll {
  position: relative;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  overflow-x: auto;
  scrollbar-width: thin;
}
:is(#dailyDesk, #worldModel, #watchDesk) .dd-ov-stocks.is-scroll button.dd-ov-stock-btn {
  min-width: 92px;
  padding: 0 10px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn {
  height: 30px;
  padding: 0 6px;
  border: 0;
  background: var(--chart-bg);
  color: var(--ink);
  font: 600 12.5px/1 var(--sans);
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn:hover:not(.on) {
  background: var(--hover);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn.is-mine:not(.on) .dd-ov-st-name {
  color: var(--mag);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn.on {
  background: var(--ink);
  color: var(--chart-bg);
  box-shadow: inset 0 -2px 0 var(--mag);
}
.dd-ov-st-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-ov-star {
  font-style: normal;
  color: var(--mag);
  margin-right: 2px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn.on .dd-ov-star {
  color: var(--chart-bg);
}
.dd-ov-st-pct {
  font-style: normal;
  font: 700 11.5px/1 var(--mono);
  flex: none;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-stock-btn.on .dd-ov-st-pct {
  color: var(--chart-bg);
  opacity: 0.92;
}

/* ==========================================================================
   Unified Stage Across Modes 1, 2 & 3:
   Top Full-Width Interactive K-line (~62%) + Bottom 2-Column Decision Deck (~38%)
   ========================================================================== */
.dd-detail-stage {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}
.dd-detail-top {
  flex: var(--dd-chart-grow, 0.62) 1 0%;
  min-height: 240px;
  min-width: 0;
  display: flex;
  background: var(--chart-bg);
}
.dd-deck-grip {
  flex: none;
  height: 5px;
  margin: -2px 0;
  position: relative;
  z-index: 3;
  cursor: row-resize;
  border-top: 1px solid var(--line);
  background: transparent;
}
.dd-deck-grip:hover {
  border-top-color: var(--sea);
  background: color-mix(in srgb, var(--sea) 14%, transparent);
}
.dd-detail-deck {
  flex: var(--dd-deck-grow, 0.38) 1 0%;
  min-height: 196px;
  min-width: 0;
  display: grid;
  /* 基本面底座 on the left, the card (盯 / 内参 / 主线) on the right; each column keeps its own width. */
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.28fr);
  background: var(--paper);
  overflow: hidden;
}
.dd-deck-left {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.dd-deck-left > .dd-stream-card,
.dd-deck-left > .dd-brief-card {
  flex: 1 0 auto;
}
.dd-deck-left > .dd-stream-card > .dd-step-block.is-act,
.dd-deck-left > .dd-stream-card > .dd-step-block.is-exec {
  margin-top: auto;
}
.dd-deck-left .dd-step-block {
  padding: 7px 12px;
  gap: 5px;
}
.dd-deck-left .dd-kv-list {
  gap: 4px;
  padding-top: 2px;
}
.dd-deck-left .dd-kv-v {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dd-deck-right {
  order: -1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--chart-bg);
  display: flex;
  flex-direction: column;
}
.dd-deck-right .dd-fund-panel {
  border-top: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.dd-deck-right .dd-fund-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1;
}
.dd-deck-right .dd-fund-cell {
  justify-content: center;
  padding: 7px 12px;
}
.dd-title-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 10px;
  min-width: 0;
}

/* Cards & Gate Brief Inner-Reference Card */
.dd-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dd-brief-card {
  width: 100%;
  min-height: 0;
  padding: 10px 14px 8px;
  justify-content: space-between;
  border-top: 2px solid var(--mustard);
}
.dd-brief-head {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 10px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 7px;
}
.dd-brief-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  flex: 1 1 200px;
  min-width: 0;
}
.dd-kicker {
  font: 600 12px/1.25 var(--sans);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.dd-brief-top-act {
  flex: none;
  display: flex;
  align-items: center;
}
.dd-headline {
  margin: 0;
  font: 700 16.5px/1.32 var(--serif);
  color: var(--ink);
}
.dd-brief-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 2px 4px 0;
}
.dd-thesis-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.54;
  color: var(--ink);
}
.dd-brief-list {
  margin: 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dd-brief-list li {
  font-size: 13px;
  line-height: 1.48;
  color: var(--ink-soft);
}
.dd-brief-list li b {
  color: var(--ink);
  font-family: var(--serif);
}
.dd-personal-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 7px 10px;
  background: var(--paper);
  border: 0;
  border-left: 3px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.dd-personal-callout.tone-danger {
  border-left-color: var(--seal);
  background: color-mix(in srgb, var(--seal) 6%, var(--card));
}
.dd-personal-callout.tone-urgent {
  border-left-color: var(--mustard);
  background: color-mix(in srgb, var(--mustard) 7%, var(--card));
}
.dd-personal-callout.tone-pos {
  border-left-color: var(--mag);
  background: color-mix(in srgb, var(--mag) 5%, var(--card));
}
.dd-personal-callout.tone-onboard,
.dd-personal-callout.tone-calm {
  border-left-color: var(--sea);
  background: color-mix(in srgb, var(--sea) 5%, var(--card));
}
.dd-personal-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  flex: 1 1 180px;
  min-width: 0;
}
.dd-callout-tag {
  font: 700 13px/1.3 var(--serif);
  color: var(--ink);
  white-space: nowrap;
}
.dd-personal-callout.tone-danger .dd-callout-tag { color: var(--seal); }
.dd-personal-callout.tone-urgent .dd-callout-tag { color: var(--mustard); }
.dd-personal-callout.tone-pos .dd-callout-tag { color: var(--mag); }
.dd-personal-callout.tone-onboard .dd-callout-tag,
.dd-personal-callout.tone-calm .dd-callout-tag { color: var(--sea); }
.dd-personal-text {
  color: var(--ink-soft);
}
.dd-rule-strip {
  padding: 6px 10px;
  background: var(--paper);
  border: 0;
  border-left: 3px solid var(--mustard);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.dd-rule-strip b {
  font-family: var(--serif);
  color: var(--mustard);
}
.dd-brief-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}
.dd-brief-foot-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-report-link {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sea);
  font: 700 13px/1.3 var(--serif);
  text-decoration: underline;
  text-underline-offset: 3px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-report-link:hover {
  color: var(--ink);
  background: transparent;
}
.dd-report-ext {
  font-size: 12.5px;
  color: var(--ink-soft);
  text-decoration: none;
}
.dd-report-ext:hover {
  color: var(--sea);
  text-decoration: underline;
}
.dd-report-drawer {
  background: var(--chart-bg);
  border: 1px solid var(--line);
  padding: 10px 14px;
}
.dd-report-drawer[hidden] {
  display: none;
}
.dd-report-drawer h2 {
  font: 700 15px/1.4 var(--serif);
  margin: 10px 0 5px;
  color: var(--ink);
}
.dd-report-drawer h2:first-child {
  margin-top: 0;
}
.dd-report-drawer p,
.dd-report-drawer li {
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink);
  max-width: 72ch;
}
.dd-report-drawer ul,
.dd-report-drawer ol {
  margin: 5px 0;
  padding-left: 1.4em;
}
.dd-report-drawer blockquote {
  margin: 6px 0 10px;
  padding: 6px 12px;
  background: var(--paper-warm);
  border-left: 3px solid var(--ink);
}
.dd-report-drawer hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 10px 0;
}

/* Gate Pulse Card (Bottom-Right when viewing 闸门) */
.dd-gate-pulse-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  justify-content: space-between;
}
.dd-breadth-bar {
  display: inline-flex;
  width: 64px;
  height: 7px;
  background: var(--down);
  border: 1px solid var(--line);
  overflow: hidden;
}
.dd-breadth-bar.is-wide {
  display: flex;
  width: 100%;
  height: 8px;
}
.dd-breadth-bar .up {
  background: var(--up);
  height: 100%;
}
.dd-breadth-bar .flat {
  background: var(--rule);
  height: 100%;
}
.dd-gate-bm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.dd-gate-bm-cell {
  background: var(--chart-bg);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dd-gate-sec-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}
.dd-gate-sec-summary > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.dd-sec-mini-chip {
  font: 600 13px/1.25 var(--sans);
  color: var(--ink-soft);
}
.dd-sec-mini-chip b {
  font-family: var(--mono);
}

/* Core Fundamental Data Table (2x4 8-Cell Deterministic Grid in Bottom-Right) */
.dd-fund-host {
  flex: none;
}
.dd-fund-panel {
  flex: none;
  border-top: 1px solid var(--line);
  background: var(--chart-bg);
  font-variant-numeric: tabular-nums;
}
.dd-fund-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.dd-fund-title {
  font: 700 13px/1.25 var(--serif);
  color: var(--ink);
  white-space: nowrap;
}
.dd-fund-sub {
  font: 12px/1.25 var(--mono);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-fund-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
}
.dd-fund-cell {
  background: var(--chart-bg);
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.dd-fund-k {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-fund-v {
  font: 700 14.5px/1.28 var(--mono);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-fund-v.is-text {
  font-family: var(--sans);
  font-size: 14px;
}
.dd-fund-v em {
  font-style: normal;
  font-weight: 500;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* Operational & Decision Cards in Bottom-Left */
.dd-stream-card {
  gap: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
}
.dd-stock-insight-card {
  border-top: 2px solid var(--ink);
}
.dd-stock-insight-card.is-lag-camp {
  border-top-color: var(--down);
}
.dd-stream-card.is-position {
  border-top: 2px solid var(--mag);
}
.dd-stream-card.is-urgent {
  border-color: var(--mustard);
  border-top: 2px solid var(--mustard);
}
.dd-stream-card.is-danger {
  border-color: var(--seal);
  border-top: 2px solid var(--seal);
}
.dd-stream-card.is-topic {
  border-top: 2px solid var(--sea);
}
.dd-stream-card.is-topic.is-danger {
  border-color: var(--seal);
  border-top: 2px solid var(--seal);
}

.dd-step-block {
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dd-step-block + .dd-step-block {
  border-top: 1px solid var(--rule);
}
.dd-step-block.is-danger-level {
  background: color-mix(in srgb, var(--seal) 5%, var(--card));
}
.dd-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
}
.dd-step-num {
  font: 700 12.5px/1.25 var(--serif);
  color: var(--ink-soft);
}
.dd-step-since {
  margin-left: auto;
}
.dd-step-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
/* Borderless Tactical State Mark ("● 跑赢行业 +4.89%") — never wears a 1px button box */
.dd-state-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 700 12.5px/1.2 var(--sans);
  color: var(--ink-soft);
  white-space: nowrap;
}
.dd-state-mark::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  flex: none;
}
.dd-state-mark.tone-pos { color: var(--mag); }
.dd-state-mark.tone-danger { color: var(--seal); }
.dd-state-mark.tone-urgent,
.dd-state-mark.tone-warn { color: var(--mustard); }
.dd-state-mark.tone-good,
.dd-state-mark.tone-calm { color: var(--sea); }

/* Scannable Key-Value Pairs */
.dd-kv-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}
.dd-kv-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.44;
}
.dd-kv-k {
  font: 700 12.5px/1.3 var(--serif);
  color: var(--ink);
  white-space: nowrap;
}
.dd-kv-row.is-div .dd-kv-k {
  color: var(--mustard);
}
.dd-kv-v {
  color: var(--ink-soft);
}

/* Scan-First 3-Column Battle Checkpoints Grid */
.dd-cp-grid {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}
.dd-cp-row {
  display: grid;
  grid-template-columns: 52px minmax(114px, 144px) minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 5px 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.38;
  font-variant-numeric: tabular-nums;
}
.dd-cp-row[data-sym] {
  cursor: pointer;
}
.dd-cp-row[data-sym]:hover {
  background: var(--hover);
}
.dd-cp-row.is-sym-active {
  background: var(--sel);
}
.dd-cp-row.tone-danger {
  background: color-mix(in srgb, var(--seal) 6%, var(--card));
}
.dd-cp-badge {
  font: 700 12px/1.2 var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.dd-cp-row.tone-danger .dd-cp-badge { color: var(--seal); }
.dd-cp-row.tone-urgent .dd-cp-badge { color: var(--sea); }
.dd-cp-row.tone-warn .dd-cp-badge { color: var(--mustard); }
.dd-cp-row.tone-good .dd-cp-badge { color: var(--ink); }
.dd-cp-subj {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-cp-line {
  color: var(--ink-soft);
  font-family: var(--sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-cp-row.tone-danger .dd-cp-line {
  color: var(--ink);
  font-weight: 500;
}

/* Dual-Column Trigger / Stop Levels */
.dd-dual-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dd-dual-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Read-only Condition Value: 2px left rule on paper (never a 4-sided white input box) */
.dd-step-val {
  font: 700 13.5px/1.36 var(--mono);
  color: var(--ink);
  padding: 5px 10px;
  background: var(--paper);
  border: 0;
  border-left: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.dd-step-block.is-danger-level .dd-step-val,
.dd-dual-col.is-danger-col .dd-step-val,
.dd-step-val.is-danger-val {
  border-left-color: var(--seal);
  background: color-mix(in srgb, var(--seal) 5%, var(--paper));
}
.dd-dist-pill {
  font: 700 12px/1 var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dd-dist-pill.is-trig {
  color: var(--mustard);
}
.dd-dist-pill.is-safe {
  color: var(--ink-soft);
}
.dd-dist-pill.is-danger {
  color: var(--seal);
}

.dd-topic-callout {
  padding: 6px 10px;
  background: var(--paper);
  border: 0;
  border-left: 3px solid var(--sea);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.dd-topic-callout.dd-event-callout {
  border-left-color: var(--ink-soft);
}
/* Its own line under the topic's finding: the two stops this card and the topic guard at. */
.dd-topic-stop-note {
  flex-basis: 100%;
  color: var(--mustard);
  font-size: 12px;
}

.dd-enter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 8px;
  background: var(--paper);
  border-left: 2px solid var(--mag);
  font-size: 12.5px;
}
.dd-enter-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
}
.dd-enter-field input {
  width: 84px;
  height: 27px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--chart-bg);
  font: 13px var(--mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dd-enter-field input:focus {
  outline: none;
  border-color: var(--sea);
}

.dd-step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dd-exec-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}
.dd-exec-bar .dd-enter-form {
  flex: 1 1 auto;
  padding: 4px 8px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-exec-ask {
  height: 28px;
  padding: 0 11px;
  margin-left: auto;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-step-ask {
  justify-content: center;
  width: 100%;
  height: 30px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-step-ask-inline {
  margin-left: auto;
}

/* Semantic Text & Directional Colors */
.dd-code {
  font: 12px/1 var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dd-up {
  color: var(--up);
}
.dd-down {
  color: var(--down);
}

/* ==========================================================================
   Right 3-Section List Column (.dd-side.bcol) — Taller Rows & Larger Font Scale
   ========================================================================== */
.dd-side .bhead {
  align-items: center;
  padding: 5px 10px;
  font-size: 13px;
  cursor: default;
}
.dd-brief-bhead {
  gap: 6px;
}
.dd-brief-bhead .dd-fresh {
  margin-left: 6px;
  font: 400 11.5px/1 var(--mono);
  font-style: normal;
  color: var(--muted);
}
.dd-slot-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn {
  height: 22px;
  padding: 0 8px;
  font: 600 12px/1 var(--sans);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn + button.dd-slot-btn {
  margin-left: -1px;
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn.on {
  position: relative;
  z-index: 2;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--chart-bg);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn:disabled,
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn.is-pending {
  opacity: 0.42;
  color: var(--muted);
  background: var(--panel);
  cursor: not-allowed;
}
.dd-bhead-sub {
  font: 12px/1 var(--mono);
  color: var(--muted);
}
:is(#dailyDesk, #worldModel, #watchDesk) button.dd-bhead-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--chart-bg);
}
.dd-side .bpanel .rows.dd-rows li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 76px 60px 66px;
  align-items: center;
  gap: 5px;
  padding: 6.5px 8px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  line-height: 1.35;
}
.dd-side .bpanel .rows.dd-rows li.head {
  cursor: default;
  padding: 4px 8px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
/* Keep the held name readable even at the sidebar's 280px minimum width. */
.dd-side .bpanel[data-sec="holdings"] .rows.dd-rows li {
  grid-template-columns: 14px minmax(0, 1fr) minmax(48px, 64px) 54px 58px;
}
.dd-side .bpanel .rows.dd-rows li.head span:nth-child(n+4) {
  text-align: right;
}
.dd-side .bpanel .rows.dd-rows li.empty {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  cursor: default;
}
.dd-side .bpanel .rows.dd-rows li.dd-quiet-li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12.5px;
}
.dd-side .bpanel .rows.dd-rows li.dd-quiet-li:hover {
  background: var(--hover);
  color: var(--ink);
}
.dd-row-name {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The ★ sits in a fixed slot before the number, so every title starts on the same edge. */
.dd-side .bpanel .rows.dd-brief-rows li {
  grid-template-columns: 30px minmax(0, 1fr) 76px 60px 66px;
}
.dd-row-star {
  display: inline-block;
  width: 12px;
  font-style: normal;
  color: var(--mag);
  font-size: 12px;
}
.dd-side .bpanel .rows.dd-rows li.on .dd-row-star {
  color: var(--mag);
}
.dd-row-tag {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-row-tag.is-danger {
  color: var(--ink); /* not --seal: red reads as 涨 beside the pct column */
  font-weight: 700;
}
.dd-row-tag.is-urgent,
.dd-row-tag.tone-mustard {
  color: var(--mustard);
  font-weight: 600;
}
.dd-row-tag.is-pos {
  color: var(--mag);
  font-weight: 600;
}
.dd-row-tag.is-topic {
  color: var(--sea);
}
.dd-row-sub {
  font: 12.5px/1 var(--mono);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-row-act {
  font: 700 12px/1.2 var(--sans);
  color: var(--sea);
}
.dd-row-act:hover {
  text-decoration: underline;
}
.dd-row-act.is-watched {
  color: var(--mag);
  font-weight: 600;
}

/* Legacy 1D Price Range Ruler (fallback export) */
.dd-ruler {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 6px 10px 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.dd-ruler-labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font: 11.5px/1.2 var(--mono);
  color: var(--ink-soft);
}
.dd-ruler-track {
  position: relative;
  height: 6px;
  background: var(--rule);
  border: 1px solid var(--line);
}
.dd-ruler-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--sel);
}
.dd-ruler-cost {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--mag);
  transform: translateX(-50%);
}
.dd-ruler-now {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--ink);
  border: 1px solid var(--chart-bg);
  transform: translate(-50%, -50%);
}
.dd-ruler-now.is-trig { background: var(--mustard); }
.dd-ruler-now.is-danger { background: var(--seal); }

/* ==========================================================================
   Container Queries (When #chat assistant drawer narrows .dd-stage or on tablet)
   ========================================================================== */
@container (max-width: 680px) {
  .dd-stage-main {
    overflow-y: auto;
    overflow-x: hidden;
  }
  .dd-detail-stage {
    height: auto;
    overflow: visible;
  }
  .dd-detail-top {
    min-height: 316px;
    height: auto;
    overflow: hidden;
    flex: none;
    border-bottom: 1px solid var(--line);
  }
  .dd-deck-grip {
    display: none;
  }
  .dd-detail-deck {
    display: flex;
    flex-direction: column;
    height: auto;
    flex: none;
    overflow: visible;
  }
  .dd-deck-left {
    border-left: 0;
    border-bottom: 1px solid var(--line);
    overflow-y: visible;
    padding: 8px 10px 12px;
  }
  .dd-deck-right {
    order: 0;
    overflow-y: visible;
  }
  .dd-brief-scroll {
    flex: none;
    overflow-y: visible;
  }
  .dd-chart-overlay-card {
    top: 56px;
    right: 72px;
    width: min(320px, calc(100% - 80px));
  }
}

@container (max-width: 540px) {
  .dd-fund-grid,
  .dd-gate-bm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dd-dual-levels {
    grid-template-columns: 1fr;
  }
  .dd-cp-row {
    grid-template-columns: 52px minmax(0, 1fr);
    row-gap: 2px;
  }
  .dd-cp-line {
    grid-column: 1 / -1;
    white-space: normal;
  }
  :is(#dailyDesk, #worldModel, #watchDesk) button.dd-step-ask-inline,
  :is(#dailyDesk, #worldModel, #watchDesk) button.dd-exec-ask {
    margin-left: 0;
  }
  .dd-detail-top {
    min-height: 360px;
  }
  .dd-chart-overlay-card,
  .dd-chart-overlay-card.is-top-left {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    background: var(--card);
  }
  :is(#dailyDesk, #worldModel, #watchDesk) button.dd-ov-flip {
    display: none;
  }
}

/* ==========================================================================
   Mobile & Narrow Viewport (< 880px): Stacked Stage + Bottom 3-Section List
   ========================================================================== */
@media (max-width: 880px) {
  :is(#dailyDesk, #worldModel, #watchDesk) {
    overflow-y: auto;
    overflow-x: hidden;
  }
  .dd-layout {
    flex-direction: column;
    height: auto;
  }
  .dd-stage,
  .dd-stage-main {
    overflow: visible;
    height: auto;
  }
  .dd-side {
    width: 100% !important;
    border-left: 0;
    border-top: 2px solid var(--line);
  }
  .dd-side .cgrip,
  .dd-side .bgrip {
    display: none;
  }
  .dd-side .bpanel {
    min-height: auto;
    flex: none !important;
  }
  .dd-side .bpanel .rows {
    max-height: 220px;
  }
  :is(#dailyDesk, #worldModel, #watchDesk) button.dd-slot-btn {
    height: 25px;
    padding: 0 8px;
  }
  :is(#dailyDesk, #worldModel, #watchDesk) button:not([data-feedback-key]):not(.dd-report-link):not(.dd-tf-btn):not(.dd-zoom-btn):not(.dd-qtab):not(.dd-chart-act):not(.dd-slot-btn):not(.dd-ov-stock-btn):not(.dd-ov-flip):not(.wd-back):not(.chart-watch-label) {
    min-height: 30px;
    padding: 0 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dd-radar-dot.is-live,
  .dd-radar-pill.has-urgent .dd-radar-dot {
    animation: none;
  }
}

/* 盯住 (#watchDesk, public/app/watch-desk.mjs): 今日's layout with its own list head and the quieter steps on a row. */
.wd-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.wd-title {
  margin-right: auto;
  font-size: 14px;
  color: var(--ink);
}
.wd-title i {
  font: normal 12px var(--mono);
  color: var(--muted);
}
#watchDesk .wd-tools button {
  height: 26px;
  padding: 0 9px;
  font-size: 12.5px;
}
.wd-unseen {
  font: 600 11.5px var(--mono);
  color: var(--mag);
}
#watchDesk button.wd-back,
#watchDesk .wd-tools .wd-close {
  display: none;
}
#watchDesk .wd-status-note:empty { display: none; }
#watchDesk .wd-status-note:not(:empty) { padding: 4px 12px; border-bottom: 1px solid var(--line); }
@media (max-width: 720px) {
  #watchDesk .dd-chart-toolbar .wd-back { flex: none; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; }
}
.dd-bhead-sub.is-urgent {
  color: var(--mag);
}
.dd-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
/* 要重看: 重看 under the sentence, everything else folded under one quiet line (P110). */
.dd-step-block.is-summary > .dd-exec-bar {
  margin-top: 8px;
}
.dd-review-more > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.dd-review-more[open] > summary {
  margin-bottom: 6px;
}
/* Quieter than the card's own buttons: still keys (a 1px border), in ink, not sea. */
:is(#dailyDesk, #watchDesk) .dd-manage button.dd-link-btn {
  height: 22px;
  padding: 0 7px;
  color: var(--ink-soft);
}
.dd-sell-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--paper);
  border-left: 2px solid var(--mag);
  font-size: 12.5px;
}
.dd-sell-form[hidden],
.dd-sell-form [hidden] {
  display: none;
}
.dd-sell-part {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-soft);
}
.dd-enter-field select {
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--chart-bg);
  color: var(--ink);
  font-size: 12.5px;
}
.wd-ended-rows li.dd-quiet-li {
  color: var(--muted);
}
/* An ended row has no fundamentals beside its card: the card takes the deck's width. */
#watchDesk .dd-detail-stage[data-mode="ended"] .dd-detail-deck {
  grid-template-columns: minmax(0, 1fr);
}
/* 已结束 takes the height of its rows (folded: one line), not a share of the column. */
#watchDesk .dd-side .bpanel[data-sec="ended"] {
  flex: none !important;
}
#watchDesk .dd-side .bpanel .rows.wd-ended-rows {
  max-height: 32vh;
}

/* A phone: the list first; a row opens its stage (← back). */
@media (max-width: 720px) {
  #watchDesk .wd-layout.is-list .dd-stage,
  #watchDesk .wd-layout.is-stage .dd-side {
    display: none;
  }
  #watchDesk .wd-layout.is-list .dd-side {
    border-top: 0;
  }
  #watchDesk .wd-layout.is-list .dd-side .bpanel .rows {
    max-height: none;
  }
  #watchDesk button.wd-back,
  #watchDesk .wd-tools .wd-close {
    display: inline-flex;
    align-items: center;
  }
  #watchDesk .wd-layout.is-stage .dd-command-controls button[data-a="back-chart"] {
    display: none;
  }
}

/* Built-in Native Market Cloud Map (大盘云图, #cloudmap):
   Restores the classic 有图 (warm-paper) 2-column Cloud Map layout & continuous low-glare palette,
   scoped strictly inside #charts so #cols (板块), #strat (策略), and #chat (幕僚) stay uncovered.
   Follows docs/design.md: 1px square borders, no shadows, palette.css tokens, tabular numerals. */
#cloudmap {
  position: absolute;
  inset: 0;
  z-index: 6;
  container-type: inline-size;
  display: flex;
  flex-direction: row;
  background: var(--chart-bg);
  color: var(--ink);
  caret-color: var(--mag);
  scrollbar-color: var(--line) var(--card);
  overflow: hidden;
}
#cloudmap[hidden],
#cloudmap [hidden] {
  display: none !important;
}
#cloudmap ::selection {
  background: var(--select);
  color: var(--ink);
}
#cloudmap :is(button, input, select, a):focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: -2px;
}

/* Active state for #cloudMapBtn is unified in ui.css (#bar button[aria-pressed="true"]) */
body.cloudmap-mode #bar #periods button.on {
  background: #fff;
  color: var(--ink-soft);
}
body.cloudmap-mode #bar :is(#adj, #layoutBtn, #factorBtn, #formulaBtn, #note, #eventControls) {
  display: none;
}
@media (max-width: 720px) {
  body.cloudmap-mode #bar #periods {
    display: none;
  }
}

/* Base Buttons inside #cloudmap */
#cloudmap button {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 12px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
#cloudmap button:hover:not(:disabled) {
  border-color: var(--ink-soft);
  background: var(--paper);
}
#cloudmap button.on,
#cloudmap button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
#cloudmap button.sea {
  border-color: var(--sea);
  color: var(--sea);
  background: #fff;
}
#cloudmap button.sea:hover:not(:disabled) {
  background: var(--paper);
}

/* Right Control Rail (152px 有图 左图右栏 composition) */
.cm-rail {
  width: 152px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border-left: 1px solid var(--line);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.cm-rail-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 9px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.cm-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cm-grid-icon {
  flex: none;
  color: var(--ink);
}
.cm-title {
  margin: 0;
  font: 700 14px/1 var(--serif);
  color: var(--ink);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
#cloudmap button.cm-drawer-close {
  display: none;
  width: 24px;
  height: 24px;
  padding: 0;
}

.cm-rail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cm-asof-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.cm-asof-box span {
  flex: none;
}
.cm-asof-box b {
  font: 600 10px/1 var(--mono);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* How the futures map measures and what is not trading yet: one quiet line under the time */
.cm-basis {
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}

/* Market Scope List */
.cm-scopes {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#cloudmap button.cm-scope-btn {
  width: 100%;
  height: 27px;
  padding: 0 7px;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-soft);
}
#cloudmap button.cm-scope-btn:hover {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}
#cloudmap button.cm-scope-btn.on {
  background: var(--sel);
  border-color: var(--sea);
  color: var(--ink);
  font-weight: 600;
}
#cloudmap button.cm-scope-btn.mag-filter .cm-scope-name {
  color: var(--mag);
}
#cloudmap button.cm-scope-btn.mag-filter.on {
  background: rgba(213, 21, 98, 0.08);
  border-color: var(--mag);
  color: var(--ink);
}
.cm-scope-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-scope-pct {
  font: 600 11px/1 var(--mono);
  flex: none;
}

/* Filter Groups */
.cm-group {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}
.cm-group-head b {
  color: var(--ink);
  font-weight: 600;
}
#cloudmap button.cm-zoom-out {
  height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  border-color: var(--sea);
  color: var(--sea);
  background: #fff;
}
.cm-select {
  width: 100%;
  height: 26px;
  padding: 0 4px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 600 11.5px/1 var(--sans);
  outline: none;
}
.cm-select:hover {
  border-color: var(--ink-soft);
}

.cm-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}
.cm-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}
.cm-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}
#cloudmap :is(.cm-grid-2, .cm-grid-3, .cm-grid-4) button {
  height: 25px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  border-color: var(--line);
}
#cloudmap :is(.cm-grid-2, .cm-grid-3, .cm-grid-4) button.on {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

/* Search Box */
.cm-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.cm-search {
  width: 100%;
  height: 26px;
  padding: 0 20px 0 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 11.5px/1 var(--sans);
}
.cm-search::placeholder {
  color: var(--muted);
}
#cloudmap button.cm-search-clear {
  position: absolute;
  right: 1px;
  top: 1px;
  height: 24px;
  width: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

/* Breadth Card */
.cm-breadth-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--rule);
  background: var(--panel);
  text-align: center;
}
.cm-b-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.cm-b-col span {
  font-size: 10px;
  color: var(--muted);
}
.cm-b-col b {
  font: 700 13px/1 var(--mono);
  color: var(--ink);
}

.cm-up { color: var(--up) !important; }
.cm-down { color: var(--down) !important; }
.cm-flat { color: var(--muted); }

/* Rail Footer Utility Buttons */
.cm-rail-foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
}
#cloudmap button.cm-util-btn {
  width: 100%;
  height: 25px;
  justify-content: flex-start;
  padding: 0 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
#cloudmap button.cm-util-btn:hover {
  color: var(--ink);
}

/* Right Main Column */
.cm-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--chart-bg);
}

.cm-mobile-bar {
  display: none;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.cm-mob-grow {
  flex: 1;
}
.cm-mob-focus {
  font: 700 12px/1 var(--serif);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-mob-breadth {
  font: 600 11px/1 var(--mono);
  color: var(--muted);
}

/* Canvas Stage */
.cm-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--chart-bg);
  overflow: hidden;
}
.cm-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}
.cm-canvas.is-zoomed {
  cursor: grab;
}
.cm-canvas.is-dragging {
  cursor: grabbing;
}

.cm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--chart-bg);
  color: var(--ink-soft);
  font-size: 13px;
}

/* Hover Tooltip */
.cm-tip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 7px 10px;
  min-width: 176px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cm-tip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.cm-tip-name {
  font: 700 13px/1.2 var(--sans);
  color: var(--ink);
}
.cm-tip-code {
  font: 11px/1 var(--mono);
  color: var(--muted);
}
.cm-tip-meta {
  font-size: 11px;
  color: var(--ink-soft);
}
.cm-tip-nums {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: 700 12.5px/1.2 var(--mono);
}
.cm-tip-mine {
  font-size: 11px;
  color: var(--mag);
  font-weight: 700;
}
.cm-tip-hint {
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 3px;
  margin-top: 2px;
}

/* Pinned Stock Action Card */
.cm-card {
  position: absolute;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 10px 12px;
  width: min(304px, calc(100% - 20px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cm-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
}
.cm-card-title {
  font: 700 14px/1.25 var(--serif);
  color: var(--ink);
}
.cm-card-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}
#cloudmap button.cm-card-close {
  height: 22px;
  width: 22px;
  padding: 0;
  border-color: var(--rule);
  color: var(--ink-soft);
}
.cm-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--line);
}
.cm-card-m {
  background: #fff;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cm-card-m span {
  font-size: 10.5px;
  color: var(--muted);
}
.cm-card-m b {
  font: 700 12px/1.2 var(--mono);
  color: var(--ink);
}
.cm-card-mine {
  padding: 4px 7px;
  background: #fff;
  border: 1px solid var(--mag);
  color: var(--mag);
  font-size: 11.5px;
  font-weight: 600;
}
.cm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Bottom Bar: [问幕僚] on left + Continuous Smooth Gradient Legend on right */
.cm-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  height: 30px;
  padding: 0 10px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.cm-foot-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#cloudmap button.cm-ask-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
}
#cloudmap button.cm-ask-btn .mark {
  width: 12px;
  height: 12px;
  margin-right: 2px;
}
.cm-foot-hint {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-mine-key {
  color: var(--mag);
  font-weight: 600;
  white-space: nowrap;
}
.cm-mine-key:empty {
  display: none;
}

.cm-grad-wrap {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cm-grad-icon {
  font: 700 11px/1 var(--mono);
}
.cm-grad-bar {
  width: 184px;
  height: 14px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font: 600 9.5px/1 var(--mono);
  color: var(--ink);
}
.cm-grad-bar span:first-child,
.cm-grad-bar span:last-child {
  color: #fff;
}

.cm-backdrop {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: rgba(39, 32, 27, 0.32);
}

/* Container-responsive collapse: when #charts is narrow (<620px on mobile or multi-panel squeeze) */
@container (max-width: 820px) {
  .cm-foot-hint {
    display: none;
  }
}

@container (max-width: 620px) {
  .cm-rail {
    position: absolute;
    right: 0;
    left: auto;
    top: 0;
    bottom: 0;
    width: 208px;
    z-index: 8;
    transform: translateX(102%);
    transition: transform 0.16s ease-out;
  }
  .cm-rail.is-open {
    transform: translateX(0);
  }
  #cloudmap button.cm-drawer-close {
    display: inline-flex;
  }
  .cm-mobile-bar {
    display: flex;
  }
  .cm-mine-key {
    display: none;
  }
  .cm-grad-bar {
    width: 138px;
  }
  .cm-card {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    width: auto;
  }
}

/* 金融世界模型. The 世界 view (#worldModel) wears 今日's layout from daily-desk.css; this file adds only its own pieces
   (line charts, the quadrant, the cards' tables). The standalone page /financial-world-model is a paper surface like
   the report pages (docs/report-style.md), scoped under .wm. palette.css variables only; square, 1px, no shadows;
   red/green only on returns. */
/* Active state for #worldBtn is unified in ui.css (#bar button[aria-pressed="true"]) */
body.world-mode #bar :is(#adj, #layoutBtn, #formulaBtn, #note, #eventControls) { display: none; }
@media (max-width: 720px) { body.world-mode #bar #periods { display: none; } }

.wm { --gap: 14px; --pad: 24px; --cp: 16px; color: var(--ink); font: 13px/20px var(--sans); min-height: 100%;
  background: var(--paper) radial-gradient(circle, var(--dot) 1px, transparent 1.4px) 0 0 / 5px 5px; -webkit-font-smoothing: antialiased; }
.wm *, .wm *::before { box-sizing: border-box; }
.wm button { font: inherit; color: inherit; }
.wm .col { max-width: 1240px; margin: 0 auto; padding: 0 var(--pad); }
.wm .pos { color: var(--up); } .wm .neg { color: var(--down); } .wm .muted { color: var(--ink-soft); }
.wm :is(button, a, [tabindex]):focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }

.wm-bar { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.wm-bar .col { display: flex; align-items: center; gap: 6px 14px; min-height: 52px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.wm-bar::after { content: ""; display: block; width: min(1192px, calc(100% - 2 * var(--pad))); margin: 0 auto; border-top: 2.5px solid var(--mag); box-shadow: 0 3.5px 0 -1.5px color-mix(in srgb, var(--mag) 45%, transparent); }
.wm h1 { font: 900 20px/26px var(--serif); margin: 0; letter-spacing: .02em; }
.wm .meta { color: var(--ink-soft); font: 11px/16px var(--mono); letter-spacing: .04em; }
.wm-name { flex: 1 1 220px; min-width: 0; }
.wm-btn { height: 28px; padding: 0 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 12px; text-decoration: none; display: inline-flex; align-items: center; color: var(--ink); }
.wm-btn:hover { border-color: var(--ink); }
.wm .lead { margin: 14px 0 var(--gap); font: 17px/27px var(--serif); color: var(--ink); }
.wm .lead small { display: block; color: var(--ink-soft); font: 13px/20px var(--sans); margin-top: 2px; }

.wm-card { background: var(--card); border: 1px solid var(--line); padding: 10px var(--cp) var(--cp); min-width: 0; margin-top: var(--gap); }
.wm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.wm-head::after { content: ""; order: 1; flex: 1; min-width: 24px; height: 1px; align-self: center; background-image: linear-gradient(to right, var(--ink-soft) 18%, transparent 0); background-size: 5px 1px; opacity: .45; }
.wm-head > :not(h2) { order: 2; }
.wm h2 { font: 700 15px/22px var(--serif); margin: 0; }
.wm h2 em { font-style: normal; color: var(--ink-soft); font: 11px var(--mono); margin-right: 6px; letter-spacing: .1em; }
.wm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
.wm-note { color: var(--ink-soft); font-size: 12px; line-height: 18px; margin: 8px 0 0; }

/* Pieces in both the view and the paper page. */
/* A tendency is a reading, not a button: coloured text, no box. Red ▲ 多配, green ▼ 少配 (涨跌色), grey · 维持. */
.wm-tend { display: inline; padding: 0; font: 700 12px/18px var(--sans); font-style: normal; color: var(--muted); white-space: nowrap; }
.wm-tend.more { color: var(--up); }
.wm-tend.less { color: var(--down); }
/* 近三月走向: a mark a month (the last is this month), then its phrase. In the 世界焦点 list it takes the wider column. */
.wm-path { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 1px; white-space: nowrap; }
.wm-path .wm-tend { width: 11px; text-align: center; font-size: 11px; }
.wm-path > span { margin-left: 5px; font-size: 12px; color: var(--ink-soft); }
.wm-nows .wm-path { margin-left: auto; }
#worldModel .dd-side .bpanel .rows.dd-rows.wm-rows-focus li { grid-template-columns: 20px minmax(0, 1fr) 58px 104px 52px; }
#worldModel .dd-side .bpanel .rows.wm-rows-focus li.wm-focus-overview {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wm-focus-overview .dd-row-name { font-weight: 700; }
.wm-focus-overview-label { color: var(--muted); font-size: 12px; }
.wm-focus-asof { color: var(--muted); font: 11px/18px var(--mono); font-weight: 400; }
@media (max-width: 360px) {
  #worldModel .dd-side .bpanel .rows.dd-rows.wm-rows-focus li { grid-template-columns: 20px minmax(0, 1fr) 58px 104px; }
  #worldModel .wm-rows-focus li:not(.wm-focus-overview) > :last-child { display: none; }
}
@media (pointer: coarse) {
  #worldModel .wm-rows-focus li[data-sec] { min-height: 44px; box-sizing: border-box; }
}
.wm-tends { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.wm-tends li { display: inline-flex; gap: 6px; align-items: baseline; }
.wm-tends b { font: 700 13px var(--serif); }
/* The four seasons: two dashed axes, a circle per season in its own ink, the ETFs under it. */
.wm-quad { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px 0; padding: 22px 50px; min-height: 250px; }
.wm-quad::before, .wm-quad::after { content: ""; position: absolute; pointer-events: none; }
.wm-quad::before { left: 50%; top: 20px; bottom: 20px; border-left: 1px dashed var(--line); }
.wm-quad::after { top: 50%; left: 46px; right: 46px; border-top: 1px dashed var(--line); }
.wm-quad .ax { position: absolute; z-index: 1; color: var(--ink-soft); font: 700 12px/16px var(--sans); white-space: nowrap; background: var(--card); padding: 0 3px; }
.wm-quad .ax.t { top: 0; left: 50%; transform: translateX(-50%); }
.wm-quad .ax.b { bottom: 0; left: 50%; transform: translateX(-50%); }
.wm-quad .ax.l { left: 0; top: 50%; transform: translateY(-50%); }
.wm-quad .ax.r { right: 0; top: 50%; transform: translateY(-50%); }
.wm-q { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.wm-q .ring { width: 92px; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--q); background: color-mix(in srgb, var(--q) 9%, var(--card)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center; }
.wm-q .ring b { font: 700 13.5px/18px var(--serif); color: color-mix(in srgb, var(--q) 78%, var(--ink)); white-space: nowrap; }
.wm-q .ring b .wm-tend { margin-left: 2px; font-size: 11px; }
.wm-q .ring small { font: 11px/15px var(--sans); color: color-mix(in srgb, var(--q) 70%, var(--ink-soft)); }
.wm-q p { margin: 0; max-width: 100%; word-break: keep-all; font: 11.5px/16px var(--sans); color: var(--ink-soft); text-align: center; }
.wm-qkey { display: flex; justify-content: center; gap: 14px; margin: 2px 0 0; }
.wm-qkey .wm-tend { font-weight: 400; font-size: 11.5px; }
/* The classes and their last three months, on the 这三个月 card; a click opens the class's row. */
.wm-nows { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.wm-nows li { padding: 6px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.wm-nows li:hover b { text-decoration: underline; }
.wm-nows li > div { display: flex; align-items: baseline; gap: 8px; }
.wm-nows b { font: 700 13.5px var(--serif); }
.wm-nows .num { margin-left: auto; font: 12px var(--mono); }
.wm-nows p { margin: 2px 0 0; font-size: 13px; line-height: 19px; color: var(--ink-soft); }
.wm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); border: 1px solid var(--line); background: var(--card); }
.wm-kpis > div { padding: 8px 12px 9px; border-left: 1px dashed var(--line); display: flex; flex-direction: column; gap: 2px; }
.wm-kpis > div:first-child { border-left: 0; }
.wm-kpis span { color: var(--ink-soft); font: 11.5px/16px var(--sans); }
.wm-kpis b { font: 700 20px/26px var(--num, var(--mono)); font-variant-numeric: lining-nums tabular-nums; }
.wm-lg { display: inline-flex; flex-wrap: wrap; gap: 0 14px; font: 11.5px/16px var(--mono); color: var(--ink-soft); }
.wm-lg i { display: inline-block; width: 12px; height: 0; border-top: 2px solid; margin-right: 5px; vertical-align: 3px; }
.wm-lg i.dash { border-top-style: dashed; }
.wm-lg i.area { height: 8px; border: 0; vertical-align: 0; background: color-mix(in srgb, var(--down) 30%, transparent); }
.wm-plot, .wm-chart { position: relative; touch-action: pan-y; min-width: 0; }
:is(.wm-plot, .wm-chart) svg { display: block; width: 100%; height: 100%; }
:is(.wm-plot, .wm-chart) text { font: 11px var(--mono); fill: var(--ink-soft); }
:is(.wm-plot, .wm-chart) text.band { fill: var(--ink-soft); font: 600 11.5px var(--sans); }
:is(.wm-plot, .wm-chart) .end text { font: 600 11.5px var(--sans); }
:is(.wm-plot, .wm-chart) .end text.v { font: 600 11.5px var(--mono); }
:is(.wm-plot, .wm-chart) .end text.v.pos { fill: var(--up); } :is(.wm-plot, .wm-chart) .end text.v.neg { fill: var(--down); }
:is(.wm-plot, .wm-chart) line.zero { stroke: var(--line); }
.wm-plot-empty { padding: 24px; color: var(--muted); font-size: 13px; }
.wm-tip { position: absolute; top: 2px; z-index: 2; pointer-events: none; background: var(--card); border: 1px solid var(--line); padding: 3px 8px; font: 11px/16px var(--mono); white-space: nowrap; }
.wm-tip[hidden] { display: none; }
.wm-seg { display: inline-flex; border: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.wm-seg button { border: 0 !important; background: none !important; padding: 0 9px !important; height: 24px !important; min-height: 0 !important; color: var(--ink-soft) !important; cursor: pointer; font-size: 12px; }
.wm-seg button.on { background: var(--ink) !important; color: var(--paper) !important; }
.wm-sym { border: 0 !important; background: none !important; padding: 0 !important; height: auto !important; min-height: 0 !important; cursor: pointer; font: 12px var(--sans); color: var(--ink) !important; text-align: left; }
.wm-sym:hover { color: var(--sea) !important; text-decoration: underline; }
.wm-phase { border-collapse: collapse; width: 100%; }
.wm-phase :is(th, td) { padding: 0 6px; height: 26px; text-align: right; white-space: nowrap; }
.wm-phase td { border-top: 1px solid var(--rule); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.wm-phase th { color: var(--ink-soft); font: 400 11.5px var(--sans); border-bottom: 1px solid var(--line); vertical-align: bottom; }
.wm-phase :is(th, td):first-child { text-align: left; padding-left: 0; }
.wm-phase th small { display: block; font-size: 10.5px; }
.wm-phase td:first-child { font: 12px var(--sans); white-space: normal; }
.wm-phase tr.model td { font-weight: 600; }
.wm-phase tr.model td:first-child { box-shadow: inset 3px 0 0 var(--sea); padding-left: 6px; }

.wm-months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); }
.wm-months > div { padding: 6px 8px; border: 0 solid var(--rule); border-width: 0 0 1px 1px; margin: 0 0 -1px -1px; display: flex; flex-direction: column; gap: 2px; }
.wm-months span { color: var(--ink-soft); font-size: 11.5px; }
.wm-months b { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; }
.wm-months .pos b { color: var(--up); } .wm-months .neg b { color: var(--down); } .wm-months .none b { color: var(--muted); font-weight: 400; }
.wm-notes { margin: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 10px; }
.wm-notes dt { color: var(--ink-soft); font: 600 12px/19px var(--sans); }
.wm-notes dd { margin: 0; font-size: 13px; line-height: 19px; }
.wm-note { color: var(--ink-soft); font-size: 12px; line-height: 18px; margin: 8px 0 0; }
#worldModel .pos { color: var(--up); } #worldModel .neg { color: var(--down); } #worldModel .muted { color: var(--muted); }

/* The 世界 view, inside 今日's layout. */
#worldModel .wm-top { flex-direction: column; min-width: 0; }
#worldModel .wm-top > .wm-plot { flex: 1; min-height: 200px; }
#worldModel .wm-toolbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 12px 2px; font-size: 13px; }
#worldModel .wm-toolbar .meta { color: var(--muted); font: 11.5px var(--mono); }
#worldModel .wm-minis { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); min-height: 0; }
#worldModel .wm-mini { display: flex; flex-direction: column; min-width: 0; min-height: 120px; border: 0 solid var(--line); border-width: 0 0 1px 1px; margin: 0 0 -1px -1px; }
#worldModel .wm-pad { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* The deck's titles read as titles, not captions; the four seasons sit in the middle of whatever room is left. */
#worldModel .dd-detail-deck .dd-kicker { font: 700 14px/20px var(--sans); color: var(--ink-soft); letter-spacing: 0; }
#worldModel .wm-pad:has(> .wm-quad) { flex: 1 0 auto; }
#worldModel .wm-pad > .wm-quad { margin-top: auto; width: 100%; max-width: 620px; align-self: center; }
#worldModel .wm-pad > .wm-qkey { margin-bottom: auto; }
#worldModel .wm-card-x { flex: 1 0 auto; border-top: 2px solid var(--mustard); }
#worldModel .wm-card-x .dd-headline { font-size: 15.5px; }
#worldModel .wm-p { margin: 0; font-size: 13.5px; line-height: 21px; }
#worldModel button.wm-open { align-self: flex-start; color: var(--sea); }
#worldModel .dd-row-tag.wm-t-more { color: var(--up); font-weight: 700; }
#worldModel .dd-row-tag.wm-t-less { color: var(--down); font-weight: 700; }
#worldModel .dd-ov-mine.is-more { color: var(--up); } #worldModel .dd-ov-mine.is-less { color: var(--down); } #worldModel .dd-ov-mine.is-keep { color: var(--muted); }
#worldModel .wm-gap { margin-top: 10px; }
#worldModel .wm-foot { margin: 0; padding: 6px 10px 8px; font-size: 11.5px; line-height: 16px; color: var(--muted); border-top: 1px solid var(--line); }
@media (max-width: 880px) {
  #worldModel .wm-minis { grid-template-rows: none; }
  #worldModel .wm-mini { min-height: 150px; }
  #worldModel .wm-top > .wm-plot { min-height: 260px; }
}
@media (max-width: 520px) {
  #worldModel .wm-minis { grid-template-columns: minmax(0, 1fr); }
  #worldModel .wm-months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The paper page. */
.wm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.wm .wm-kpis { margin-bottom: 12px; }
.wm .wm-chart { height: 300px; margin-top: 6px; }
.wm .wm-chart.ev { height: 220px; }
.wm-scroll { overflow-x: auto; margin-top: 12px; }
.wm-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); margin-top: var(--gap); }
.wm-assets article, .wm-event { border: 1px solid var(--line); background: var(--chart-bg); padding: 10px 12px 12px; min-width: 0; }
.wm-assets h3, .wm-event h3 { font: 700 14px/20px var(--serif); margin: 0 0 4px; }
.wm-assets p { margin: 0 0 8px; }
.wm-events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.wm-event .meta { margin: 2px 0 4px; }
.wm-did { margin: 8px 0; font-size: 13px; line-height: 20px; } .wm-did b { display: block; font: 700 14px/20px var(--serif); }
.wm-event .rule { color: var(--ink-soft); font-size: 11.5px; line-height: 17px; margin: 8px 0 0; }
.wm footer { color: var(--ink-soft); font-size: 12px; margin-top: 28px; border-top: 8px solid var(--ink); padding: 10px 0 40px; }
.wm-state { padding: 40px 0; color: var(--ink-soft); }
.wm-state.err { color: var(--seal); }
@media (max-width: 900px) { .wm-row, .wm-events { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .wm { --pad: 16px; --cp: 12px; } .wm .wm-chart { height: 240px; } .wm .lead { font-size: 16px; line-height: 25px; } }

/* 世界 v3 (docs/inbox/1106.financial-world-model/world-view-charts.md): 今日's chart box in every price slot, the month
   table beside the NAV, an asset's big swings as a list, the events' write-ups. */
#worldModel .wm-slot { flex: 1; min-width: 0; min-height: 0; display: flex; }
#worldModel .wm-slot > .dd-chart-box, #worldModel .wm-mini > .dd-chart-box { min-height: 0; }
#worldModel .wm-mini { display: flex; min-height: 160px; }
#worldModel .wm-mini .dd-chart-canvas { min-height: 120px; }
/* The 这三个月 minis: a line on the whole box. The name and 日线/周线 sit on the chart's top left, the class card on its
   top right; no OHLC legend, no volume, no zoom buttons (the wheel zooms, all four together). */
#worldModel .wm-mini .dd-chart-zooms, #worldModel .wm-mini .dd-ema-btn, #worldModel .wm-mini .dd-chart-quote,
#worldModel .wm-mini .legends, #worldModel .wm-mini .dl { display: none; }
#worldModel .wm-mini .dd-chart-toolbar { position: absolute; z-index: 3; top: 0; left: 0; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; padding: 6px 10px; background: none; border: 0; pointer-events: none; }
#worldModel .wm-mini .dd-chart-toolbar > * { pointer-events: auto; }
#worldModel .wm-mini .dd-chart-meta { flex-wrap: nowrap; }
#worldModel .wm-mini .dd-chart-sym { font-size: 13px; }
#worldModel .wm-mini .dd-chart-canvas { min-height: 0; }
#worldModel .wm-mini .dd-chart-code { font-size: 11px; }
#worldModel .wm-mini .dd-chart-overlay-card { top: 6px; right: 70px; width: max-content; max-width: max(170px, calc(100% - 340px)); }
#worldModel .wm-mini .dd-ov-why { font-size: 11.5px; }
.wm-live { color: var(--mustard); font: 700 12px/18px var(--sans); }
#worldModel .dd-row-tag.wm-t-live { color: var(--mustard); font-weight: 700; }
.wm-mtable { border-collapse: collapse; width: 100%; font: 11.5px/1 var(--mono); font-variant-numeric: tabular-nums; }
.wm-mtable :is(th, td) { padding: 0 3px; height: 24px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.wm-mtable th { color: var(--ink-soft); font: 400 11px var(--mono); border-bottom-color: var(--line); }
.wm-mtable :is(th, td):first-child { text-align: left; padding-left: 0; color: var(--ink-soft); }
.wm-mtable .y { font-weight: 700; border-left: 1px solid var(--line); padding-left: 6px; }
.wm-mtable .b { color: var(--ink-soft); }
.wm-mtable small { color: var(--ink-soft); }
.wm-swings { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
/* A list to scan: the span in its own column on the left, then the title (ink, larger) with its move, the story below (smaller, muted). */
.wm-swings li { border-top: 1px solid var(--rule); }
.wm-swings li:first-child { border-top: 0; }
.wm-swings button, #worldModel .wm-swings button { all: unset; box-sizing: border-box; }
.wm-swings li:not(:has(button)), #worldModel .wm-swings button, .wm-swings button { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; align-items: baseline; width: 100%; padding: 8px 8px 9px; cursor: pointer; }
.wm-swings li:not(:has(button)) { cursor: auto; }
.wm-swings .when { color: var(--muted); font: 12px/20px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wm-swings .t { display: flex; align-items: baseline; gap: 10px; }
.wm-swings b { flex: 1; min-width: 0; font: 700 14.5px/20px var(--sans); color: var(--ink); }
.wm-swings .num { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; }
.wm-swings .num.pos { color: var(--up); } .wm-swings .num.neg { color: var(--down); }
.wm-swings p { margin: 2px 0 0; font-size: 12.5px; line-height: 19px; color: var(--muted); }
.wm-swings li.on { background: color-mix(in srgb, var(--mustard) 12%, transparent); box-shadow: inset 3px 0 0 var(--mustard); }
.wm-swings li.on .when { color: var(--ink); }
#worldModel .wm-swings button:hover:not(:disabled) { background: color-mix(in srgb, var(--mustard) 6%, transparent); } .wm-swings button:hover b { color: var(--sea); }
#worldModel .wm-swings button:focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }
.wm-md { font-size: 13.5px; line-height: 22px; }
.wm-md :is(h2, h3) { font: 700 14.5px/21px var(--serif); margin: 14px 0 4px; }
.wm-md h3 { font-size: 13.5px; color: var(--ink-soft); }
.wm-md > :first-child { margin-top: 0; }
.wm-md p { margin: 0 0 8px; }
.wm-md :is(ul, ol) { margin: 0 0 8px; padding-left: 18px; }
.wm-md li { margin: 2px 0; }
#worldModel .wm-story { padding-bottom: 16px; }
#worldModel .wm-did-x .dd-headline { font-size: 15.5px; margin: 0; }
.wm .wm-events { grid-template-columns: minmax(0, 1fr); }
.wm .wm-event .wm-md { margin: 10px 0; max-width: 760px; }
@media (max-width: 880px) { #worldModel .wm-mini { min-height: 220px; } #worldModel .wm-slot { min-height: 300px; } }
/* A phone follows 今日's phone layout: the card above the chart, full width, so the name and 日线/周线 go back above it. */
@container (max-width: 540px) { #worldModel .wm-mini .dd-chart-toolbar { position: static; } #worldModel .wm-mini .dd-chart-overlay-card { max-width: none; } }
@media (max-width: 520px) { #worldModel .wm-swings button, .wm-swings button, .wm-swings li:not(:has(button)) { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
/* 穿越周期 · 样本策略表现: the returns matrix takes the wider column on the left, the overview the right. */
#worldModel .dd-detail-deck.wm-deck-wide-left { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr); }
#worldModel .wm-deck-wide-left .wm-mtable :is(th, td) { padding: 0 2px; }
#worldModel .wm-deck-wide-left .wm-mtable :is(th, td).y { padding-left: 5px; }
#worldModel .wm-card-x .wm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#worldModel .wm-card-x .wm-kpis > div:nth-child(3) { border-left: 0; }
#worldModel .wm-card-x .wm-kpis > div:nth-child(n+3) { border-top: 1px dashed var(--line); }
#worldModel .wm-card-x .wm-kpis > div { padding: 6px 8px 7px; }
#worldModel .wm-card-x .wm-kpis b { font-size: 17px; line-height: 22px; }
.wm-scroll { overflow-x: auto; }
.wm-atable { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.wm-atable :is(th, td) { padding: 0 6px; height: 26px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.wm-atable th { color: var(--ink-soft); font: 400 11.5px var(--sans); border-bottom-color: var(--line); }
.wm-atable td { font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.wm-atable :is(th, td):first-child { text-align: left; font-family: var(--sans); }
.wm-atable td small { display: block; font: 11px/14px var(--sans); color: var(--muted); }
.wm-atable td:first-child { padding: 3px 0; line-height: 16px; }
.wm-atable td.pos { color: var(--up); } .wm-atable td.neg { color: var(--down); }
.wm-atable tr.me td { font-weight: 700; background: color-mix(in srgb, var(--mustard) 10%, transparent); }
/* Five rows of months, a cell each: the model's tendency, red more, green less, grey as usual. */
.wm-tgrid { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 3px 8px; align-items: center; margin-top: 2px; }
.wm-tgrid .nm { font: 12px/14px var(--sans); color: var(--ink-soft); white-space: nowrap; }
.wm-tgrid .cells { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1px; }
.wm-tgrid .cells i { height: 14px; background: color-mix(in srgb, var(--ink-soft) 14%, transparent); }
.wm-tgrid .cells i.more { background: color-mix(in srgb, var(--up) 75%, transparent); }
.wm-tgrid .cells i.less { background: color-mix(in srgb, var(--down) 75%, transparent); }
.wm-tgrid .cells.yrs i { height: 14px; background: none; font: normal 10.5px/14px var(--mono); color: var(--muted); white-space: nowrap; overflow: visible; }
.wm-tgrid + .wm-qkey .wm-tend.keep { color: color-mix(in srgb, var(--ink-soft) 45%, transparent); }
/* 世界焦点 · a class: the allocation line, then what to watch — each a title, when / how far, what it would mean. */
.wm-alloc { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.wm-alloc > .wm-tend { font: 700 16px/22px var(--sans); }
.wm-watch { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; counter-reset: w; }
.wm-watch li { position: relative; padding: 7px 0 8px 22px; border-top: 1px solid var(--rule); counter-increment: w; }
.wm-watch li:first-child { border-top: 0; }
.wm-watch li::before { content: counter(w); position: absolute; left: 0; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--mustard); color: var(--card); font: 700 11px/16px var(--sans); text-align: center; }
.wm-watch b { font: 700 14px/20px var(--sans); color: var(--ink); margin-right: 8px; }
.wm-watch .when { font: 12.5px/20px var(--sans); color: var(--mustard); }
.wm-watch p { margin: 2px 0 0; font-size: 13px; line-height: 20px; color: var(--ink-soft); }
#worldModel button.wm-open { margin-top: 4px; }
/* The paper page: small headings inside a class and inside 穿越周期. */
.wm h4 { margin: 12px 0 4px; font: 700 12.5px/18px var(--sans); color: var(--ink-soft); }
.wm .wm-card > h3 { font: 700 15px/22px var(--serif); margin: 4px 0 8px; }
.wm .wm-events { margin-top: 14px; }

/* ============================================================================
   signal_chart (有图) Gen 3 Component & Layout Primitives (ui.css)
   Implements:
     1. AppFrame Top Feature & Command Bar (#bar)
     2. Pane-Local Price Chart Toolbar (#chartToolbar — 通达信 style)
     3. 版面 menu (#layoutMenu, from #layoutBtn; dirty layout* actions)
     4. Non-Dimming Stackable Floating Windows (.ui-float-win & modal overrides)
     5. Drag-to-Split Drop Zones & Docked Split Panes
     6. Watchlist Column Board Tabs (.bcol-tabbar)
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. GLOBAL TOP APPFRAME BAR (#bar)
   Always-on product feature showcase + 键盘精灵 command trigger + right dock.
   Never wraps on desktop; never mutates when switching layouts.
   ---------------------------------------------------------------------------- */
#bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 2px;
  height: var(--comp-appbar-h);
  min-height: var(--comp-appbar-h);
  padding: 0 10px;
  background: var(--sys-surface-bar);
  border-bottom: 1px solid var(--sys-border-default);
  font-size: var(--ref-text-sm);
  user-select: none;
  overflow: visible;
}
#bar .ui-nav-start, #bar .ui-nav-end, #bar .ui-nav-links,
#bar .ui-nav-center, #bar .ui-nav-panels, #bar .ui-nav-utility {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  gap: 2px;
}
#bar .ui-nav-end { justify-content: flex-end; }
#bar .ui-nav-center, #bar .ui-nav-panels, #bar .ui-nav-utility { flex: none; }
#bar .ui-nav-links { overflow-x: auto; scrollbar-width: none; }
#bar .ui-nav-links::-webkit-scrollbar { display: none; }
#bar .ui-nav-utility #status { flex: 0 1 auto; max-width: 100px; }
#bar #who { max-width: 120px; overflow: hidden; }
#bar .ui-nav-center button { justify-content: center; }

.ui-brand {
  height: 100%;
  display: inline-flex;
  align-items: center;
  font-family: var(--sans);
  font-weight: 800;
  font-size: var(--ref-text-sm);
  line-height: 1.4;
  color: var(--sys-actor-user);
  letter-spacing: 0.03em;
  padding: 0 6px 0 2px;
  margin-right: 2px;
  white-space: nowrap;
  flex: none;
}

/* 1px Vertical Divider (Law of Common Region) */
.ui-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--sys-border-default);
  margin: 0 5px;
  flex: none;
}

/* Pane-Local Active Symbol & 键盘精灵 Trigger (#chartToolbar #searchBtn) */
#chartToolbar #searchBtn.ui-pane-identity {
  height: var(--comp-ctrl-h-sm);
  padding: 0 7px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
  font-size: var(--ref-text-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex: none;
}
#chartToolbar #searchBtn.ui-pane-identity:hover {
  border-color: var(--sys-actor-agent);
  color: var(--sys-actor-agent);
}
#chartToolbar #searchBtn .pane-code {
  font-family: var(--mono);
  color: var(--sys-text-muted);
  font-weight: 400;
}
#chartToolbar #searchBtn .pane-search-ico {
  font-size: 11px;
  color: var(--sys-text-muted);
}

/* Options Market Bounded Workstation Layout & Internal Stripe Pane (#optionsMarket) */
#optionsMarket {
  overflow: hidden;
  scrollbar-gutter: auto;
}
#optionsMarket > .om-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  background: var(--sys-surface-panebar);
  border-bottom: 1px solid var(--sys-border-default);
  font-size: var(--ref-text-xs);
  flex: none;
}
#optionsMarket > .om-toolbar[hidden] {
  display: none !important;
}
#optionsMarket > .om-toolbar .om-stripe-label {
  font-weight: 600;
  color: var(--sys-text-secondary);
}
#optionsMarket > .om-toolbar select[data-underlying] {
  height: 22px;
  min-height: 22px;
  padding: 0 6px;
  font-size: var(--ref-text-xs);
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
}
#optionsMarket > .om-insights {
  flex: none;
  padding: 6px 8px;
}
#optionsMarket > .om-insights .oi-plot {
  height: 176px;
}
#optionsMarket > .om-workspace {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}
#optionsMarket .om-chart-panel,
#optionsMarket .om-chain-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
#optionsMarket .om-chart-shell {
  flex: 1;
  height: auto;
  min-height: 0;
}
#optionsMarket .om-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
@container (max-width: 1100px) {
  #optionsMarket {
    overflow-y: auto;
  }
  #optionsMarket > .om-workspace {
    flex: none;
    overflow: visible;
  }
  #optionsMarket .om-chart-panel,
  #optionsMarket .om-chain-panel {
    height: auto;
    overflow: visible;
  }
  #optionsMarket .om-chart-shell {
    height: 340px;
  }
}

/* 版面 menu (#layoutMenu, from #layoutBtn): like the right-click menu (.ctx-menu); a changed layout carries
   its 另存 / 恢复 / 丢弃 icons at the row's end */
.ui-layout-menu {
  position: fixed;
  z-index: 40;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 8px));
  padding: 4px 0;
  display: grid;
  background: var(--sys-surface-float);
  border: 1px solid var(--sys-border-default);
  font-size: var(--ref-text-sm);
}
.ui-layout-menu[hidden] { display: none; }
.ui-layout-menu hr { border: 0; border-top: 1px solid var(--sys-border-subtle); margin: 4px 0; }
#layoutTabs { display: grid; }
.ui-layout-menu button {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--sys-text-primary);
  font: inherit;
  text-align: left;
  white-space: nowrap;
}
.ui-layout-menu button .grow { flex: 1; }
.ui-layout-menu > button { justify-content: space-between; }
.ui-layout-menu small { color: var(--sys-text-muted); font: 11px var(--mono); }
.ui-layout-menu button:hover,
.ui-layout-menu button:focus { background: var(--sys-state-hover); outline: none; }
#layoutTabs button[aria-current="true"] { font-weight: 600; box-shadow: inset 2px 0 0 var(--sys-actor-user); }
#workspaceDialog footer button {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
  font-size: var(--ref-text-sm);
}
#workspaceDialog footer button.primary {
  background: var(--sys-text-primary);
  border-color: var(--sys-text-primary);
  color: #fff;
}
#workspaceDialog footer button.danger {
  background: var(--sys-status-danger);
  border-color: var(--sys-status-danger);
  color: #fff;
}
.ui-tab-saveas,
.ui-tab-reset,
.ui-tab-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  margin-left: 2px;
  font-size: 11px;
  color: var(--sys-text-muted);
  background: transparent;
  border: 0;
  border-radius: 2px;
}
.ui-tab-saveas:hover,
.ui-tab-reset:hover {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
.ui-tab-del:hover {
  background: var(--sys-status-danger-tint);
  color: var(--sys-status-danger);
}
/* Multi-List Pane Header Actions inside #cols (.bcol-tabbar) */
.bcol-pill i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--sys-text-muted);
}
.bcol-tabbar-acts {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding-left: 4px;
}
.bcol-act-btn {
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-xs);
  line-height: 1;
  white-space: nowrap;
}
.bcol-plus-btn {
  width: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 2px;
  flex: none;
}
.bcol-act-btn:hover {
  border-color: var(--sys-text-primary);
  color: var(--sys-text-primary);
}

/* Compact 2-State Cycle Toggle (.ui-cycle-toggle):
   Fixed width (68px) so toggling between "分栏" (2 chars) and "标签页" (3 chars)
   produces 0px width jump, and matches the 11px (--ref-text-xs) font size of .bcol-pill! */
.ui-cycle-toggle {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  flex: 0 0 68px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid var(--sys-border-strong);
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
  font-size: var(--ref-text-xs);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  transition: border-color 0.12s, background 0.12s;
}
.ui-cycle-toggle:hover {
  border-color: var(--sys-actor-agent);
  background: var(--sys-surface-canvas);
}
.ui-cycle-track {
  position: relative;
  width: 15px;
  height: 9px;
  background: var(--sys-surface-paper-warm);
  border: 1px solid var(--sys-border-strong);
  border-radius: 9px;
  display: inline-block;
  flex: none;
}
.ui-cycle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sys-text-primary);
  transition: transform 0.14s cubic-bezier(0.4, 0, 0.2, 1), background 0.14s;
}
.ui-cycle-toggle.is-alt .ui-cycle-track {
  background: var(--sys-state-selected);
  border-color: var(--sys-actor-agent);
}
.ui-cycle-toggle.is-alt .ui-cycle-thumb {
  transform: translateX(6px);
  background: var(--sys-actor-agent);
}
.ui-cycle-label {
  flex: 1;
  text-align: center;
  font-size: var(--ref-text-xs);
  font-weight: 500;
  line-height: 1;
}

/* Level 3 Low Attention (Quiet): Top-Bar Feature Buttons & Tool Buttons
   Flush full-height tabs inside #bar so the active 2px bottom border sits directly
   on #bar's bottom edge with zero "double chin". */
#bar button:not(.primary),
#bar .btn {
  height: 100%;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex: none;
  transition: background 0.1s, color 0.1s, box-shadow 0.1s;
}
#bar button:not(.primary):hover {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
/* Emphasize 今日 (#todayBtn, user crimson) and 幕僚 (#chatToggle, agent sea blue) with bold + actor color */
#bar button#todayBtn {
  color: var(--sys-actor-user);
  font-weight: 700;
}
#bar button#todayBtn:hover {
  color: var(--sys-actor-user);
  background: var(--sys-actor-user-tint);
}
#bar button#chatToggle {
  color: var(--sys-actor-agent);
  font-weight: 700;
}
#bar button#chatToggle:hover {
  color: var(--sys-actor-agent);
  background: var(--sys-actor-agent-tint);
}
/* Active Feature Layout or Active Drawer Indicator (Shading + Flush 2px Bottom Border) */
#bar button[aria-pressed="true"],
#bar button.on,
#bar button.tog.on {
  background: var(--sys-state-active-tab);
  color: var(--sys-text-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--sys-actor-user);
}
#bar button.tog.on {
  background: var(--sys-state-hover);
  box-shadow: inset 0 -2px 0 var(--sys-text-primary);
}
#bar button#todayBtn[aria-pressed="true"] {
  background: var(--sys-actor-user-tint);
  color: var(--sys-actor-user);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--sys-actor-user);
}
#bar button#chatToggle.on {
  background: var(--sys-actor-agent-tint);
  color: var(--sys-actor-agent);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--sys-actor-agent);
}
/* 「更多」：期权市场 / 预测市场 / 宏观 / 策略 四个低频入口收进一个下拉（docs/design.md Layer 1）。
   菜单是 wrapper 的子节点，指针从按钮移向菜单不会触发 pointerleave，所以斜穿时只闪 90ms 就消失。
   fixed 定位：.ui-nav-links 是 overflow-x:auto，绝对定位会被裁掉。 */
#bar .ui-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  flex: none;
}
#bar #navMoreBtn .ui-more-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.5;
  transition: transform 0.12s ease-out, opacity 0.12s;
}
#bar #navMoreBtn[aria-expanded="true"] {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
#bar #navMoreBtn[aria-expanded="true"] .ui-more-caret { transform: rotate(180deg); opacity: 1; }
/* 内含页面处于激活态时，按钮底部画同一条胭脂线，前面加一个 4px 圆点，说明激活项在这个折叠区内 */
#bar #navMoreBtn.has-active {
  color: var(--sys-text-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--sys-actor-user);
}
#bar #navMoreBtn.has-active::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sys-actor-user);
}
/* 方角、1px、无阴影，与 .ui-layout-menu / .ctx-menu 同一套菜单语言 */
.ui-more-menu {
  position: fixed;
  z-index: 96;
  min-width: 132px;
  padding: 4px 0;
  display: grid;
  background: var(--sys-surface-float);
  border: 1px solid var(--sys-border-default);
  font-size: var(--ref-text-sm);
  animation: ui-more-in 0.12s ease-out;
}
@keyframes ui-more-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .ui-more-menu { animation: none; }
  #bar #navMoreBtn .ui-more-caret { transition: none; }
}
#bar .ui-more-menu button {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--sys-text-primary);
  font: inherit;
  font-size: var(--ref-text-sm);
  text-align: left;
  white-space: nowrap;
  transition: background 0.1s;
}
#bar .ui-more-menu button[aria-pressed="true"],
#bar .ui-more-menu button.on {
  background: transparent;
  color: var(--sys-text-primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--sys-actor-user);
}
#bar .ui-more-menu button:hover,
#bar .ui-more-menu button:focus-visible {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
#bar .ui-more-menu button:focus-visible {
  outline: 1px solid var(--sys-state-focus);
  outline-offset: -1px;
}


/* Float Launcher Menu Button (#spawnFloatBtn) */
.ui-float-launcher-wrap {
  position: relative;
  display: inline-flex;
  align-self: stretch;
  flex: none;
}
#bar #spawnFloatBtn {
  color: var(--sys-actor-agent);
  font-weight: 500;
}
.ui-float-menu {
  position: fixed;
  z-index: 95;
  width: 348px;
  background: var(--sys-surface-float);
  border: 1px solid var(--sys-border-strong);
  box-shadow: var(--comp-float-shadow);
  padding: 0;
  font-size: var(--ref-text-sm);
  display: flex;
  flex-direction: column;
}
.ui-float-menu[hidden] { display: none !important; }
.ui-float-menu-top {
  padding: 6px 8px;
  border-bottom: 1px solid var(--sys-border-subtle);
  background: var(--sys-surface-panebar);
}
#floatSearchInput {
  width: 100%;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--sys-border-strong);
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
  font: var(--ref-text-sm)/1 var(--sans);
  outline: none;
}
#floatSearchInput:focus {
  border-color: var(--sys-actor-agent);
  box-shadow: 0 0 0 1px var(--sys-actor-agent);
}
.ui-float-menu-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: var(--sys-surface-paper-warm);
  border-bottom: 1px solid var(--sys-border-subtle);
}
.ui-float-menu-tabs button {
  flex: 1;
  height: 22px;
  padding: 0 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.ui-float-menu-tabs button:hover {
  color: var(--sys-text-primary);
  background: var(--sys-state-hover);
}
.ui-float-menu-tabs button.on {
  background: var(--sys-surface-float);
  color: var(--sys-actor-agent);
  border-color: var(--sys-border-default);
  box-shadow: inset 0 -2px 0 var(--sys-actor-agent);
  font-weight: 600;
}
.ui-float-menu-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
}
.ui-float-menu-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--sys-text-muted);
  font-size: var(--ref-text-xs);
}
.ui-float-menu-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.ui-float-menu-item.on {
  background: var(--sys-state-selected);
  border-left-color: var(--sys-actor-agent);
}
.ui-fm-code {
  font: 600 var(--ref-text-xs)/1.2 var(--mono);
  color: var(--sys-actor-agent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-fm-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ui-fm-name {
  font-size: var(--ref-text-sm);
  color: var(--sys-text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-fm-sub {
  font-size: 10px;
  color: var(--sys-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-fm-badge {
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-paper-warm);
  color: var(--sys-text-secondary);
  white-space: nowrap;
}
.ui-float-menu-foot {
  padding: 5px 10px;
  border-top: 1px solid var(--sys-border-subtle);
  background: var(--sys-surface-panebar);
  font-size: 10px;
  color: var(--sys-text-muted);
  display: flex;
  justify-content: space-between;
}

/* ----------------------------------------------------------------------------
   2. PANE-LOCAL PRICE CHART TOOLBAR (#chartToolbar inside #charts — 通达信 Style)
   Lives strictly inside the Price Chart Pane; stops at the chart pane's right
   border; never pollutes the global top bar or other layouts!
   ---------------------------------------------------------------------------- */
#chartToolbar {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  height: var(--comp-panebar-h);
  min-height: var(--comp-panebar-h);
  padding: 0 8px;
  background: var(--sys-surface-panebar);
  border-bottom: 1px solid var(--sys-border-default);
  font-size: var(--ref-text-xs);
  user-select: none;
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
#chartToolbar::-webkit-scrollbar { display: none; }
#chartToolbar .market-events-toggle[hidden],
#chartToolbar .chart-odds-toggle[hidden] { display: none !important; }
/* Multi-Chart Link Controls (联动：标的 / 时间 / 十字) inside #chartToolbar */
.ui-link-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
  flex: none;
}
.ui-link-controls[hidden] { display: none !important; }
.ui-link-lbl {
  font-size: 10px;
  color: var(--sys-text-muted);
  padding: 0 2px;
  white-space: nowrap;
}
.ui-link-btn {
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 5px !important;
  border: 1px solid var(--sys-border-default) !important;
  background: var(--sys-surface-float) !important;
  color: var(--sys-text-muted) !important;
  font-size: var(--ref-text-xs) !important;
  line-height: 1 !important;
}
.ui-link-btn.on {
  border-color: var(--sys-border-strong) !important;
  color: var(--sys-text-primary) !important;
  background: var(--sys-state-active-tab) !important;
  box-shadow: inset 0 -2px 0 var(--sys-actor-user) !important;
  font-weight: 600 !important;
}
/* Tiny directional overflow micro-markers (‹ / ›) when #chartToolbar overflows */
#chartToolbar .ui-strip-more {
  position: sticky;
  z-index: 6;
  width: 14px;
  min-width: 14px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--sys-border-strong);
  background: var(--sys-surface-float);
  color: var(--sys-actor-user);
  font: 700 12px/1 var(--mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;
}
#chartToolbar .ui-strip-more.is-left {
  left: -6px;
  box-shadow: 4px 0 6px var(--sys-surface-panebar);
}
#chartToolbar .ui-strip-more.is-right {
  right: -6px;
  box-shadow: -4px 0 6px var(--sys-surface-panebar);
}
#chartToolbar .ui-strip-more[hidden] {
  display: none !important;
}
/* Automatically hide #chartToolbar when a full-screen feature overlay inside #charts (#cloudmap) is open */
#charts:has(> #cloudmap:not([hidden])) > #chartToolbar {
  display: none;
}
#charts.quad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(2, minmax(0, 1fr));
}
#charts.quad > #chartToolbar {
  grid-column: 1 / -1;
}

/* Auxiliary Watchlist sits beside a complete page, using the existing board nodes. */
#cols.page-panel > .bcol > .cgrip { display: none; }
#cols.page-panel { flex: none; width: 340px; max-width: 45vw; grid-template-columns: minmax(0, 1fr) !important; }
@media (max-width: 720px) {
  #cols.page-panel.mobile-open:not([hidden]) { width: min(100%, 380px); max-width: 100%; z-index: 7; }
}
/* Page and panel entries stay in the same place in every view. */
#bar [hidden] { display: none !important; }
.ui-float-body .lg .star,
.ui-float-body .chart .dl,
.ui-docked-body .lg .star,
.ui-docked-body .chart .dl {
  display: none !important;
}
.ui-float-body .legends,
.ui-docked-body .legends {
  top: 4px;
  left: 6px;
  right: 54px;
}
.ui-float-body .lg,
.ui-docked-body .lg {
  font-size: 11px;
  background: rgba(252, 251, 249, 0.88);
  padding: 1px 4px;
}

.ui-pane-identity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--sys-text-primary);
  padding-right: 4px;
  white-space: nowrap;
  flex: none;
}
.ui-pane-identity .pane-code {
  font-family: var(--mono);
  color: var(--sys-text-muted);
  font-weight: 400;
}
.ui-pane-tabs {
  display: inline-flex;
  gap: 2px;
  flex: none;
}
.ui-pane-tabs[hidden] { display: none; }
.ui-pane-tab {
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-canvas);
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-xs);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ui-pane-tab.on {
  border-color: var(--sys-actor-agent);
  background: var(--sys-state-selected);
  color: var(--sys-actor-agent);
  font-weight: 600;
}

/* Quiet Inline Timeframe Strip (#periods) */
#chartToolbar #periods.seg {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  margin: 0;
  gap: 1px;
  flex: none;
}
#chartToolbar #periods button {
  height: var(--comp-ctrl-h-sm);
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#chartToolbar #periods button:hover:not(:disabled) {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
#chartToolbar #periods button.on {
  background: var(--sys-text-primary);
  color: var(--sys-text-on-solid);
  font-weight: 600;
}
#chartToolbar #periods button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Quiet Chart Layer Tools (#adj, #formulaBtn, #factorBtn, #note, #eventControls, #chartConfig) */
#chartToolbar button:not(#periods button),
#chartToolbar select {
  height: var(--comp-ctrl-h-sm);
  padding: 0 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sys-text-secondary);
  font-size: var(--ref-text-xs);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex: none;
}
#chartToolbar button:not(#periods button):hover,
#chartToolbar select:hover {
  background: var(--sys-state-hover);
  color: var(--sys-text-primary);
}
#chartToolbar button.on,
#chartToolbar button.tog.on,
#chartToolbar .market-events-toggle[aria-expanded="true"],
#chartToolbar .chart-odds-toggle[aria-pressed="true"] {
  background: var(--sys-surface-float);
  border-color: var(--sys-border-default);
  color: var(--sys-text-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--sys-text-primary);
}
#chartToolbar .grow { flex: 1; }

/* Chart additions share one visual family; the fixed launcher keeps them reachable in narrow chart columns. */
#chartTools {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 2px;
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid var(--sys-border-default);
}
#chartToolbar #chartTools .chart-tool-button {
  gap: 4px;
  color: var(--sys-text-primary);
  font-size: var(--ref-text-sm);
  font-weight: 500;
}
.chart-tool-icon { display: block; flex: none; }
#chartTools .chart-tool-button[hidden] { display: none !important; }
#chartToolsBtn {
  position: absolute;
  top: 0;
  right: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 96px;
  height: var(--comp-panebar-h);
  padding: 0 6px;
  border: 0;
  border-left: 1px solid var(--sys-border-default);
  border-bottom: 1px solid var(--sys-border-default);
  background: var(--sys-surface-panebar);
  color: var(--sys-text-primary);
  font-size: var(--ref-text-sm);
  white-space: nowrap;
}
#chartToolsBtn[hidden], #chartToolsMenu[hidden] { display: none; }
#charts:has(> #cloudmap:not([hidden])) > #chartToolsBtn { display: none; }
#chartToolsBtn:hover, #chartToolsBtn[aria-expanded="true"] { background: var(--sys-state-hover); }
#chartToolsBtn:focus-visible, .chart-tool-button:focus-visible { outline: 2px solid var(--sys-text-secondary); outline-offset: -2px; }
#chartToolsBtn.placing-note { box-shadow: inset 0 -2px 0 var(--sys-text-primary); }
.chart-tool-chevron { font-size: var(--ref-text-xs); color: var(--sys-text-muted); }
#charts > #chartToolbar.has-tool-menu { margin-right: 124px; }
#chartToolsMenu {
  position: fixed;
  z-index: 55;
  min-width: 176px;
  padding: 4px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
}
#chartToolsMenu #chartTools { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 0; border: 0; }
#chartToolsMenu #eventControls { display: contents; }
#chartToolsMenu .chart-tool-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--sys-text-primary);
  font-size: var(--ref-text-md);
  text-align: left;
}
#chartToolsMenu .chart-tool-button[hidden] { display: none; }
#chartToolsMenu .chart-tool-button:is(:hover, :focus-visible),
#chartToolsMenu .chart-tool-button:is(.on, [aria-expanded="true"]) { background: var(--sys-state-hover); }
@media (max-width: 720px) {
  #chartToolsBtn { right: 44px; height: 44px; }
  #charts > #chartToolbar.has-tool-menu { margin-right: 140px; }
}

.ui-link-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 6px;
  border-left: 1px solid var(--sys-border-default);
  flex: none;
}
.ui-link-group[hidden] {
  display: none !important;
}
.ui-link-group label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--ref-text-xs);
  color: var(--sys-text-secondary);
  cursor: pointer;
}
.ui-link-group input[type="checkbox"] {
  margin: 0;
  width: 13px;
  height: 13px;
  accent-color: var(--sys-text-primary);
}

/* ----------------------------------------------------------------------------
   4. NON-DIMMING STACKABLE FLOATING PANES (.ui-float-win & Tool Windows)
   "Finance nerds love stacking stuff" — Zero background dimming!
   ---------------------------------------------------------------------------- */
/* Strip dark modal backdrops from tool dialogs so users can stack them over live charts */
#boards,
#layouts,
#formulas,
#factors.factor-dialog,
#skills,
#holdings {
  background: transparent !important;
  pointer-events: none !important;
}
#boards > .dlg,
#layouts > .dlg,
#formulas > .dlg,
#factors > .factor-box,
#skills > .dlg,
#holdings > .dlg {
  pointer-events: auto !important;
  box-shadow: var(--comp-float-shadow), 0 0 0 1px var(--sys-border-strong) !important;
  border: 1px solid var(--sys-text-primary) !important;
}
#boards .dlg-title,
#layouts .dlg-title,
#formulas .dlg-title,
#skills .dlg-title,
#alerts .dlg-title,
#holdings .dlg-title,
#factors .factor-box > header {
  cursor: move;
  user-select: none;
}

/* Stackable Floating Window Layer (#floatLayer) */
#floatLayer {
  position: fixed;
  inset: var(--comp-appbar-h) 0 var(--comp-tapebar-h) 0;
  pointer-events: none;
  z-index: 35;
  overflow: hidden;
}

.ui-float-win {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: var(--sys-surface-float);
  border: 1px solid var(--sys-border-strong);
  box-shadow: var(--comp-float-shadow);
  min-width: 260px;
  min-height: 180px;
  overflow: hidden;
}
.ui-float-win.is-focused {
  border-color: var(--sys-actor-agent);
  box-shadow: 0 8px 26px rgba(39, 32, 27, 0.20), 0 0 0 1px var(--sys-actor-agent);
}
.ui-float-win.is-shaded {
  height: 28px !important;
  min-height: 28px !important;
}
.ui-float-win.is-shaded .ui-float-body,
.ui-float-win.is-shaded .ui-float-subbar,
.ui-float-win.is-shaded .ui-float-resize {
  display: none !important;
}

.ui-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  background: var(--sys-surface-float-head);
  border-bottom: 1px solid var(--sys-border-default);
  cursor: move;
  user-select: none;
  font-size: var(--ref-text-xs);
}
.ui-float-win.is-focused .ui-float-head {
  background: var(--sys-text-primary);
  color: var(--sys-text-on-solid);
  border-bottom-color: var(--sys-text-primary);
}
.ui-float-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-float-badge {
  font: 10px/1.2 var(--mono);
  padding: 1px 4px;
  background: rgba(58, 106, 168, 0.16);
  color: var(--sys-actor-agent);
}
.ui-float-win.is-focused .ui-float-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.ui-float-acts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.ui-float-acts button {
  height: 20px;
  min-width: 20px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 11px;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ui-float-acts button:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.2);
}

.ui-float-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  background: var(--sys-surface-panebar);
  border-bottom: 1px solid var(--sys-border-subtle);
  font-size: 11px;
}
.ui-float-tfs {
  display: inline-flex;
  gap: 1px;
}
.ui-float-tfs button {
  height: 18px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: var(--sys-text-secondary);
  font-size: 11px;
}
.ui-float-tfs button.on {
  background: var(--sys-text-primary);
  color: #fff;
  font-weight: 600;
}

.ui-float-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  background: var(--sys-surface-canvas);
  font-size: var(--ref-text-sm);
}

.ui-float-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  z-index: 5;
  background: linear-gradient(135deg, transparent 50%, var(--sys-border-strong) 50%);
}

/* Edge-Only Dock Highlights (#splitDropOverlay & .ui-dock-edge):
   Highlights ONLY the 1D column left-right borders and row up-down borders;
   ZERO surface occlusion, ZERO background dimming! */
#splitDropOverlay {
  position: absolute;
  inset: 0;
  z-index: 32;
  pointer-events: none;
  background: transparent;
}
#splitDropOverlay[hidden] { display: none !important; }

.ui-dock-edge {
  position: absolute;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, box-shadow 0.1s;
}
.ui-dock-edge.is-vert {
  width: 8px;
  background: rgba(58, 106, 168, 0.16);
  border-left: 2px dashed var(--sys-actor-agent);
}
.ui-dock-edge.is-horiz {
  height: 8px;
  background: rgba(58, 106, 168, 0.16);
  border-top: 2px dashed var(--sys-actor-agent);
}
.ui-dock-edge .ui-edge-pill {
  display: none;
  padding: 2px 7px;
  background: var(--sys-actor-user);
  color: #fff;
  font: 600 11px/1.3 var(--sans);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(39, 32, 27, 0.22);
  z-index: 2;
}
.ui-dock-edge.is-hot.is-vert {
  background: rgba(213, 21, 98, 0.28);
  border-left: 3px solid var(--sys-actor-user);
  box-shadow: 0 0 0 2px rgba(213, 21, 98, 0.18);
}
.ui-dock-edge.is-hot.is-horiz {
  background: rgba(213, 21, 98, 0.28);
  border-top: 3px solid var(--sys-actor-user);
  box-shadow: 0 0 0 2px rgba(213, 21, 98, 0.18);
}
.ui-dock-edge.is-hot .ui-edge-pill {
  display: inline-block;
}

.ui-float-win.is-dock-armed {
  border-color: var(--sys-actor-user) !important;
  box-shadow: 0 8px 26px rgba(39, 32, 27, 0.22), 0 0 0 1px var(--sys-actor-user);
}
.ui-float-acts button[data-float-act="dock"].on {
  background: var(--sys-actor-user);
  color: #fff;
  opacity: 1;
}

/* Column-Based Docked Split Panes Container (#dockedSplits) */
#dockedSplits {
  display: flex;
  flex-direction: row;
  border-left: 1px solid var(--sys-border-default);
  background: var(--sys-surface-canvas);
  min-height: 0;
  flex: none;
}
#dockedSplits[hidden] { display: none !important; }
.ui-docked-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 150px;
  border-left: 1px solid var(--sys-border-default);
  container-type: inline-size;
}
.ui-docked-col:first-child { border-left: 0; }
#workspace:has(> #dailyDesk:not([hidden]), > #worldModel:not([hidden]), > #watchDesk:not([hidden]), > #predictionMarket:not([hidden]), > #optionsMarket:not([hidden])) > .ui-docked-col {
  display: none !important;
}
.ui-docked-pane {
  position: relative;
  flex: 1;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--sys-border-default);
  overflow: hidden;
}
.ui-docked-pane:last-child { border-bottom: 0; }
.ui-docked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 8px;
  background: var(--sys-surface-bar);
  border-bottom: 1px solid var(--sys-border-subtle);
  font-size: var(--ref-text-xs);
  font-weight: 600;
  flex: none;
}
.ui-docked-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-docked-head-acts {
  display: inline-flex;
  gap: 4px;
  flex: none;
}
.ui-docked-head-acts button {
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-secondary);
  font-size: 11px;
}
.ui-docked-head-acts button:hover {
  color: var(--sys-text-primary);
  border-color: var(--sys-text-secondary);
}
.ui-docked-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
}

/* De-duplicated Pane Highlight Pulse (.ui-pane-flash) */
@keyframes ui-flash-pulse {
  0%   { box-shadow: inset 0 0 0 2px var(--sys-actor-user), 0 0 0 3px rgba(213, 21, 98, 0.25); }
  100% { box-shadow: inset 0 0 0 0 transparent, 0 0 0 0 transparent; }
}
.ui-pane-flash {
  animation: ui-flash-pulse 1.2s ease-out;
}

/* ----------------------------------------------------------------------------
   5. WATCHLIST COLUMN BOARD TAB BAR (.bcol-tabbar)
   Aligns to the exact 28px (--comp-panebar-h) horizontal row of #chartToolbar and #quoteDetail.
   - In 分栏 (.is-split-mode): board items render as compact square pills ("小方块").
   - In 标签页 (.is-tab-mode): board items render as bottom-anchored folder tab cards ("标签卡").
   ---------------------------------------------------------------------------- */
.bcol-tabbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--comp-panebar-h);
  min-height: var(--comp-panebar-h);
  padding: 0 6px;
  background: var(--sys-surface-panebar);
  border-bottom: 1px solid var(--sys-border-default);
  flex: none;
}
.bcol-tab-scroll {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 100%;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.bcol-tab-scroll::-webkit-scrollbar { display: none; }

/* Base .bcol-pill typography (unified with .ui-cycle-toggle at --ref-text-xs / 11px) */
.bcol-pill {
  font-size: var(--ref-text-xs);
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

/* Mode A: 分栏 (.is-split-mode) — Compact Square Chips ("小方块") */
.bcol-tabbar.is-split-mode .bcol-pill,
.bcol-tabbar:not(.is-tab-mode) .bcol-pill {
  height: 20px;
  align-self: center;
  padding: 0 6px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-text-muted);
  border-radius: 1px;
}
.bcol-tabbar.is-split-mode .bcol-pill.is-shown,
.bcol-tabbar:not(.is-tab-mode) .bcol-pill.is-shown {
  border-color: var(--sys-border-strong);
  color: var(--sys-text-primary);
}
.bcol-tabbar.is-split-mode .bcol-pill.on,
.bcol-tabbar:not(.is-tab-mode) .bcol-pill.on {
  border-color: var(--sys-border-strong);
  color: var(--sys-text-primary);
  background: var(--sys-state-active-tab);
  box-shadow: inset 2px 0 0 var(--sys-actor-user);
  font-weight: 600;
}

/* Mode B: 标签页 (.is-tab-mode) — Bottom-Anchored Folder Tab Cards ("标签卡") */
.bcol-tabbar.is-tab-mode {
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--sys-border-default);
}
.bcol-tabbar.is-tab-mode .bcol-tab-scroll {
  align-items: flex-end;
  gap: 3px;
}
.bcol-tabbar.is-tab-mode .bcol-pill {
  height: 24px;
  align-self: flex-end;
  padding: 0 9px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-paper);
  color: var(--sys-text-secondary);
  border-radius: 3px 3px 0 0;
  position: relative;
}
.bcol-tabbar.is-tab-mode .bcol-pill.on {
  height: 25px;
  background: var(--sys-surface-float);
  color: var(--sys-text-primary);
  font-weight: 600;
  border-color: var(--sys-border-strong);
  border-bottom-color: var(--sys-surface-float);
  box-shadow: inset 0 2px 0 var(--sys-actor-user);
  z-index: 2;
}

/* Align all right-hand drawer headers (#strat .shead, #alerts .head, #chat .ch-head)
   to the exact 28px (--comp-panebar-h) horizontal line of #chartToolbar, #quoteDetail, and .bcol-tabbar */
#strat .shead,
#alerts > .head,
#chat .ch-head,
.macro-follow-head {
  height: var(--comp-panebar-h) !important;
  min-height: var(--comp-panebar-h) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  background: var(--sys-surface-panebar) !important;
  border-bottom: 1px solid var(--sys-border-default) !important;
}
@media (max-width: 720px) {
  #macroCatalog .macro-follow-head {
    height: 44px !important;
    min-height: 44px !important;
  }
}
#chat .ch-head .ch-view,
#chat .ch-head .ch-quiet,
#chat .ch-head .ch-x {
  height: calc(var(--comp-panebar-h) - 1px) !important;
  padding-top: 0 !important;
  display: inline-flex;
  align-items: center;
}

.bpanel.cur .bhead {
  box-shadow: inset 3px 0 0 var(--sys-actor-user);
}
.bcol-pill:hover {
  color: var(--sys-text-primary);
  border-color: var(--sys-text-secondary);
}

/* Keyboard Sprite (#sprite) Float Action Button */
#sprite .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  background: var(--sys-text-primary);
  color: var(--sys-text-on-solid);
  font-size: var(--ref-text-xs);
  font-weight: 600;
}
#sprite .bar span {
  color: var(--ref-border-300);
  font-weight: 400;
  font-size: 11px;
}
#sprite .sprite-float-tog {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 400;
  color: var(--ref-paper-200);
  cursor: pointer;
}
#spriteList li {
  grid-template-columns: 76px 1fr auto auto !important;
  align-items: center;
}
#spriteList .sp-float-btn {
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--sys-border-default);
  background: var(--sys-surface-float);
  color: var(--sys-actor-agent);
  font-size: 10px;
  white-space: nowrap;
}
#spriteList .sp-float-btn:hover {
  background: var(--sys-actor-agent);
  border-color: var(--sys-actor-agent);
  color: #fff;
}

/* On compact windows, market navigation gets its own scrollable row. The two
   daily pages remain centered and the two right-side panels remain visible. */
@media (max-width: 1200px) {
  #bar { height: auto; grid-template-rows: var(--comp-appbar-h) var(--comp-appbar-h); }
  #bar .ui-nav-start, #bar .ui-nav-end { display: contents; }
  #bar .ui-brand { grid-column: 1; grid-row: 1; justify-self: start; }
  #bar .ui-nav-center { grid-column: 2; grid-row: 1; }
  #bar .ui-nav-panels { grid-column: 3; grid-row: 1; justify-self: end; }
  #bar .ui-nav-links { grid-column: 1 / 3; grid-row: 2; }
  #bar .ui-nav-utility { grid-column: 3; grid-row: 2; justify-self: end; max-width: 100%; }
  #bar .ui-nav-utility #status { display: none; }
}
@media (max-width: 720px) {
  #bar { padding: 0 6px; grid-template-rows: 44px 44px; }
  #bar .ui-sep { display: none; }
  #bar button:not(.primary), #bar .btn { height: 44px; min-height: 44px; min-width: 44px; padding: 0 7px; }
  #bar #chatToggle .mark { display: none; }
  #bar .ui-nav-utility #help { min-width: 26px; margin-left: 0; }
  #bar #who { flex: 0 1 auto; }
  #chartToolbar {
    flex-wrap: nowrap;
    height: var(--comp-panebar-h);
    min-height: var(--comp-panebar-h);
    padding: 0 6px;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #chartToolbar #searchBtn.ui-pane-identity {
    height: 28px;
    min-height: 28px;
    padding: 0 8px;
  }
  #chartToolbar #periods button,
  #chartToolbar select,
  #chartToolbar > button:not(#searchBtn),
  #chartToolbar #eventControls button {
    height: 28px;
    min-height: 28px;
  }
  #charts.quad {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  #charts.quad .chart {
    flex: none;
    min-height: 300px;
  }
}

/* Prevent iOS Safari / WeChat WKWebView forced viewport zoom on < 16px form inputs while keeping desktop density intact. */
@media (max-width: 720px) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select:not(#adj),
  textarea {
    font-size: max(16px, 1em) !important;
  }
}

@media (max-width: 720px) {
  #holdings table.hold tr.editing {
    display: grid;
    gap: 8px;
    padding: 10px;
  }
  #holdings table.hold tr.editing td {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    border: 0;
  }
  #holdings table.hold tr.new-row input[name="code"] {
    flex: 1 1 180px;
    min-width: 0;
  }
}

/* Offscreen layout containment strictly for pure-DOM long lists (never wrap Canvas chart containers). */
#alerts .rows > .item,
#factors .factor-items > article {
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}
