/* Rally design tokens — the site-wide visual standard, drawn from /remake (D-632).
   Every page that adopts the standard loads this file first, then rally-ui.css.
   Live reference: /design. Rules and reasons: docs/design-system.md.

   Brand constants (D-623): ink #141413, paper #EFEEE9, yellow #FFCC00.
   Yellow is for the one main action of the current step, the brand dot, and thin
   "you are here" markers — playhead, focus ring, the current tab's underline
   (D-632, D-651, D-2117); status colours only ever mean status.
   Appearance (D-612, D-632): follow the computer, or the viewer's own choice; the
   page sets <html data-theme="light|dark"> before the first paint.

   Three tiers (D-1478, step 0 of the visual rebuild):
     1 · Primitive scales — the raw steps: type, weight, leading, tracking, space, radius, motion, layers.
     2 · Semantic roles   — what a value is for: colour roles per theme, elevation, page widths.
     3 · Component sizes  — values one component or the app shell owns: control heights, sidebar, dialogs.
   A page reads the semantic or component token when one fits and a primitive step otherwise, and never
   writes the raw value (scripts/check-token-coverage.mjs holds the line: existing raw values are stock that
   may only shrink). Changing a token changes every page at once — that is the point of the tiers. */

/* ── 1 · Primitive scales: the same in both themes ─────────────────────── */
:root{
  --font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif;
  --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  /* Type scale: four sizes (D-1484, visual rebuild step 1) — 13 metadata (12 until D-1798: half the text on a
     work page was 12px and read as strain; 13 is 1px off 14, so metadata is told apart by colour — muted — not
     by size) · 14 interface text · 16 panel and dialog titles, reading text · 20 page title. The old 13 joined 14 and 15 joined 16 (they were 1px apart and
     read as one size); the names stay so pages did not change. Numbers are the text face with tabular figures
     (.num); --mono is only for IDs, raw errors and keys.
     D-2293 opened the top of the scale, because 16 / 16 / 20 left every heading and every key number the same size as
     the text around it: --text-lg 18 section and dialog titles (--text-md 16 stays the title inside a panel or card) ·
     --text-xl 24 page title and a key number in a card or table · --text-2xl 30 the one headline number of a page. */
  --text-xs:13px;--text-sm:14px;--text-base:14px;--text-md:16px;--text-lg:18px;--text-xl:24px;--text-2xl:30px;
  /* Weight: three. PingFang SC, the Chinese face on every colleague's Mac, stops at semibold: a weight above
     600 left the Chinese at semibold while Latin and digits kept getting heavier, so one line mixed two
     weights. --weight-bold is 600 since D-1484 and kept only so old uses still resolve. */
  --weight-regular:400;--weight-medium:500;--weight-semibold:600;--weight-bold:600;
  /* Leading (line height), unitless so it follows the font size (D-1484): --leading-snug for tight labels ·
     interface text 14/21 --leading-normal (body; 1.43 until D-1798, Chinese at 12–14px read cramped) ·
     running text --leading-relaxed (paragraphs). */
  --leading-none:1;--leading-tight:1.2;--leading-snug:1.34;--leading-normal:1.5;--leading-relaxed:1.65;
  /* Tracking (letter spacing). Chinese takes none (D-1484): the page title and the eyebrow, both Chinese,
     dropped their -.01em / .04em; the names stay for a future Latin-only label. */
  --tracking-tight:0;--tracking-normal:0;--tracking-wide:0;
  /* Spacing: steps of 4. */
  --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:20px;--space-6:24px;--space-8:32px;--space-12:48px;
  /* Corners: chips 4, controls 6, cards 8, dialogs 10, pills round. */
  --radius-sm:4px;--radius:6px;--radius-md:8px;--radius-lg:10px;--radius-full:999px;
  /* Motion. Durations, one easing curve, and --ease, the pair most components use
     (transition: background var(--ease)): a state change 120ms, an overlay coming in 200ms, a panel 300ms
     (D-1484). Only fades and small shifts; reduced motion is honoured everywhere (rally-ui.css). */
  --dur-instant:80ms;--dur-fast:120ms;--dur-base:120ms;--dur-moderate:200ms;--dur-slow:300ms;
  /* 悬停才出现的东西（悬停提示）先等这么久：鼠标划过一排按钮时不一路闪；键盘聚焦不等（规范「动效」） */
  --delay-hover:200ms;
  /* 开了「减少动态效果」时，表示「还在处理」的转圈（.busy-loop）放慢到这么久一圈，不停（D-1928） */
  --dur-busy-loop:3s;
  --ease-standard:cubic-bezier(.2,0,0,1);
  --ease:var(--dur-base) var(--ease-standard);
  /* Layers (z-index), bottom to top. A component's own stacking (a badge over its card) uses 1–99
     inside itself; anything that floats over other parts of the page takes one of these. Two kinds of
     dialog: --z-overlay is a page's own dialog and its mask, under the toasts; --z-blocking is a full-screen
     dialog that must be dealt with first (a save conflict on a workbench, no permission) and covers the toasts. */
  --z-tooltip:50;--z-sticky:100;--z-dropdown:1000;--z-floating:9998;--z-overlay:9999;--z-toast:10000;
  --z-blocking:99999;--z-palette:1000000;--z-system:2147483647;
  /* (D-1531) --z-tip-top: a hover tip that must show over dialogs and toasts. --z-banner: the base of the
     top warning banners on the workbenches (storage full, save failed, taken over…); each banner keeps its
     place with calc(var(--z-banner) + n), n 0–8, all under --z-blocking. */
  --z-tip-top:10020;--z-banner:99990;
}

/* ── 2 · Semantic roles that do not change with the theme ───────────────── */
:root{
  /* Page widths, three tiers (D-310, moved here from page-width.css): M reading / forms ·
     L data and lists · XL workbenches. --w-read is the reading column inside a page. */
  --page-width-m:920px;
  --page-width-l:1280px;
  /* clamp 的 1400px 下限保证 1400~1460px 宽的窗口不比旧呈现窄(只放宽不收窄) */
  --page-width-xl:clamp(1400px,96vw,1720px);
  --w-read:720px;
}

/* ── 3 · Component sizes ───────────────────────────────────────────────── */
:root{
  /* Focus ring (D-2492): keyboard focus is one ring site-wide — width here, colour --focus-ring-color per theme
     (follows --brand-line), shorthand --focus-ring. Each component keeps only its own outline-offset. */
  --focus-ring-width:2px;
  /* Control heights: small 30, default 34, large (a screen's main action) 38, text field 40. */
  --h-sm:30px;--h:34px;--h-lg:38px;--h-field:40px;
  /* App shell. */
  --side-w:248px;--top-h:52px;
  /* Overlays and side panels. */
  --w-aside:300px;--w-menu:240px;--w-toast:380px;--w-dialog:380px;--w-confirm:420px;
  /* Dialog widths with content, three tiers (D-1531): S forms and short lists 600 · M several columns or
     explanations 760 · L video beside controls, wide tables 980. */
  --w-dialog-s:600px;--w-dialog-m:760px;--w-dialog-l:980px;
  /* Floating zone (D-696): the bottom-right corner that belongs to the site-wide floating buttons
     (to-do bubble, first-visit ⌘K hint). Primary actions stay out of it; a scrolling page ends with at
     least --float-safe-bottom of space so its last row can scroll clear; a floating button that still
     lands on a primary action steps aside (cmdk.js). */
  --float-inset:16px;--float-size:44px;
  --float-safe-bottom:calc(var(--float-inset) + var(--float-size) + var(--space-3));
  --float-safe-right:calc(var(--float-inset) + var(--float-size) + var(--space-3));
}

/* Skeleton shimmer (D-682): --skel-a is the block, --skel-b the travelling highlight. Both must read
   on --bg and on --panel in each theme (the D-632 values vanished on the dark panel). */

/* ── 2 · Colour roles and elevation: dark (default) ────────────────────
   Two anchors per theme and one ladder (D-1484, visual rebuild step 1, from the 10-25 diagnosis): the page
   colour and the logo's paper #EFEEE9 (rgb 239 238 233); every grey fill and line is that paper colour at a fixed
   alpha, so it reads the same on the page, a panel or a sidebar. Text is a notch below paper since D-1798:
   --text #E2E1DC (14:1 on the page, was 15.7 — near-white on near-black glared over a long session; Notion
   sits at about the same 14) and --soft #B8B7B3 (9.1, was 10.9 — it sat too close to --text, so primary and
   secondary did not separate); muted / faint unchanged (6.5 · 3.9, D-1278 floors). Status and
   role colours sit a notch less saturated; a tint is the base at 12%, an edge 25%, a card 6%.
   .dark-zone keeps a region dark in either theme (the video area, like YouTube's light mode).
   Elevation lives here, not in the theme-free block: its shadow colour must resolve inside a
   .dark-zone / .light-zone too (a custom property on :root is computed once, with :root's colours). */
:root,.dark-zone{color-scheme:dark;
  --bg:#151514;--side:#121211;--panel:#1b1b1a;
  --raised:rgba(239,238,233,.05);--hover:rgba(239,238,233,.08);--chip:rgba(239,238,233,.06);--well:rgba(239,238,233,.03);
  --line:rgba(239,238,233,.10);--field-line:rgba(239,238,233,.16);--line-strong:rgba(239,238,233,.22);--line-hover:rgba(239,238,233,.30);
  --now-row:#121218;--edge:#1c1f2a;
  /* Selected (2026-10-23): the chosen one in a set — segmented choice, current sidebar row, a toggle that is on —
     is raised out of its surface, never inverted to a text-coloured block. */
  --selected:rgba(239,238,233,.12);--selected-lift:0 0 0 1px var(--line-strong),0 1px 2px var(--shadow);
  --skel-a:rgba(239,238,233,.06);--skel-b:rgba(239,238,233,.11);--disabled-bg:rgba(239,238,233,.06);--disabled-text:#636360;--drop-over:#1d1a0c;
  
  /* 选择类控件的下拉箭头（D-1804）：图标库 chevron 同一画法、--soft 色；select 不能放子元素也不认 currentColor，只能用背景图，深浅各一份 */
  --icon-chevron-down:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8B7B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");--icon-chevron-up:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8B7B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
  --text:#E2E1DC;--soft:#B8B7B3;--muted:#9a9a96;--faint:#747471;
  --brand:#FFCC00;--brand-ink:#141413;--brand-line:#FFCC00;
  --focus-ring-color:var(--brand-line);--focus-ring:var(--focus-ring-width) solid var(--focus-ring-color);
  --run:#7d9ef0;--run-bg:rgba(125,158,240,.12);--run-text:#a9c0f5;--run-glow:rgba(125,158,240,.15);
  --review:#e3884d;--review-bg:rgba(227,136,77,.12);--review-text:#efb084;--review-card:rgba(227,136,77,.06);--review-line:rgba(227,136,77,.25);
  --ok:#4fba86;--ok-bg:rgba(79,186,134,.12);--ok-line:rgba(79,186,134,.25);--ok-text:#7fcfa5;
  --bad:#e0656b;--bad-bg:rgba(224,101,107,.12);--bad-text:#f09ea1;--bad-line:rgba(224,101,107,.25);--bad-card:rgba(224,101,107,.06);
  --shadow:rgba(0,0,0,.5);--shadow-strong:rgba(0,0,0,.6);--backdrop:rgba(0,0,0,.55);--pointer-line:rgba(239,238,233,.35);--played:rgba(255,204,0,.07);
  /* Text selection: a quiet brand yellow (a "you are here" mark, like the focus ring). A floating layer's frame:
     a hairline ring at the very edge instead of a hard border (menus, toasts, dialogs; drawn outside, not inset, D-1929). */
  --selection:rgba(255,204,0,.28);--edge-highlight:rgba(239,238,233,.08);
  /* The surface of a menu or popover that floats over the page without a backdrop (D-1491): one step lighter
     than a card (--raised over --bg is about #202020), so a menu opened over a card reads as above it, not sunk. */
  --popover:#272726;
  /* Surfaces by kind (D-2301): a container, a control and a tag used to be the same grey fill, so nothing said what
     could be clicked. --card / --card-line: a card is the panel colour inside a hairline. --control / --control-line /
     --control-shadow: a secondary button is a lifted surface with a hairline; --control-hover is its hover. Tags, chips
     and wells inside a card keep the grey fills (--chip, --raised, --well); a disabled control stays a flat grey block. */
  --card:#1b1b1a;--card-hover:#212120;--card-line:rgba(239,238,233,.10);
  --control:rgba(239,238,233,.08);--control-hover:rgba(239,238,233,.13);--control-line:rgba(239,238,233,.16);--control-shadow:0 0 0 0 transparent;
  /* Elevation: raised (a small floating hint) · popover (menus, toasts) · dialog (dialogs, the ⌘K palette) ·
     drawer (a panel sliding in from the right: shadow to its left) · sheet (a bar pinned to the bottom: shadow upward) (D-1528). */
  --elevation-raised:0 2px 12px var(--shadow);--elevation-popover:0 12px 32px var(--shadow);--elevation-dialog:0 20px 48px var(--shadow-strong);--elevation-drawer:-18px 0 48px var(--shadow-strong);--elevation-sheet:0 -10px 30px var(--shadow);
  /* Work roles (D-641; D-671 素材 / 合成 / 修剪 re-hued away from 校对 purple, 等你处理 orange and 失败 red):
     which stage of the pipeline — identity, not status. Use them for a column edge, a dot or a tag. */
  --role-material:#5fb5cf;--role-mark:#e2a06a;--role-proof:#b18fde;--role-compose:#d781bd;--role-publish:#3eae9f;--role-trim:#a8bb5c;
  /* Role tints (D-651): a quiet fill and its edge, the base at 12% / 25%. */
  --role-material-bg:rgba(95,181,207,.12);--role-material-line:rgba(95,181,207,.25);--role-mark-bg:rgba(226,160,106,.12);--role-mark-line:rgba(226,160,106,.25);
  --role-proof-bg:rgba(177,143,222,.12);--role-proof-line:rgba(177,143,222,.25);--role-compose-bg:rgba(215,129,189,.12);--role-compose-line:rgba(215,129,189,.25);
  --role-publish-bg:rgba(62,174,159,.12);--role-publish-line:rgba(62,174,159,.25);--role-trim-bg:rgba(168,187,92,.12);--role-trim-line:rgba(168,187,92,.25);
  /* Text on a role or status fill: dark on the bright dark-theme fills, white on the deep light-theme ones. */
  --on-color:#141413;
  /* State layers (D-667): hover / press drawn as a thin veil of the text colour over whatever
     surface is underneath, so the feedback shows on the page, a panel or a sidebar alike. */
  --state-hover:rgba(239,238,233,.06);--state-press:rgba(239,238,233,.10);
  /* Sides of the table (D-667): 左方 / 右方 on the scoreboard and its score keys. Violet / cyan since D-2292: the old blue was
     the very value of --run and the orange sat next to --review, so a side read as a status. */
  --side-a:#a493f2;--side-b:#48bccf}

/* ── 2 · Colour roles and elevation: light ─────────────────────────────
   The same ladder on near-white (D-1484): page #fafaf8, panels white; lines and fills are ink #141413 (rgb 20 20 19)
   at an alpha, text is a notch lighter since D-1798 — --text #2A2A29 (13.7:1, was 17.6; Notion's body text is
   #2C2C2B at 14) and --soft #4B4B4A (8.4, was 10.2) — muted / faint unchanged; a card is a
   4% fill, not a grey layer, so the old grey page → white panel → grey card steps are gone. Text tiers on the
   panel: soft #4B4B4A (8.8, D-1798) · muted 68% · faint 52% — 6.4 · 3.7:1. Status colours are deeper bases for white,
   tint 10%, edge 25%. Brand yellow stays the fill; as a thin line or text on white it is deepened
   (--brand-line). .light-zone shows a region in light inside a dark page (used by /design). */
:root[data-theme=light],.light-zone{color-scheme:light;
  --bg:#fafaf8;--side:#f4f4f1;--panel:#ffffff;
  --raised:rgba(20,20,19,.04);--hover:rgba(20,20,19,.08);--chip:rgba(20,20,19,.05);--well:rgba(20,20,19,.03);
  --line:rgba(20,20,19,.13);--field-line:rgba(20,20,19,.20);--line-strong:rgba(20,20,19,.28);--line-hover:rgba(20,20,19,.38);
  --now-row:#f2f5ff;--edge:#eef0f6;
  --selected:#ffffff;--selected-lift:0 0 0 1px var(--line-strong),0 1px 2px var(--shadow);
  --skel-a:rgba(20,20,19,.06);--skel-b:rgba(20,20,19,.03);--disabled-bg:rgba(20,20,19,.05);--disabled-text:#a6a6a5;--drop-over:#fff8d6;
  
  /* 选择类控件的下拉箭头（D-1804）：图标库 chevron 同一画法、--soft 色；select 不能放子元素也不认 currentColor，只能用背景图，深浅各一份 */
  --icon-chevron-down:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B4B4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");--icon-chevron-up:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B4B4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
  --text:#2A2A29;--soft:#4B4B4A;--muted:#5f5f5f;--faint:#858584;
  --brand:#FFCC00;--brand-ink:#141413;--brand-line:#d9a400;
  --focus-ring-color:var(--brand-line);--focus-ring:var(--focus-ring-width) solid var(--focus-ring-color);
  --run:#3d6fd6;--run-bg:rgba(61,111,214,.10);--run-text:#2a56b0;--run-glow:rgba(61,111,214,.15);
  --review:#b45c1f;--review-bg:rgba(180,92,31,.10);--review-text:#964812;--review-card:rgba(180,92,31,.05);--review-line:rgba(180,92,31,.25);
  --ok:#2f8455;--ok-bg:rgba(47,132,85,.10);--ok-line:rgba(47,132,85,.25);--ok-text:#1d6b46;
  --bad:#c9474f;--bad-bg:rgba(201,71,79,.10);--bad-text:#a8323a;--bad-line:rgba(201,71,79,.25);--bad-card:rgba(201,71,79,.05);
  --shadow:rgba(20,20,20,.12);--shadow-strong:rgba(20,20,20,.18);--backdrop:rgba(20,20,20,.35);--pointer-line:rgba(20,20,19,.3);--played:rgba(255,204,0,.12);
  --selection:rgba(255,204,0,.35);--edge-highlight:rgba(20,20,19,.06);
  --popover:#ffffff;
  --card:#ffffff;--card-hover:#fdfdfc;--card-line:rgba(20,20,19,.13);
  --control:#ffffff;--control-hover:#f4f4f1;--control-line:rgba(20,20,19,.20);--control-shadow:0 1px 2px rgba(20,20,20,.12);
  --elevation-raised:0 2px 12px var(--shadow);--elevation-popover:0 12px 32px var(--shadow);--elevation-dialog:0 20px 48px var(--shadow-strong);--elevation-drawer:-18px 0 48px var(--shadow-strong);--elevation-sheet:0 -10px 30px var(--shadow);
  --role-material:#1e6b87;--role-mark:#905424;--role-proof:#724db7;--role-compose:#9e3d86;--role-publish:#196f62;--role-trim:#586a1f;--on-color:#ffffff;
  --role-material-bg:rgba(30,107,135,.10);--role-material-line:rgba(30,107,135,.25);--role-mark-bg:rgba(144,84,36,.10);--role-mark-line:rgba(144,84,36,.25);
  --role-proof-bg:rgba(114,77,183,.10);--role-proof-line:rgba(114,77,183,.25);--role-compose-bg:rgba(158,61,134,.10);--role-compose-line:rgba(158,61,134,.25);
  --role-publish-bg:rgba(25,111,98,.10);--role-publish-line:rgba(25,111,98,.25);--role-trim-bg:rgba(88,106,31,.10);--role-trim-line:rgba(88,106,31,.25);
  --state-hover:rgba(20,20,19,.05);--state-press:rgba(20,20,19,.09);--side-a:#5d43c6;--side-b:#0a6878}
:root[data-theme=light] .dark-zone{color-scheme:dark}
