/* Generated by tokens/build.mjs from tokens/src/*.json. Do not edit. */
/* Foundations -> semantic roles -> component contracts. */
:root {
  /* foundations */
  --teal-950: #0a2e2e;
  --teal-900: #0d4040;
  --teal-800: #006b6b;
  --teal-700: #007c7c;
  --teal-600: #008f8f;
  --teal-500: #00a3a3;
  --teal-400: #3ab8b6;
  --teal-300: #62c8c6;
  --teal-200: #b5e6e4;
  --teal-100: #e0f2f1;
  --teal-50: #f2fafa;
  --green-950: #12301b;
  --green-700: #1e7a34;
  --green-300: #75d18a;
  --green-100: #ddf3e2;
  --forest-950: #112e27;
  --forest-900: #173d33;
  --forest-800: #1d5545;
  --forest-700: #25634f;
  --forest-300: #86c7a8;
  --forest-200: #a9dcc2;
  --forest-100: #e7f0e9;
  --forest-50: #f1f6f2;
  --lime-300: #c2d8a4;
  --lime-400: #c6f24e;
  --lime-500: #a9d15b;
  --mint-300: #7fd1a6;
  --ink-950: #121214;
  --ink-900: #1c1c1e;
  --ink-800: #2c2c2e;
  --ink-700: #38383a;
  --ink-600: #48484a;
  --mist-50: #f5f5f7;
  --mist-300: #c7c7cc;
  --mist-400: #98989d;
  --neutral-950: #1d1d1f;
  --neutral-700: #48484a;
  --neutral-600: #636366;
  --neutral-500: #86868b;
  --neutral-300: #c7c7cc;
  --neutral-200: #e3e3e8;
  --neutral-100: #efeff3;
  --neutral-50: #f5f5f7;
  --white: #ffffff;
  --red-800: #6e3030;
  --red-700: #a33332;
  --red-300: #f1a7a2;
  --red-100: #f5d8d4;
  --red-50: #fff3f1;
  --red-900: #3b1d1c;
  --sand-900: #33281a;
  --sand-700: #826429;
  --sand-300: #e2c27f;
  --sand-100: #f3eddd;
  --forest-400: #72b895;
  --ink-500: #636366;
  --neutral-150: #e8e8ed;
  --font-body: 'HarmonyOS Sans SC', 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-display: 'HarmonyOS Sans SC', 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.125rem;
  --text-hero: clamp(2.125rem, 3.6vw, 3.5rem);
  --text-workspace-title: clamp(1.75rem, 2.7vw, 2.125rem);
  --tracking-tight: -0.01em;
  --tracking-label: 0.04em;
  --tracking-eyebrow: 0.08em;
  --tracking-brand: 0.12em;
  --tracking-cjk: 0em;
  --tracking-latin-display: -0.02em;
  --leading-tight: 1.35;
  --leading-compact: 1.4286;
  --leading-base: 1.5715;
  --line-xs: 1rem;
  --line-sm: 1.25rem;
  --line-control: 1.25rem;
  --line-base: 1.375rem;
  --line-md: 1.5rem;
  --line-lg: 1.625rem;
  --line-xl: 1.875rem;
  --line-2xl: 2.25rem;
  --line-3xl: 2.5rem;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-0-5: 0.125rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 999px;
  --radius-xs: 0.25rem;
  --radius-2xl: 1.5rem;
  --shadow-card: 0 2px 10px #0000001a;
  --shadow-raised: 0 8px 30px #00000029;
  --shadow-dialog: 0 24px 70px #00000047;
  --shadow-control: 0 1px 2px #0000001a;
  --shadow-glass: 0 10px 36px #0000001f;
  --shadow-float: 0 16px 48px #00000029;
  --duration-instant: 100ms;
  --duration-fast: 160ms;
  --duration-base: 240ms;
  --duration-slow: 360ms;
  --duration-stagger: 40ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-emphasized: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-spring-smooth: linear(0, 0.0264, 0.0898, 0.1726, 0.2633, 0.3542, 0.4408, 0.5207, 0.5925, 0.656, 0.7113, 0.759, 0.7997, 0.8341, 0.8631, 0.8874, 0.9076, 0.9244, 0.9383, 0.9497, 0.9591, 0.9668, 0.9731, 0.9782, 0.9824, 0.9858, 0.9886, 0.9908, 0.9926, 0.994, 0.9952, 0.9962, 0.9969, 0.9975, 1);
  --duration-spring-smooth: 567ms;
  --ease-spring-snappy: linear(0, 0.0445, 0.1478, 0.2764, 0.409, 0.5332, 0.6423, 0.7341, 0.8083, 0.8665, 0.9107, 0.9433, 0.9666, 0.9827, 0.9933, 1, 1.0038, 1.0057, 1.0063, 1.0061, 1.0055, 1.0047, 1.0039, 1.0031, 1.0024, 1);
  --duration-spring-snappy: 417ms;
  --ease-spring-bouncy: linear(0, 0.0232, 0.0829, 0.1663, 0.263, 0.3651, 0.4666, 0.5632, 0.6521, 0.7314, 0.8003, 0.8588, 0.9071, 0.946, 0.9765, 0.9994, 1.016, 1.0272, 1.0341, 1.0376, 1.0384, 1.0373, 1.0349, 1.0316, 1.0279, 1.0239, 1.02, 1.0164, 1.013, 1.01, 1.0074, 1.0052, 1.0034, 1);
  --duration-spring-bouncy: 550ms;
  --material-saturate: 180%;
  --motion-press-scale: 0.97;
  --motion-shift: 0.5rem;
  --motion-pop-scale: 0.92;
  --motion-travel: 1;
  --blur-chrome: 24px;
  --blur-popup: 32px;
  --blur-overlay: 4px;
  --z-navigation: 10;
  --z-feedback: 30;
  --z-overlay: 40;
  --z-popover: 50;
  --z-toast: 60;
  /* semantic */
  --color-bg: var(--neutral-50);
  --color-surface: var(--white);
  --color-surface-subtle: var(--neutral-100);
  --color-text: var(--neutral-950);
  --color-text-secondary: var(--neutral-700);
  --color-text-muted: var(--neutral-600);
  --color-border: var(--neutral-200);
  --color-border-hover: var(--neutral-300);
  --color-control-border: var(--neutral-500);
  --color-brand: var(--teal-700);
  --color-brand-text: var(--teal-800);
  --color-brand-hover: var(--teal-800);
  --color-brand-subtle: var(--teal-100);
  --color-brand-accent: var(--lime-500);
  --color-logo-body: var(--teal-700);
  --color-focus: var(--teal-700);
  --color-on-brand: var(--white);
  --color-danger: var(--red-700);
  --color-danger-hover: var(--red-800);
  --color-danger-subtle: var(--red-50);
  --color-danger-border: var(--red-100);
  --color-success: var(--green-700);
  --color-success-subtle: var(--green-100);
  --color-warning: var(--sand-700);
  --color-warning-subtle: var(--sand-100);
  --color-sidebar: var(--teal-950);
  --color-sidebar-active: var(--teal-700);
  --color-sidebar-divider: var(--teal-800);
  --color-sidebar-accent: var(--lime-300);
  --color-sidebar-text: #c4d3d3;
  --color-sidebar-text-active: var(--white);
  --color-sidebar-muted: #98b4b4;
  --color-backdrop: #1d1d1f4d;
  --color-brand-active: var(--teal-900);
  --color-fill-hover: #0000000d;
  --color-fill-pressed: #0000001a;
  --color-selected: var(--teal-700);
  --color-on-selected: var(--white);
  --color-highlight: var(--sand-100);
  --color-focus-halo: #007c7c33;
  --color-chrome: var(--neutral-50);
  --color-chrome-glass: #f5f5f7c7;
  --color-popup-glass: #fdfdfeed;
  --color-segment: var(--neutral-150);
  --color-segment-active: var(--white);
  --color-backdrop-solid: #1d1d1f99;
  --color-glass-edge: #0000001a;
  --color-glass-highlight: #ffffffcc;
  --color-glass-shade: #00000012;
  --color-skeleton: #00000016;
  --color-skeleton-highlight: #ffffff80;
  --color-skeleton-inverse: #ffffff1a;
  --color-skeleton-inverse-highlight: #ffffff14;
  /* components */
  --sidebar-width: 15rem;
  --header-height: 3.5rem;
  --content-width: 76rem;
  --form-width: 40rem;
  --entity-picker-results-height: min(22rem, 45dvh);
  --page-gutter: clamp(1rem, 3vw, 2rem);
  --control-height: 2.25rem;
  --control-height-lg: 2.5rem;
  --hit-target: 44px;
  --row-height: 2.75rem;
  --control-radius: var(--radius-md);
  --card-radius: var(--radius-lg);
  --card-padding: var(--space-5);
  --icon-size: 1rem;
  --control-height-sm: 1.75rem;
  --row-height-two-line: 3.5rem;
  --cell-max-width: 24rem;
  --launcher-icon: 2.5rem;
  --head-height: 2.25rem;
  --popup-radius: 0.875rem;
  --dialog-radius: var(--radius-2xl);
  --popup-padding: 0.375rem;
  --sidebar-radius: var(--radius-lg);
  --sidebar-padding: var(--space-2);
  --sidebar-inset: var(--space-2);
  --bar-radius: var(--radius-full);
  --concentric-min: var(--radius-xs);
  --gap-title-text: var(--space-1);
  --gap-label: var(--space-1);
  --gap-display-text: var(--space-2);
  --gap-inline: var(--space-2);
  --gap-choice: var(--space-1);
  --gap-head-content: var(--space-3);
  --gap-field: var(--space-4);
  --gap-card-head: var(--space-4);
  --gap-block: var(--space-6);
  --gap-section: var(--space-8);
  --field-width-xs: 5rem;
  --field-width-sm: 11rem;
  --field-width-md: 15rem;
  --field-width-lg: 22.5rem;
  --form-nav-width: 12rem;
  --entry-width: 25rem;
  --grid-min-sm: 14rem;
  --grid-min-md: 18rem;
  --grid-min-lg: 22rem;
  --focus-ring: 2px solid var(--color-focus);
  --focus-room: 4px;
  --oklch-teal-950: var(--teal-950);
  --oklch-teal-900: var(--teal-900);
  --oklch-teal-800: var(--teal-800);
  --oklch-teal-700: var(--teal-700);
  --oklch-teal-600: var(--teal-600);
  --oklch-teal-500: var(--teal-500);
  --oklch-teal-400: var(--teal-400);
  --oklch-teal-300: var(--teal-300);
  --oklch-teal-200: var(--teal-200);
  --oklch-teal-100: var(--teal-100);
  --oklch-teal-50: var(--teal-50);
  --oklch-green-950: var(--green-950);
  --oklch-green-700: var(--green-700);
  --oklch-green-300: var(--green-300);
  --oklch-green-100: var(--green-100);
  --oklch-forest-950: var(--forest-950);
  --oklch-forest-900: var(--forest-900);
  --oklch-forest-800: var(--forest-800);
  --oklch-forest-700: var(--forest-700);
  --oklch-forest-300: var(--forest-300);
  --oklch-forest-200: var(--forest-200);
  --oklch-forest-100: var(--forest-100);
  --oklch-forest-50: var(--forest-50);
  --oklch-lime-300: var(--lime-300);
  --oklch-lime-400: var(--lime-400);
  --oklch-lime-500: var(--lime-500);
  --oklch-mint-300: var(--mint-300);
  --oklch-ink-950: var(--ink-950);
  --oklch-ink-900: var(--ink-900);
  --oklch-ink-800: var(--ink-800);
  --oklch-ink-700: var(--ink-700);
  --oklch-ink-600: var(--ink-600);
  --oklch-mist-50: var(--mist-50);
  --oklch-mist-300: var(--mist-300);
  --oklch-mist-400: var(--mist-400);
  --oklch-neutral-950: var(--neutral-950);
  --oklch-neutral-700: var(--neutral-700);
  --oklch-neutral-600: var(--neutral-600);
  --oklch-neutral-500: var(--neutral-500);
  --oklch-neutral-300: var(--neutral-300);
  --oklch-neutral-200: var(--neutral-200);
  --oklch-neutral-100: var(--neutral-100);
  --oklch-neutral-50: var(--neutral-50);
  --oklch-white: var(--white);
  --oklch-red-800: var(--red-800);
  --oklch-red-700: var(--red-700);
  --oklch-red-300: var(--red-300);
  --oklch-red-100: var(--red-100);
  --oklch-red-50: var(--red-50);
  --oklch-red-900: var(--red-900);
  --oklch-sand-900: var(--sand-900);
  --oklch-sand-700: var(--sand-700);
  --oklch-sand-300: var(--sand-300);
  --oklch-sand-100: var(--sand-100);
  --oklch-forest-400: var(--forest-400);
  --oklch-ink-500: var(--ink-500);
  --oklch-neutral-150: var(--neutral-150);
  --oklch-color-bg: var(--color-bg);
  --oklch-color-surface: var(--color-surface);
  --oklch-color-surface-subtle: var(--color-surface-subtle);
  --oklch-color-text: var(--color-text);
  --oklch-color-text-secondary: var(--color-text-secondary);
  --oklch-color-text-muted: var(--color-text-muted);
  --oklch-color-border: var(--color-border);
  --oklch-color-border-hover: var(--color-border-hover);
  --oklch-color-control-border: var(--color-control-border);
  --oklch-color-brand: var(--color-brand);
  --oklch-color-brand-text: var(--color-brand-text);
  --oklch-color-brand-hover: var(--color-brand-hover);
  --oklch-color-brand-subtle: var(--color-brand-subtle);
  --oklch-color-brand-accent: var(--color-brand-accent);
  --oklch-color-logo-body: var(--color-logo-body);
  --oklch-color-focus: var(--color-focus);
  --oklch-color-on-brand: var(--color-on-brand);
  --oklch-color-danger: var(--color-danger);
  --oklch-color-danger-hover: var(--color-danger-hover);
  --oklch-color-danger-subtle: var(--color-danger-subtle);
  --oklch-color-danger-border: var(--color-danger-border);
  --oklch-color-success: var(--color-success);
  --oklch-color-success-subtle: var(--color-success-subtle);
  --oklch-color-warning: var(--color-warning);
  --oklch-color-warning-subtle: var(--color-warning-subtle);
  --oklch-color-sidebar: var(--color-sidebar);
  --oklch-color-sidebar-active: var(--color-sidebar-active);
  --oklch-color-sidebar-divider: var(--color-sidebar-divider);
  --oklch-color-sidebar-accent: var(--color-sidebar-accent);
  --oklch-color-sidebar-text: var(--color-sidebar-text);
  --oklch-color-sidebar-text-active: var(--color-sidebar-text-active);
  --oklch-color-sidebar-muted: var(--color-sidebar-muted);
  --oklch-color-backdrop: var(--color-backdrop);
  --oklch-color-brand-active: var(--color-brand-active);
  --oklch-color-fill-hover: var(--color-fill-hover);
  --oklch-color-fill-pressed: var(--color-fill-pressed);
  --oklch-color-selected: var(--color-selected);
  --oklch-color-on-selected: var(--color-on-selected);
  --oklch-color-highlight: var(--color-highlight);
  --oklch-color-focus-halo: var(--color-focus-halo);
  --oklch-color-chrome: var(--color-chrome);
  --oklch-color-chrome-glass: var(--color-chrome-glass);
  --oklch-color-popup-glass: var(--color-popup-glass);
  --oklch-color-segment: var(--color-segment);
  --oklch-color-segment-active: var(--color-segment-active);
  --oklch-color-backdrop-solid: var(--color-backdrop-solid);
  --oklch-color-glass-edge: var(--color-glass-edge);
  --oklch-color-glass-highlight: var(--color-glass-highlight);
  --oklch-color-glass-shade: var(--color-glass-shade);
  --oklch-color-skeleton: var(--color-skeleton);
  --oklch-color-skeleton-highlight: var(--color-skeleton-highlight);
  --oklch-color-skeleton-inverse: var(--color-skeleton-inverse);
  --oklch-color-skeleton-inverse-highlight: var(--color-skeleton-inverse-highlight);
}

@supports (color: oklch(0 0 0)) {
  :root:not([data-platform-fallback]) {
    --oklch-teal-950: oklch(0.27620886 0.03994057 195.08932387);
    --oklch-teal-900: oklch(0.33943070 0.05159248 194.99713249);
    --oklch-teal-800: oklch(0.47786595 0.08157085 194.76894793);
    --oklch-teal-700: oklch(0.53085048 0.09061522 194.76894793);
    --oklch-teal-600: oklch(0.58854686 0.10046389 194.76894793);
    --oklch-teal-500: oklch(0.64778918 0.11057644 194.76894793);
    --oklch-teal-400: oklch(0.71515957 0.10737282 193.47022213);
    --oklch-teal-300: oklch(0.77160599 0.09518460 193.64784245);
    --oklch-teal-200: oklch(0.89030926 0.05044187 193.18157815);
    --oklch-teal-100: oklch(0.94757104 0.01902896 192.80946595);
    --oklch-teal-50: oklch(0.97911322 0.00846083 197.01804269);
    --oklch-green-950: oklch(0.27935345 0.05293047 151.36120375);
    --oklch-green-700: oklch(0.51057500 0.13495729 147.28931355);
    --oklch-green-300: oklch(0.78523749 0.13427329 149.78929173);
    --oklch-green-100: oklch(0.94332832 0.03237368 152.44822136);
    --oklch-forest-950: oklch(0.27629295 0.03753308 175.42535379);
    --oklch-forest-900: oklch(0.32902906 0.04709747 173.51992007);
    --oklch-forest-800: oklch(0.40765231 0.06467767 171.03234857);
    --oklch-forest-700: oklch(0.45329587 0.07210419 168.75801021);
    --oklch-forest-300: oklch(0.77708315 0.08013987 163.17058629);
    --oklch-forest-200: oklch(0.85167482 0.06402452 162.50643048);
    --oklch-forest-100: oklch(0.94640524 0.01332214 152.59828624);
    --oklch-forest-50: oklch(0.96825319 0.00746857 151.88964666);
    --oklch-lime-300: oklch(0.85259170 0.07352091 126.54297075);
    --oklch-lime-400: oklch(0.90045985 0.19127872 123.30148431);
    --oklch-lime-500: oklch(0.80755122 0.15263886 125.34295735);
    --oklch-mint-300: oklch(0.79622615 0.10194542 160.00444167);
    --oklch-ink-950: oklch(0.18308828 0.00404021 285.99396077);
    --oklch-ink-900: oklch(0.22728011 0.00382337 286.09161168);
    --oklch-ink-800: oklch(0.29390059 0.00358161 286.17729078);
    --oklch-ink-700: oklch(0.34143797 0.00344814 286.21568328);
    --oklch-ink-600: oklch(0.40237522 0.00330792 286.25012056);
    --oklch-mist-50: oklch(0.97071377 0.00265048 286.35036064);
    --oklch-mist-300: oklch(0.83115757 0.00689828 286.24868072);
    --oklch-mist-400: oklch(0.68124036 0.00725413 286.20558823);
    --oklch-neutral-950: oklch(0.23157626 0.00380518 286.09885378);
    --oklch-neutral-700: oklch(0.40237522 0.00330792 286.25012056);
    --oklch-neutral-600: oklch(0.50070420 0.00469930 286.22877824);
    --oklch-neutral-500: oklch(0.62166023 0.00742430 286.18178006);
    --oklch-neutral-300: oklch(0.83115757 0.00689828 286.24868072);
    --oklch-neutral-200: oklch(0.91727106 0.00672873 286.26632605);
    --oklch-neutral-100: oklch(0.95326788 0.00532906 286.29821518);
    --oklch-neutral-50: oklch(0.97071377 0.00265048 286.35036064);
    --oklch-white: oklch(0.99999999 0.00000004 89.87556310);
    --oklch-red-800: oklch(0.39413147 0.08855211 21.95582521);
    --oklch-red-700: oklch(0.48775744 0.14791028 24.91508448);
    --oklch-red-300: oklch(0.79823903 0.08840701 23.53428581);
    --oklch-red-100: oklch(0.90512265 0.03286697 27.11010695);
    --oklch-red-50: oklch(0.97297346 0.01324594 28.86467357);
    --oklch-red-900: oklch(0.27203280 0.04724379 22.65987431);
    --oklch-sand-900: oklch(0.28525163 0.02887443 72.96104019);
    --oklch-sand-700: oklch(0.52148896 0.08535157 81.72517093);
    --oklch-sand-300: oklch(0.82666389 0.09273689 84.95234560);
    --oklch-sand-100: oklch(0.94647351 0.02216073 89.79400712);
    --oklch-forest-400: oklch(0.72622673 0.08795024 161.38355250);
    --oklch-ink-500: oklch(0.50070420 0.00469930 286.22877824);
    --oklch-neutral-150: oklch(0.93243246 0.00670095 286.26905241);
    --oklch-color-bg: var(--oklch-neutral-50);
    --oklch-color-surface: var(--oklch-white);
    --oklch-color-surface-subtle: var(--oklch-neutral-100);
    --oklch-color-text: var(--oklch-neutral-950);
    --oklch-color-text-secondary: var(--oklch-neutral-700);
    --oklch-color-text-muted: var(--oklch-neutral-600);
    --oklch-color-border: var(--oklch-neutral-200);
    --oklch-color-border-hover: var(--oklch-neutral-300);
    --oklch-color-control-border: var(--oklch-neutral-500);
    --oklch-color-brand: var(--oklch-teal-700);
    --oklch-color-brand-text: var(--oklch-teal-800);
    --oklch-color-brand-hover: var(--oklch-teal-800);
    --oklch-color-brand-subtle: var(--oklch-teal-100);
    --oklch-color-brand-accent: var(--oklch-lime-500);
    --oklch-color-logo-body: var(--oklch-teal-700);
    --oklch-color-focus: var(--oklch-teal-700);
    --oklch-color-on-brand: var(--oklch-white);
    --oklch-color-danger: var(--oklch-red-700);
    --oklch-color-danger-hover: var(--oklch-red-800);
    --oklch-color-danger-subtle: var(--oklch-red-50);
    --oklch-color-danger-border: var(--oklch-red-100);
    --oklch-color-success: var(--oklch-green-700);
    --oklch-color-success-subtle: var(--oklch-green-100);
    --oklch-color-warning: var(--oklch-sand-700);
    --oklch-color-warning-subtle: var(--oklch-sand-100);
    --oklch-color-sidebar: var(--oklch-teal-950);
    --oklch-color-sidebar-active: var(--oklch-teal-700);
    --oklch-color-sidebar-divider: var(--oklch-teal-800);
    --oklch-color-sidebar-accent: var(--oklch-lime-300);
    --oklch-color-sidebar-text: oklch(0.85547492 0.01625231 196.85338230);
    --oklch-color-sidebar-text-active: var(--oklch-white);
    --oklch-color-sidebar-muted: oklch(0.74891534 0.03064132 196.51550550);
    --oklch-color-backdrop: oklch(0.23157626 0.00380518 286.09885378 / 0.30196078);
    --oklch-color-brand-active: var(--oklch-teal-900);
    --oklch-color-fill-hover: oklch(0.00000000 0.00000000 0.00000000 / 0.05098039);
    --oklch-color-fill-pressed: oklch(0.00000000 0.00000000 0.00000000 / 0.10196078);
    --oklch-color-selected: var(--oklch-teal-700);
    --oklch-color-on-selected: var(--oklch-white);
    --oklch-color-highlight: var(--oklch-sand-100);
    --oklch-color-focus-halo: oklch(0.53085048 0.09061522 194.76894793 / 0.20000000);
    --oklch-color-chrome: var(--oklch-neutral-50);
    --oklch-color-chrome-glass: oklch(0.97071377 0.00265048 286.35036064 / 0.78039216);
    --oklch-color-popup-glass: oklch(0.99432725 0.00131678 286.37609806 / 0.92941176);
    --oklch-color-segment: var(--oklch-neutral-150);
    --oklch-color-segment-active: var(--oklch-white);
    --oklch-color-backdrop-solid: oklch(0.23157626 0.00380518 286.09885378 / 0.60000000);
    --oklch-color-glass-edge: oklch(0.00000000 0.00000000 0.00000000 / 0.10196078);
    --oklch-color-glass-highlight: oklch(0.99999999 0.00000004 89.87556310 / 0.80000000);
    --oklch-color-glass-shade: oklch(0.00000000 0.00000000 0.00000000 / 0.07058824);
    --oklch-color-skeleton: oklch(0.00000000 0.00000000 0.00000000 / 0.08627451);
    --oklch-color-skeleton-highlight: oklch(0.99999999 0.00000004 89.87556310 / 0.50196078);
    --oklch-color-skeleton-inverse: oklch(0.99999999 0.00000004 89.87556310 / 0.10196078);
    --oklch-color-skeleton-inverse-highlight: oklch(0.99999999 0.00000004 89.87556310 / 0.07843137);
  }
}

/*
 * @catalytic/app-kit design system, part 1: base. Classes are prefixed `yh-`; state is carried by data-* and
 * aria-* attributes. Colour, type, spacing and shape come from design tokens only; structural values
 * (1px borders, percentages, breakpoints) are written directly. styles.css = tokens.css + the parts in
 * styles/ (base, controls, data, overlay, layout), in that order.
 */

/* The browser's 8px margin on the page would put the header and the sidebar off the window's edge. Zero specificity: an app that sets its own body margin wins without a fight. */
:where(body) {
  margin: 0;
}

:root {
  /* One control size for every form control: 36px with a mouse, 44px on touch screens. */
  --yh-control: var(--control-height);
  --yh-control-lg: var(--control-height-lg);
  /* The small size, for buttons inside table rows: 28px with a mouse. */
  --yh-control-sm: var(--control-height-sm);
  /*
   * Where the text of a box starts, from its outer edge: inside the 1px edge, --space-3 (13px). A bordered box (Input,
   * Textarea, Select, Combobox) gets it from its 1px border and --space-3 of padding; an input group, whose edge is an
   * inset shadow, pads its input and text affixes by this value. So a plain Input stacked above an input group starts
   * its text at the same x (gallery/forms.mjs, inset).
   */
  --yh-control-inset: calc(1px + var(--space-3));
}

/*
 * Scrollbars, as close to Apple's as a web page on Windows gets. The browser draws them and cannot be replaced; what
 * a page can set is the width (thin) and the colours (scrollbar-width / scrollbar-color, Edge and Chrome 121+, Firefox,
 * Safari 18.2+). The window's own scrollbar is thin with a faint thumb on a clear track, so the position on the page
 * is always readable. A scroll area inside the page (a panel, a list, a sheet) shows its thumb only while the pointer
 * is over it or the focus is in it, like an overlay scrollbar. Limits: on Windows a thin scrollbar still takes about
 * 11px of width (there are no overlay scrollbars for web pages) and the browser decides about the arrow buttons; on
 * macOS and phones the system's overlay scrollbars apply anyway.
 */
:root {
  --yh-scrollbar-thumb: color-mix(in srgb, var(--color-text) 24%, transparent);
  scrollbar-width: thin;
  scrollbar-color: var(--yh-scrollbar-thumb) transparent;
  /*
   * The window's scrollbar always has its place, also on a page too short to scroll. Without it a long page was 11px
   * narrower than a short one on Windows, and the centred column, the header and the search moved sideways on every
   * page change. While a dialog locks the page the place becomes padding of the same width (useScrollLock), so the
   * scrim and the dialog take the whole window.
   */
  scrollbar-gutter: stable;
}

/*
 * The window behind the page has the page's colour (light and dark), so the kept scrollbar place on a short page and the
 * track beside a long one are not a white strip at the right edge. :where() keeps it overridable by an app's html rule.
 */
:where(:root) {
  background-color: var(--color-bg);
}

/*
 * The place is already kept (scrollbar-gutter above). Radix's scroll lock (Select, modal menus and popovers, through
 * react-remove-scroll) adds the scrollbar's width to the body's right margin again while it is open, which pushed the
 * whole page 11px to the left behind an open Select.
 */
html body[data-scroll-locked] {
  margin-right: 0 !important;
  --removed-body-scroll-bar-size: 0px;
}

:is(.yh-root, .yh-shell, .yh-entry, .yh-popup) * {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

:is(.yh-root, .yh-shell, .yh-entry, .yh-popup) :is(*:hover, *:focus-within) {
  scrollbar-color: var(--yh-scrollbar-thumb) transparent;
}

/*
 * Text fields on a touch screen are 16px: iOS zooms the whole page into a field whose text is smaller when it gets the
 * focus. The line stays 22px; the control is 44px there anyway. A mouse keeps the 14px density. What is written beside
 * the text in the same box (a prefix or suffix, the drawing of 1.2×10⁻³, a unit button) grows with it and stays on its
 * baseline.
 */
@media (pointer: coarse) {
  :root :is(.yh-input, .yh-textarea, .yh-combobox-input, .yh-search input, .yh-tree-search .yh-input, .yh-input-affix[data-text], .yh-number-display, .yh-number-unit) {
    font-size: var(--text-md);
    line-height: var(--line-base);
  }
}

@media (pointer: coarse) {
  :root {
    --yh-control: var(--hit-target);
    --yh-control-lg: var(--hit-target);
    --yh-control-sm: var(--hit-target);
  }
}

.yh-root,
.yh-shell,
.yh-entry {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-base);
  color: var(--color-text);
  /* Digits of equal width everywhere (columns, counts, times line up); CJK text needs no tracking, so none is set. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: var(--tracking-cjk);
}

/* The selection is the focus halo, so it follows the brand in both themes. */
:is(.yh-root, .yh-shell, .yh-entry, .yh-popup) ::selection {
  background: var(--color-focus-halo);
}

/* A box that scrolls never stops a focused control flush at its edge, where it would cut the ring: scrolling to the focus
 * (Tab, scrollIntoView) keeps --focus-room free. Inside :where() it weighs nothing, so a box that needs more room
 * (under a sticky head, beside a fade) sets its own. It covers the apps' own scroll boxes too. */
:where(.yh-root, .yh-shell, .yh-entry, .yh-popup),
:where(.yh-root, .yh-shell, .yh-entry, .yh-popup) :where(*) {
  scroll-padding: var(--focus-room);
}

.yh-root *:focus-visible,
.yh-shell *:focus-visible,
.yh-entry *:focus-visible,
.yh-popup:focus-visible,
.yh-popup *:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.yh-link {
  color: var(--color-brand-text);
  text-decoration: none;
  cursor: pointer;
}

.yh-link:hover {
  text-decoration: underline;
}

.yh-muted {
  color: var(--color-text-muted);
}

.yh-secondary {
  color: var(--color-text-secondary);
}

.yh-small {
  font-size: var(--text-sm);
}

/*
 * A monospace identifier (a key prefix, a hash, a client id), in a table or in running text, is set 0.88 of the text
 * around it and a little lighter: the monospace faces (SF Mono, Cascadia Code) have a 15% larger x-height and about 60%
 * more ink than HarmonyOS Sans, so at the same size an id reads larger and darker than the Chinese beside it. Measured
 * on Windows: Cascadia Code x-height 0.52em against 0.45em, so 0.88em matches it; weight 350 takes the Light face where
 * there is one and the regular one elsewhere. Same baseline (inline text). Inline, its own line box is 1: a second font
 * with other ascent and descent on the parent's 22px line made the line 23px; now the line keeps the height of its row.
 */
.yh-mono {
  --yh-mono-scale: 0.88;
  font-family: var(--font-mono);
  font-size: calc(var(--yh-mono-scale) * 1em);
  font-weight: 350;
}

:is(span, code, kbd, samp, a, strong, em).yh-mono {
  line-height: 1;
}

/*
 * Spacing ownership (docs/design-system-css.md, "间距所有权"). A component has no outer margin of its own: the distance
 * between two siblings is the gap of their parent, and the gap is chosen by the relation of the two (--gap-*), not by
 * the component. So an optional part (a description, an action area, a badge) can come and go without moving
 * anything else. The structural pieces below are the parents: a stack, a row of buttons, a titled section.
 *
 *   --gap-title-text     4   a 16-18px title to its own description      --gap-display-text  8   a 20px+ title to its description
 *   --gap-label          4   label to control, control to help or error  --gap-choice        4   one checkbox or radio row to the next
 *   --gap-inline         8   button to button, badge to badge, in a row  --gap-head-content 12   a section's heading to its content
 *   --gap-field         16   field to field, block to block in a group   --gap-card-head    16   a card's head to its body
 *   --gap-block         24   blocks of a page: header, cards, tables     --gap-section      32   titled sections without a frame
 */
.yh-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
}

.yh-stack[data-gap='block'] {
  gap: var(--gap-block);
}

.yh-stack[data-gap='section'] {
  gap: var(--gap-section);
}

.yh-stack[data-gap='choice'] {
  gap: var(--gap-choice);
}

/*
 * Grid (docs/design-system-css.md 栅格): as many equal columns as fit, none narrower than --grid-min-* (md by default),
 * the rest of the width shared; gap by relation, block (cards of a page) by default or field (tiles in a card). One
 * column on a phone. A child never makes its column wider than its share (min-width: 0), so nothing scrolls sideways.
 */
.yh-grid {
  --yh-grid-min: var(--grid-min-md);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--yh-grid-min)), 1fr));
  gap: var(--gap-block);
}

.yh-grid[data-min='sm'] {
  --yh-grid-min: var(--grid-min-sm);
}

.yh-grid[data-min='lg'] {
  --yh-grid-min: var(--grid-min-lg);
}

.yh-grid[data-gap='field'] {
  gap: var(--gap-field);
}

.yh-grid > * {
  min-width: 0;
}

@media (max-width: 480px) {
  .yh-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The spacing of a page comes from the gaps of its containers, not from the browser's paragraph margins. */
:where(.yh-main, .yh-card, .yh-dialog, .yh-drawer, .yh-popup) :where(p, h1, h2, h3, h4, dl, dd, figure, ul, ol) {
  margin-block: 0;
}

.yh-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-inline);
}

/* A group of buttons: 8px apart, wrapping on a narrow screen; data-align="end" puts them at the right (dialog footers, page actions). */
.yh-button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-inline);
}

.yh-button-group[data-align='end'] {
  justify-content: flex-end;
}

/* A list of checkboxes or radios: one 36px row (the hit area) under the other, 4px apart. */
.yh-choice-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--gap-choice);
}

.yh-choice-group[data-orientation='horizontal'] {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--gap-choice) var(--space-5);
}

/*
 * A titled section: the head (heading and, at its right, optional actions), then the content, 12px below. The heading
 * is the title and an optional description 4px under it. With or without the description or the actions, the title
 * is 12px from the content: the gap belongs to the section, not to the parts. Sections follow each other at
 * --gap-section (a stack with data-gap="section", or the page). `.yh-page-section` is the older name of the same thing.
 */
.yh-section,
.yh-page-section {
  display: flex;
  flex-direction: column;
  gap: var(--gap-head-content);
  min-width: 0;
}

/* A section in a row of a grid: its card takes the rest of the height, so the bottoms of the row line up. An alert stays its own height. */
.yh-section[data-fill] > .yh-card,
.yh-grid[data-fill] > .yh-section > .yh-card {
  flex: 1 1 auto;
}

.yh-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-head-content) var(--gap-field);
}

.yh-section-heading {
  display: flex;
  flex: 1 1 16rem;
  flex-direction: column;
  gap: var(--gap-title-text);
  min-width: 0;
}

/* A title without a description is as wide as it is: it stays on one line with the actions, also on a phone. */
.yh-section-heading[data-title-only] {
  flex-basis: auto;
}

.yh-section-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-inline);
}

.yh-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.yh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.yh-section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: var(--line-md);
}

/*
 * Tracking by script: Chinese never gets any (the characters fill their square already). Latin titles of 22px and more
 * are set a little tighter, as SF Pro Display is: the rule follows the language of the page or of the element (lang="en").
 */
:is(.yh-page-title, .yh-entry-title, .yh-state-page h1):lang(en) {
  letter-spacing: var(--tracking-latin-display);
}

.yh-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: yh-spin 700ms linear infinite;
}

@keyframes yh-spin {
  to {
    transform: rotate(360deg);
  }
}

/*
 * Motion. One rule for reduced motion: the duration tokens collapse to 1ms (not 0, so animationend still fires and a
 * layer that waits for it is released at once), the stagger delay goes, and the distance and scale of every enter,
 * exit and press become none. Every transition and keyframe below is written with these tokens, so none needs its own
 * reduced-motion branch: a short move uses --motion-shift, a layer that slides in from an edge by its own size multiplies
 * that distance by --motion-travel. A distance outside the tokens would still show the start for the first frames of a
 * 1ms animation, and a test robot clicks a button there that then jumps away. The spinner is not motion of the interface but a sign that work is going on: it keeps turning,
 * slowly.
 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 1ms;
    --duration-fast: 1ms;
    --duration-base: 1ms;
    --duration-slow: 1ms;
    --duration-spring-smooth: 1ms;
    --duration-spring-snappy: 1ms;
    --duration-spring-bouncy: 1ms;
    --duration-stagger: 0ms;
    --motion-shift: 0rem;
    --motion-press-scale: 1;
    --motion-pop-scale: 1;
    --motion-travel: 0;
  }

  .yh-spinner,
  .yh-button[aria-busy='true']:not([data-refresh])::before {
    animation-duration: 2s;
  }
}

/* Shared keyframes: fade, and fade with a short move. The distance comes from --motion-shift, a layer can scale it (--yh-from-x / --yh-from-y). */
[data-motion-layout] { position: relative; }
:where(.yh-table-wrap, .yh-combobox-list, .yh-notification-feed, .yh-dialog-body, .yh-dialog-content, .yh-dialog-content .yh-form-scroll, .yh-confirm-scroll, .yh-drawer-body) {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-hover) transparent;
}
[data-motion-layout][data-motion-sizing] { overflow-x: visible; overflow-y: clip; align-content: start; }
/* Held at its height while a loading placeholder stands in for the content: the rows stay at their own size, the space is below. */
[data-motion-layout][data-motion-hold] { align-content: start; }

@keyframes yh-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes yh-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes yh-rise-in {
  from {
    opacity: 0;
    transform: translate(var(--yh-from-x, 0), var(--yh-from-y, var(--motion-shift)));
  }
}

@keyframes yh-rise-out {
  to {
    opacity: 0;
    transform: translate(var(--yh-from-x, 0), var(--yh-from-y, var(--motion-shift)));
  }
}

/* Part 2: form controls. Button, IconButton, Input, Textarea, Select, Checkbox, Radio, Switch, Field. */

/* ------------------------------------------------------------ button */

.yh-button,
.yh-icon-button {
  position: relative;
  display: inline-flex;
  /*
   * An inline-flex box takes its baseline from its first item, so a button that starts with an icon sat on the icon's
   * bottom edge while a neighbour with text only sat on the text baseline: beside each other in a line (a block parent)
   * the icon button rode 2px higher. Every button is centred on the line instead, whatever it starts with.
   */
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-height: var(--yh-control);
  /*
   * One box, drawn here only (docs/design-system-css.md 一个控件一个框): the variants and states below change the three
   * --yh-button-* properties, never border, background or box-shadow themselves. So a button that is a part of another
   * control (the button at the end of an input group) sets those three properties once and no state can draw its box back.
   */
  --yh-button-edge: var(--color-border-hover);
  --yh-button-fill: var(--color-surface);
  --yh-button-shadow: none;
  border: 1px solid var(--yh-button-edge);
  border-radius: var(--control-radius);
  background: var(--yh-button-fill);
  box-shadow: var(--yh-button-shadow);
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-medium);
  line-height: var(--line-control);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-spring-snappy) var(--ease-spring-snappy);
}

/* A plain button is a raised white key with a hairline and a whisper of shadow; the fills below are for hover and press. */
.yh-button {
  --yh-button-shadow: var(--shadow-control);
  padding: 0 var(--space-4);
}

/* Press feedback: a button gives a little under the finger or the mouse. The link variant is text and does not move. */
.yh-button:active:not(:disabled, [aria-disabled='true'], [data-variant='link']),
.yh-icon-button:active:not(:disabled, [aria-disabled='true']) {
  transform: scale(var(--motion-press-scale));
  /* Down at once (100ms), up again on the snappy spring (the transition above), so a click feels like a key. */
  transition-duration: var(--duration-instant);
  transition-timing-function: var(--ease-out);
}

.yh-icon-button {
  --yh-button-edge: transparent;
  --yh-button-fill: transparent;
  width: var(--yh-control);
  padding: 0;
}

.yh-button:hover {
  --yh-button-fill: var(--color-surface-subtle);
}

/* Pressed: the fill goes one step further than hover (the button also shrinks, below), so a click is felt before the result arrives. */
.yh-button:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-fill: var(--color-segment);
}

.yh-icon-button:hover,
.yh-icon-button[aria-expanded='true'] {
  --yh-button-fill: var(--color-fill-hover);
}

.yh-icon-button:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-fill: var(--color-fill-pressed);
}

.yh-button[data-variant='primary'] {
  --yh-button-edge: var(--color-brand);
  --yh-button-fill: var(--color-brand);
  color: var(--color-on-brand);
  --yh-button-shadow: none;
}

.yh-button[data-variant='primary']:hover {
  --yh-button-edge: var(--color-brand-hover);
  --yh-button-fill: var(--color-brand-hover);
}

.yh-button[data-variant='primary']:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-edge: var(--color-brand-active);
  --yh-button-fill: var(--color-brand-active);
}

.yh-button[data-variant='ghost'] {
  --yh-button-edge: transparent;
  --yh-button-fill: transparent;
  --yh-button-shadow: none;
}

.yh-button[data-variant='ghost']:hover {
  --yh-button-fill: var(--color-fill-hover);
}

.yh-button[data-variant='ghost']:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-fill: var(--color-fill-pressed);
}

.yh-button[data-variant='link'] {
  min-height: 0;
  padding: 0;
  border-width: 0;
  --yh-button-fill: transparent;
  --yh-button-shadow: none;
  color: var(--color-brand-text);
  font-weight: var(--weight-normal);
}

.yh-button[data-variant='link']:hover,
.yh-button[data-variant='link']:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-fill: transparent;
  text-decoration: underline;
}

.yh-button[data-variant='danger'] {
  --yh-button-edge: var(--color-danger);
  --yh-button-fill: var(--color-danger);
  color: var(--color-on-brand);
  --yh-button-shadow: none;
}

.yh-button[data-variant='danger']:hover,
.yh-button[data-variant='danger']:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-edge: var(--color-danger-hover);
  --yh-button-fill: var(--color-danger-hover);
}

.yh-button[data-variant='danger-outline'] {
  --yh-button-edge: var(--color-danger);
  color: var(--color-danger);
}

.yh-button[data-variant='danger-outline']:hover,
.yh-button[data-variant='danger-outline']:active:not(:disabled, [aria-disabled='true']) {
  --yh-button-fill: var(--color-danger-subtle);
}

.yh-button[data-size='lg'] {
  min-height: var(--yh-control-lg);
  padding: 0 var(--space-5);
}

/* Small: buttons inside table rows, 28px with a mouse, 44px on touch screens. */
.yh-button[data-size='sm'] {
  min-height: var(--yh-control-sm);
  padding: 0 var(--space-2);
}

/*
 * Disabled: a flat grey key with muted text, whatever the variant (a 40% brand green read as a washed-out colour, not as
 * "not now"). Ghost, link and icon buttons have no fill, so they only take the muted colour.
 */
.yh-button:is(:disabled, [aria-disabled='true']):not([aria-busy='true']),
.yh-icon-button:is(:disabled, [aria-disabled='true']) {
  --yh-button-edge: transparent;
  --yh-button-fill: var(--color-surface-subtle);
  --yh-button-shadow: none;
  color: var(--color-text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

.yh-button:is([data-variant='ghost'], [data-variant='link']):is(:disabled, [aria-disabled='true']),
.yh-icon-button:is(:disabled, [aria-disabled='true']) {
  --yh-button-fill: transparent;
}

/*
 * Busy: the button keeps its size and colours (the work is under way, it is not unavailable), hides its label and icons
 * where they are and shows the spinner in the middle, so nothing beside it moves. The label may be a bare text node (the
 * server-rendered pages of ./dom set aria-busy on <button class="yh-button">文字</button>), so the text is made
 * transparent with -webkit-text-fill-color, which leaves currentColor alone for the spinner; every child element (icon,
 * shortcut hint, the labels of the send-code button) is hidden but keeps its space. It takes no clicks.
 */
.yh-button[aria-busy='true']:not([data-refresh]) {
  -webkit-text-fill-color: transparent;
  cursor: progress;
  pointer-events: none;
}

.yh-button[aria-busy='true']:not([data-refresh]) > * {
  visibility: hidden;
}

.yh-button[aria-busy='true']:not([data-refresh])::before {
  content: '';
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  margin: auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: yh-spin 700ms linear infinite;
}

/*
 * Refresh feedback ([data-refresh], React `refreshFeedback` / `useRefreshAction`, ./dom `data-refresh`): a refresh the
 * user asked for turns the button's own icon where it is, clockwise like the arrows of the `refresh` icon. The button
 * keeps its size, label and colours (not the busy state above: nothing is replaced). One turn is 400ms, the same as the
 * Flutter client (AppDuration.refreshFeedbackCycle), at a constant speed: the speed of work going on, so a long
 * refresh turns evenly instead of pulsing every 400ms. The script ends the animation at the end of the turn in which
 * the work finished (a whole number of iterations), so the icon always comes to rest where it started.
 * With reduced motion the icon does not turn: the same timed animation only holds it in the brand colour.
 */
:is(.yh-button, .yh-icon-button)[data-refresh][aria-busy='true'] {
  cursor: progress;
}

[data-refresh] {
  --yh-refresh-hold: var(--color-brand-text);
  --yh-refresh-hold-opacity: 1;
}

/* On a filled button the brand colour would vanish: the icon dims instead. */
.yh-button:is([data-variant='primary'], [data-variant='danger'])[data-refresh] {
  --yh-refresh-hold: currentColor;
  --yh-refresh-hold-opacity: 0.6;
}

[data-refresh][data-refreshing] > svg:first-of-type,
[data-refresh][data-refreshing] [data-refresh-icon] {
  animation: yh-refresh-turn 400ms linear infinite;
}

@keyframes yh-refresh-turn {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes yh-refresh-hold {
  from,
  to {
    color: var(--yh-refresh-hold);
    opacity: var(--yh-refresh-hold-opacity);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-refresh][data-refreshing] > svg:first-of-type,
  [data-refresh][data-refreshing] [data-refresh-icon] {
    animation-name: yh-refresh-hold;
  }
}

.yh-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

/* The icon set (Icon, iconSvg): 16px, stroke and colour come from the svg attributes. */
.yh-line-icon {
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
}

/* ------------------------------------------------------------ text inputs and native select */

.yh-input,
.yh-textarea,
.yh-select,
.yh-select-trigger {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  /*
   * One box, drawn here only (docs/design-system-css.md 一个控件一个框): hover, focus, invalid, disabled and read-only
   * below change the --yh-field-* properties, never border, background or box-shadow themselves. So a field that is a
   * part of another control (the input of an input group) sets those once and no state can draw its box back: an invalid
   * PasswordField with the focus drew a red edge round its input inside the red edge of the group.
   * --yh-field-cover is the fill drawn over the browser's autofill colour (below); at rest it is an empty shadow.
   */
  --yh-field-edge: var(--color-control-border);
  --yh-field-fill: var(--color-surface);
  --yh-field-shadow: inset 0 0 0 0 transparent;
  --yh-field-cover: inset 0 0 0 0 transparent;
  border: 1px solid var(--yh-field-edge);
  border-radius: var(--control-radius);
  background: var(--yh-field-fill);
  box-shadow: var(--yh-field-shadow), var(--yh-field-cover);
  color: var(--color-text);
  font: inherit;
  line-height: var(--line-control);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

/*
 * Browser autofill (a saved password, an address) paints the field light blue with the browser's own !important rule,
 * which no page rule outweighs, and forces its text colour (dark on a dark theme). A shadow inside the field is drawn
 * over the background: it covers the autofill colour with the field's own fill, under the focus edge. :is() forgives a
 * browser that does not know one of the two names.
 */
:is(.yh-input, .yh-textarea, .yh-select):is(:autofill, :-webkit-autofill) {
  --yh-field-cover: inset 0 0 0 100vmax var(--yh-field-fill);
  -webkit-text-fill-color: var(--color-text);
  caret-color: var(--color-text);
}

.yh-textarea {
  min-height: 5.5rem;
  padding: var(--space-2) var(--space-3);
  line-height: var(--line-base);
  resize: vertical;
}

.yh-input::placeholder,
.yh-textarea::placeholder {
  color: var(--color-text-muted);
}

/*
 * No browser button inside a kit field ("不使用浏览器原生控件"): Edge draws an eye at the end of a password field the
 * person types into, a second one beside PasswordField's. A rule of its own: in a selector list, a pseudo-element
 * another browser does not know would drop the whole rule there. Edge (Chromium) draws no ::-ms-clear, so it has none.
 */
.yh-input::-ms-reveal {
  display: none;
}

/* SearchBox owns the clear action with a labelled, focusable kit button. */
.yh-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}

.yh-input:hover,
.yh-textarea:hover,
.yh-select:hover,
.yh-select-trigger:hover {
  --yh-field-edge: var(--color-text-muted);
}

.yh-input:focus-visible,
.yh-textarea:focus-visible,
.yh-select:focus-visible,
.yh-select-trigger:focus-visible,
.yh-select-trigger[data-state='open'] {
  /* Focus: the edge turns brand and 2px thick, drawn inside the field, so no box around it (a scrolling list, a menu,
   * a card) can cut it. The transparent outline is the ring for forced-colours mode, which drops shadows. */
  --yh-field-edge: var(--color-focus);
  --yh-field-shadow: inset 0 0 0 1px var(--yh-field-edge);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Invalid: the edge turns red. After the focus rule, so an invalid field with the focus thickens its edge in red and the
 * focus never hides the error (the inner edge above takes the colour of the edge). */
.yh-input[aria-invalid='true'],
.yh-textarea[aria-invalid='true'],
.yh-select[aria-invalid='true'],
.yh-select-trigger[aria-invalid='true'] {
  --yh-field-edge: var(--color-danger);
}

.yh-input:disabled,
.yh-textarea:disabled,
.yh-select:disabled,
.yh-select-trigger:disabled,
.yh-input[readonly] {
  --yh-field-fill: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.yh-input[readonly] {
  cursor: default;
}

/*
 * A native select of a server-rendered page (./dom). The kit's own pages never show one (NativeSelect draws the kit's
 * Select): its list is the browser's and cannot be styled. The chevron is drawn with two gradients so that it follows
 * the text colour tokens.
 */
.yh-select {
  appearance: none;
  padding-right: var(--space-8);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
    linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.125rem) 50%,
    calc(100% - 0.8125rem) 50%;
  background-size:
    0.3125rem 0.3125rem,
    0.3125rem 0.3125rem;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* Radix select trigger is a button holding the value and a chevron icon. */
.yh-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  text-align: left;
  cursor: pointer;
}

.yh-select-trigger[data-placeholder] {
  color: var(--color-text-muted);
}

.yh-select-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-select-icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

/*
 * Widths of a control by what goes into it (tokens --field-width-*, docs/design-system-css.md "字段宽度"). In a form the
 * width is set on the field (.yh-field[data-width]) and narrows its control only; label, help and error keep the whole
 * width. A control outside a field (a filter bar) carries data-width itself. Under 480px every width but xs fills.
 */
.yh-field[data-width='xs'],
:is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width='xs'] {
  --yh-field-width: var(--field-width-xs);
}

.yh-field[data-width='sm'],
:is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width='sm'] {
  --yh-field-width: var(--field-width-sm);
}

.yh-field[data-width='md'],
:is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width='md'] {
  --yh-field-width: var(--field-width-md);
}

.yh-field[data-width='lg'],
:is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width='lg'] {
  --yh-field-width: var(--field-width-lg);
}

.yh-field[data-width] > :not(.yh-label, .yh-label-row, .yh-error, .yh-note, .yh-help),
:is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width] {
  width: var(--yh-field-width);
  max-width: 100%;
}

/* What ends the label line ("忘记口令？") ends where the control ends, not at the far edge of the form column. */
.yh-field[data-width] > .yh-label-row {
  width: var(--yh-field-width);
  max-width: 100%;
}

@media (max-width: 480px) {
  .yh-field[data-width]:not([data-width='xs']) > :not(.yh-label, .yh-error, .yh-note, .yh-help),
  :is(.yh-input, .yh-input-group, .yh-select, .yh-select-trigger)[data-width]:not([data-width='xs']) {
    width: 100%;
  }
}

/* Ids, codes, URLs and keys. */
.yh-input[data-mono] {
  font-family: var(--font-mono);
}

/*
 * An input with a prefix or suffix: the group is the box. Its text and text affixes ("¥", "小时") start
 * --yh-control-inset (13px) from the edge, where the text of a bordered Input starts; a text affix is 8px from the text;
 * a button affix brings its own padding and fills the whole height (44px on touch). React sets data-invalid and
 * data-disabled from the input; a server-rendered page writes them.
 *
 * One box (docs/design-system-css.md 一个控件一个框): the edge is drawn by ::after, laid over the parts, so nothing a part
 * paints can cover it. It was an inset shadow of the group itself, which the parts paint over: a browser that autofilled
 * a saved password filled the input light blue and the edge vanished along it. The states change --yh-frame-edge,
 * --yh-frame-width and --yh-frame-fill; the parts draw no box of their own in any state (below).
 */
.yh-input-group {
  --yh-frame-edge: var(--color-control-border);
  --yh-frame-width: 1px;
  --yh-frame-fill: var(--color-surface);
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: var(--yh-control);
  border-radius: var(--control-radius);
  background: var(--yh-frame-fill);
  color: var(--color-text);
}

.yh-input-group::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 var(--yh-frame-width) var(--yh-frame-edge);
  pointer-events: none;
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.yh-input-group:hover {
  --yh-frame-edge: var(--color-text-muted);
}

.yh-input-group:focus-within {
  --yh-frame-edge: var(--color-focus);
  --yh-frame-width: 2px;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* After the focus rule: an invalid group with the focus thickens its edge in red, so the focus never hides the error. */
.yh-input-group[data-invalid] {
  --yh-frame-edge: var(--color-danger);
}

/* The focus is on the button at the end: the button shows its own ring, the box stays at rest (one ring only). */
.yh-input-group:has(> .yh-input-affix :focus-visible) {
  --yh-frame-edge: var(--color-control-border);
  --yh-frame-width: 1px;
  outline: 1px solid transparent;
  outline-offset: -1px;
}

.yh-input-group[data-invalid]:has(> .yh-input-affix :focus-visible) {
  --yh-frame-edge: var(--color-danger);
}

/* Shadows disappear in Windows high contrast. Keep the frame without changing its size; the field's focus outline
 * above still wins while typing, and a trailing button keeps its own inset focus ring. */
@media (forced-colors: active) {
  .yh-input-group {
    outline: 1px solid ButtonBorder;
    outline-offset: -1px;
  }
}

.yh-input-group[data-disabled] {
  --yh-frame-fill: var(--color-surface-subtle);
  color: var(--color-text-secondary);
}

/*
 * The input is a part: no edge, no fill, no ring of its own, whatever its state (the states of .yh-input above change
 * only variables, so they cannot bring its box back). A number field keeps its input in a wrapper (for the drawing of
 * 1.2×10⁻³, pickers.css): it is the group's input all the same. The ring rule is spelled with :focus-visible so it
 * outweighs the page's focus ring (base.css) wherever the stylesheets sit.
 */
.yh-input-group > .yh-input,
.yh-input-group > .yh-number-value > .yh-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding-inline: var(--yh-control-inset);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.yh-input-group > .yh-input:focus-visible,
.yh-input-group > .yh-number-value > .yh-input:focus-visible {
  outline: none;
}

/* Autofilled, the input is covered with the group's fill instead (see the field's autofill rule). */
.yh-input-group > .yh-input:is(:autofill, :-webkit-autofill),
.yh-input-group > .yh-number-value > .yh-input:is(:autofill, :-webkit-autofill) {
  box-shadow: inset 0 0 0 100vmax var(--yh-frame-fill);
}

.yh-input-affix {
  --yh-affix-focus-inset: var(--space-1);
  display: flex;
  flex: none;
  align-items: center;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.yh-input-affix[data-text][data-side='start'] {
  padding-inline-start: var(--yh-control-inset);
}

.yh-input-affix[data-text][data-side='end'] {
  padding-inline-end: var(--yh-control-inset);
}

.yh-input-affix[data-text][data-side='start'] + .yh-input,
.yh-input-affix[data-text][data-side='start'] + .yh-number-value > :is(.yh-input, .yh-number-display) {
  padding-inline-start: var(--space-2);
}

.yh-input-group[data-suffix='text'] > .yh-input,
.yh-input-group[data-suffix='text'] > .yh-number-value > .yh-input {
  padding-inline-end: var(--space-2);
}

/* A button at the end of the box ("显示", "获取验证码"): the whole height, no frame of its own, concentric corners. */
.yh-input-affix > :is(.yh-button, .yh-icon-button) {
  height: auto;
  min-height: 0;
  align-self: stretch;
  border: 0;
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  background: transparent;
  box-shadow: none;
}

.yh-input-affix > .yh-button {
  padding: 0 var(--yh-control-inset) 0 var(--space-3);
  color: var(--color-brand-text);
}

.yh-input-affix > :is(.yh-button, .yh-icon-button):disabled {
  color: var(--color-text-muted);
}

/* An icon at the end of the box ("显示密码") is quieter than the text: the secondary colour, the text colour on hover. */
.yh-input-affix > .yh-icon-button {
  color: var(--color-text-secondary);
}

.yh-input-affix > .yh-icon-button:hover {
  color: var(--color-text);
}

/* Search clear and password reveal share an inset rounded keyboard ring, wholly inside the field. */
.yh-input-affix > .yh-icon-button:focus-visible {
  border-radius: var(--control-radius);
  outline: var(--focus-ring);
  outline-offset: calc(0px - var(--yh-affix-focus-inset));
}

/*
 * Account inputs (docs/design-system-css.md "入口页与账号输入"). The button of a code field holds every label it can show
 * in one grid cell, so "获取验证码", "58 秒后重发" and "重新获取" take the same width and the code beside it never moves;
 * while it works the spinner takes the place of the label (the general busy rule of .yh-button).
 */
.yh-send-code-labels {
  display: grid;
}

.yh-send-code-labels > * {
  grid-area: 1 / 1;
  text-align: center;
}

.yh-send-code-labels > :not([data-current]) {
  visibility: hidden;
}

/* ------------------------------------------------------------ checkbox, radio, switch */

/* A label around the control gives touch screens a 44px target; the box itself stays small. */
.yh-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--yh-control);
  cursor: pointer;
}

.yh-check[aria-disabled='true'],
.yh-check:has(:disabled) {
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.yh-checkbox,
.yh-radio,
.yh-switch {
  appearance: none;
  position: relative;
  flex: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-control-border);
  background: var(--color-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-spring-snappy) var(--ease-spring-snappy);
}

.yh-check:hover .yh-checkbox:not(:checked, [data-state='checked'], [data-state='indeterminate'], :disabled),
.yh-check:hover .yh-radio:not(:checked, [data-state='checked'], :disabled),
.yh-checkbox:hover:not(:checked, [data-state='checked'], [data-state='indeterminate'], :disabled),
.yh-radio:hover:not(:checked, [data-state='checked'], :disabled) {
  border-color: var(--color-text-secondary);
}

.yh-checkbox:active:not(:disabled),
.yh-radio:active:not(:disabled) {
  transform: scale(var(--motion-press-scale));
}

.yh-checkbox,
.yh-radio {
  width: 1.125rem;
  height: 1.125rem;
}

.yh-checkbox {
  border-radius: 0.3125rem;
}

.yh-radio {
  border-radius: var(--radius-full);
}

.yh-checkbox:checked,
.yh-checkbox[data-state='checked'],
.yh-checkbox[data-state='indeterminate'],
.yh-radio:checked,
.yh-radio[data-state='checked'] {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

/*
 * The check and the dash are the `check` and `minus` icons of the set (src/icons/shapes.ts), drawn as a mask in the
 * colour on the brand, so the native checkbox of a server-rendered page and the React one show the same mark. 14px in
 * the 16px inside the box's border, the stroke thickened to 2.25 of 16 (about 2px at 14px) so the mark has the weight of a 13px label.
 * The masks are files beside the CSS (masks/, copied to dist/masks/; a test compares them with the icon set), never data:
 * URLs, so `img-src 'self'` is enough (docs/consuming-web.md 10.6a). `?no-inline` keeps Vite from inlining them as data:
 * URLs in an app's build; other bundlers and a static server ignore the query.
 */
.yh-checkbox:checked::after,
.yh-checkbox[data-state='checked']::after,
.yh-checkbox:indeterminate::after,
.yh-checkbox[data-state='indeterminate']::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-on-brand);
  mask: url('./masks/check.svg?no-inline') center / 0.875rem no-repeat;
}

.yh-checkbox:indeterminate::after,
.yh-checkbox[data-state='indeterminate']::after {
  mask-image: url('./masks/minus.svg?no-inline');
}

.yh-radio:checked::after,
.yh-radio[data-state='checked']::after {
  content: '';
  position: absolute;
  inset: 0.25rem;
  border-radius: var(--radius-full);
  background: var(--color-on-brand);
}

/*
 * The marks spring in when a box is ticked: the check and the dash grow from 40%,
 * the dot of a radio from nothing, on the bouncy spring. They exist only while checked, so the animation runs each time
 * the box is ticked and never on unticking. Reduced motion: 1ms, so the mark is simply there.
 */
.yh-checkbox:checked::after,
.yh-checkbox[data-state='checked']::after {
  animation: yh-check-in var(--duration-spring-bouncy) var(--ease-spring-bouncy);
}

.yh-checkbox:indeterminate::after,
.yh-checkbox[data-state='indeterminate']::after,
.yh-radio:checked::after,
.yh-radio[data-state='checked']::after {
  animation: yh-dot-in var(--duration-spring-bouncy) var(--ease-spring-bouncy);
}

@keyframes yh-check-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes yh-dot-in {
  from {
    opacity: 0;
    transform: scale(0);
  }
}

/*
 * A 40 x 24 track with a white 20px thumb. Off, the track is the control-border grey (3:1 on the page, so an off
 * switch is still a visible shape); on, it is the brand.
 * The thumb is concentric with the track: 2px from the top, the bottom and the end it rests against, and its radius
 * (10) is the track's (12) minus that inset. It is placed from the padding box, inside the track's border, so the
 * border is taken off the inset; the travel is what is left of the track's width.
 */
.yh-switch {
  --yh-switch-border: 1px;
  --yh-switch-inset: 2px;
  --yh-switch-thumb: calc(1.5rem - 2 * var(--yh-switch-inset));
  --yh-switch-travel: calc(2.5rem - 2 * var(--yh-switch-inset) - var(--yh-switch-thumb));
  width: 2.5rem;
  height: 1.5rem;
  border-width: var(--yh-switch-border);
  border-radius: var(--radius-full);
  border-color: var(--color-control-border);
  background: var(--color-control-border);
}

.yh-switch::after {
  content: '';
  position: absolute;
  left: calc(var(--yh-switch-inset) - var(--yh-switch-border));
  top: calc(var(--yh-switch-inset) - var(--yh-switch-border));
  width: var(--yh-switch-thumb);
  height: var(--yh-switch-thumb);
  border-radius: var(--radius-full);
  background: var(--color-on-selected);
  box-shadow: var(--shadow-control);
  transition:
    transform var(--duration-spring-bouncy) var(--ease-spring-bouncy),
    width var(--duration-spring-snappy) var(--ease-spring-snappy);
}

/* Pressed, the thumb stretches toward where it will go (4px wider), as on iOS; on release it travels and settles. */
.yh-switch:active:not(:disabled)::after {
  width: calc(var(--yh-switch-thumb) + 4px * (1 - var(--motion-press-scale)) / 0.03);
}

.yh-switch:checked:active:not(:disabled)::after,
.yh-switch[data-state='checked']:active:not(:disabled)::after {
  transform: translateX(calc(var(--yh-switch-travel) - 4px * (1 - var(--motion-press-scale)) / 0.03));
}

.yh-switch:hover:not(:checked, [data-state='checked'], :disabled) {
  border-color: var(--color-text-secondary);
  background: var(--color-text-secondary);
}

.yh-switch:checked,
.yh-switch[data-state='checked'] {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

.yh-switch:checked::after,
.yh-switch[data-state='checked']::after {
  transform: translateX(var(--yh-switch-travel));
}

.yh-checkbox:disabled,
.yh-radio:disabled,
.yh-switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.yh-checkbox[aria-invalid='true'] {
  border-color: var(--color-danger);
}

/* The options of a radio group are rows like a list of checkboxes (.yh-choice-group): 4px apart, 20px across when horizontal. */
.yh-radio-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--gap-choice);
}

.yh-radio-group[data-orientation='horizontal'] {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--gap-choice) var(--space-5);
}

/*
 * A radio with a description (RadioGroup option `description`): the label and a second line in the secondary colour.
 * The radio sits in a box one text line high, so it is centred on the label's line, not on the two lines. The row grows
 * with the text; its padding keeps the 36px (44px on touch) target around a single line.
 */
.yh-check[data-described] {
  align-items: flex-start;
  padding-block: calc((var(--yh-control) - var(--line-base)) / 2);
  box-sizing: border-box;
}

.yh-check-box {
  display: flex;
  flex: none;
  align-items: center;
  height: var(--line-base);
}

.yh-check-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.yh-check-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

/* ------------------------------------------------------------ field and form */

/* Label, control, then the error and the help text: 4px apart (--gap-label), with or without the optional parts. */
.yh-field {
  display: flex;
  flex-direction: column;
  gap: var(--gap-label);
  min-width: 0;
}

.yh-label {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: var(--line-control);
}

/*
 * Only optional fields are marked (handbook web-ui.md 4.4.4): "（选填）" at the size of the label, regular weight, in
 * the secondary colour. A required field has no mark (no red asterisk: red is the colour of an error).
 */
.yh-label-optional {
  color: var(--color-text-secondary);
  font-weight: var(--weight-normal);
}

/* A label with something at the end of its line (a count, "忘记口令？"): the line stays one control line high. */
.yh-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-inline);
  min-width: 0;
}

.yh-label-extra {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-help {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-error {
  margin: 0;
  color: var(--color-danger);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

/* A state that is not an error ("大写锁定已打开", "验证码已发送"): the warning colour, the size of the help text. */
.yh-note {
  margin: 0;
  color: var(--color-warning);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

/*
 * An error replaces the help text, it is never shown with it: Field leaves the help out when it has an error, and a
 * control that reports its own error (a date that is not a date) puts it before the field's help and errors, which
 * these hide.
 */
.yh-field > :is(.yh-error, .yh-note) ~ .yh-help,
.yh-field > .yh-error ~ .yh-error {
  display: none;
}

/*
 * A form: fields 16px apart. A form made of sections (fieldsets, as `Form` writes it), an error and the buttons puts
 * those 24px apart: they are blocks, and the buttons belong to the whole form, not to the last field.
 */
.yh-form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--form-width);
}

/* A form in a drawer writes it too, and scrolls with the drawer's body: only a dialog makes this a box (overlay.css). */
.yh-form-scroll {
  display: contents;
}

.yh-form-section {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.yh-form:has(> .yh-form-section, > .yh-form-actions) {
  gap: var(--gap-block);
}

/*
 * The title of a section (legend) is a part of the section like its fields, 16px above the first one (the section's
 * gap). A floated legend is an ordinary child of the fieldset (not the one drawn in its border), so the gap spaces it.
 */
.yh-form-section > legend {
  float: left;
  width: 100%;
  padding: 0;
  font-weight: var(--weight-semibold);
}

/* Field-level actions fit their label; entry pages retain their full-width actions. */
.yh-form-section:not(.yh-entry *) > .yh-button {
  align-self: flex-start;
}

.yh-phone-international {
  display: grid;
  grid-template-columns: minmax(6rem, 40%) minmax(0, 1fr);
  gap: var(--space-2);
  min-width: 0;
}

.yh-button[data-variant='ghost'][aria-pressed='true'] {
  --yh-button-fill: var(--color-brand-subtle);
  color: var(--color-brand-text);
}

.yh-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-inline);
}

@media (max-width: 480px) {
  .yh-form-actions .yh-button {
    flex: 1 1 100%;
  }
}

/*
 * A form in a dialog ends like the dialog's own footer: the buttons at the right, "取消" on the left of the primary
 * action (the order of the markup; `Form` writes it so in a dialog). On a phone they stack with the primary action on
 * top, as `.yh-dialog-footer` does.
 */
.yh-dialog .yh-form-actions {
  justify-content: flex-end;
}

@media (max-width: 480px) {
  .yh-dialog .yh-form-actions {
    flex-direction: column-reverse;
    flex-wrap: nowrap;
  }

  .yh-dialog .yh-form-actions .yh-button {
    flex: none;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yh-button,
  .yh-icon-button,
  .yh-input,
  .yh-checkbox,
  .yh-radio,
  .yh-switch,
  .yh-switch::after {
    transition: none;
  }
}

/* ------------------------------------------------------------ form groups and the error summary (forms, 0.6.0) */

/* The fields of a FormSection: 16px apart, like the fields of a form. */
.yh-form-fields {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  min-width: 0;
}

/* A form made of section cards puts the cards 24px apart (blocks of a page). */
.yh-form-section:has(> .yh-form-group:not([data-plain])) {
  gap: var(--gap-block);
}

/*
 * A section in a dialog is not a card (no frame in a frame): a small heading over its fields. The fields above it are
 * 16px away (the form's gap); the 8px on top of the heading make it the 24px of a block, so the heading reads as the
 * start of a group and not as the label of the field above.
 */
.yh-form-group[data-plain] {
  display: flex;
  flex-direction: column;
  gap: var(--gap-head-content);
  padding-top: var(--space-2);
  min-width: 0;
}

.yh-form-group-heading {
  display: flex;
  flex-direction: column;
  gap: var(--gap-title-text);
}

.yh-form-group-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--line-base);
}

.yh-form-group-desc {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

/* The errors of a submit, in the order of the form; each one is a link to its field. */
.yh-error-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-choice);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------ the save bar (Form actions="bar", FormBar) */

/*
 * The anchor follows the form's last block (24px below it, the form's gap) and sticks to the bottom of the window, so
 * the bar floats over the fields while the page scrolls. Pointer events go through the anchor; only the bar takes them.
 */
.yh-form-bar-anchor {
  position: sticky;
  bottom: 0;
  z-index: var(--z-feedback);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  pointer-events: none;
}

/*
 * The glass capsule of the bulk-action bar (materials.css), as wide as the form column: the same height (a control and
 * 8px around it) and the same corners; the state on the left, the buttons at the right end, as round as the bar.
 */
.yh-form-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 100%;
  min-height: calc(var(--yh-control) + 2 * var(--space-2));
  padding: calc(var(--space-2) - 1px) calc(var(--space-2) - 1px) calc(var(--space-2) - 1px) var(--space-5);
  border-radius: var(--bar-radius);
  color: var(--color-text);
  pointer-events: auto;
}

.yh-form-bar-status {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  line-height: var(--line-control);
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.yh-form-bar-status[data-tone='danger'] {
  color: var(--color-danger);
  font-weight: var(--weight-medium);
}

.yh-form-bar-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
}

.yh-form-bar .yh-button {
  flex: none;
  border-radius: var(--bar-radius);
}

/* The moment of a draft ("（2026-11-04 10:42）") stays on one line: a narrow screen breaks before it, not inside it. */
.yh-draft-offer time {
  white-space: nowrap;
}

/* "已保存 · 10:42" in the page: only on a phone, where the bar shows only its buttons. */
@media (min-width: 481px) {
  .yh-form-saved {
    display: none;
  }
}

/* A phone: the buttons share the bar's width; the state is announced but not shown (the page shows what matters). */
@media (max-width: 480px) {
  .yh-form-bar {
    padding-left: calc(var(--space-2) - 1px);
  }

  .yh-form-bar-status {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }

  .yh-form-bar-actions {
    flex: 1 1 auto;
  }

  .yh-form-bar-actions .yh-button {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* ------------------------------------------------------------ the table of contents of a long form (FormPage) */

/*
 * The page is a size container: the list appears when the content area (not the window: a sidebar takes its part) is
 * as wide as the form column, 32px and the list. Container queries cannot read custom properties, so the width is
 * written out: 54rem = --form-width (40rem) + --space-8 (2rem) + --form-nav-width (12rem); styles.test.ts checks the sum.
 */
.yh-form-page {
  container-type: inline-size;
  min-width: 0;
}

.yh-form-nav {
  display: none;
}

@container (min-width: 54rem) {
  .yh-form-page-layout[data-nav] {
    display: grid;
    grid-template-columns: minmax(0, var(--form-width)) var(--form-nav-width);
    column-gap: var(--space-8);
    align-items: start;
  }

  .yh-form-page-layout[data-nav] > .yh-form-nav {
    display: flex;
    flex-direction: column;
    gap: var(--gap-head-content);
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
  }
}

/* A section reached from the list stops under the sticky header, like the list itself. */
.yh-form-page .yh-form-group {
  scroll-margin-top: calc(var(--header-height) + var(--space-6));
}

.yh-form-nav-title {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--line-sm);
}

/* One line along the left of the list (the items, edge to edge); the current section's line is the accent, 2px. */
.yh-form-nav-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-form-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  box-shadow: inset 1px 0 0 var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.yh-form-nav-item:hover {
  color: var(--color-text);
}

.yh-form-nav-item[aria-current] {
  box-shadow: inset 2px 0 0 var(--color-brand);
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

.yh-form-nav-label {
  flex: 1 1 auto;
  min-width: 0;
}

/* The errors of a section: a small count in the danger colour. */
.yh-form-nav-errors {
  flex: none;
  min-width: var(--space-5);
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: var(--color-danger-subtle);
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--space-5);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (pointer: coarse) {
  .yh-form-nav-item {
    min-height: var(--hit-target);
  }
}

.yh-year-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.yh-year-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); }
.yh-year-popup { max-width: calc(100vw - var(--space-4)); }
.yh-filter-inline { min-width: 0; }
.yh-filter-summary { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.yh-filter-summary .yh-button { white-space: normal; overflow-wrap: anywhere; }
.yh-account-button .yh-avatar::before { content: attr(data-initial); }
.yh-account-button .yh-avatar[data-image] { overflow: hidden; }
.yh-account-button .yh-avatar[data-image]::before { content: none; }
.yh-avatar-image { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }

/*
 * @catalytic/app-kit design system: icons. The rules of the line icons (Icon, iconSvg) in docs/icon-system.md: four
 * sizes, a stroke that follows the size and the weight of the text around the icon, the filled variant, the spacing
 * beside a label and the colour roles. After controls.css on purpose: it replaces the plain 16px rule there.
 */

/* ------------------------------------------------------------ size and stroke */

/*
 * The 16 grid is drawn at --yh-icon-px. The stroke is given in px for each size (12: 1.25, 16: 1.5, 20: 1.75, 24: 2 at
 * Regular), plus 0.25 per weight step (Medium +0.25, Bold +0.5), and converted to user units of the 16 grid. The svg's
 * stroke-width attribute (1.5) is the fallback without this stylesheet.
 */
.yh-line-icon {
  --yh-icon-px: 16;
  --yh-icon-base: 1.5;
  --yh-icon-sw: calc((var(--yh-icon-base) + 0.25 * var(--yh-icon-weight, 0)) * 16 / var(--yh-icon-px));
  flex: none;
  width: calc(var(--yh-icon-px) * 1px);
  height: calc(var(--yh-icon-px) * 1px);
  stroke-width: var(--yh-icon-sw);
}

.yh-line-icon[data-size='12'] {
  --yh-icon-px: 12;
  --yh-icon-base: 1.25;
}

.yh-line-icon[data-size='20'] {
  --yh-icon-px: 20;
  --yh-icon-base: 1.75;
}

.yh-line-icon[data-size='24'] {
  --yh-icon-px: 24;
  --yh-icon-base: 2;
}

/* The cut around the part that stands free in a filled icon (the slash of an "-off" icon): 1 unit wider on each side. */
.yh-icon-gap {
  stroke-width: calc(var(--yh-icon-sw) + 2);
}

/* ------------------------------------------------------------ weight follows the text */

/*
 * The text weight of a context as a step: 0 Regular, 1 Medium (500 and 600), 2 Bold. These are the rules of
 * styles.css that set a heavier weight, Medium in the first list and Bold in the second (src/icons/icons.test.ts keeps the list complete). :where() keeps them at zero
 * specificity, so data-icon-weight on any element wins.
 */
:where(
  .yh-page-head[data-title-size='compact'] .yh-page-title,
  .yh-section-title,
  .yh-button,
  .yh-icon-button,
  .yh-label,
  .yh-form-section > legend,
  .yh-form-group-title,
  .yh-card-title,
  .yh-column-settings-title,
  .yh-table thead th,
  .yh-tab,
  .yh-page-navigation-link,
  .yh-page-navigation-link[aria-current='page'],
  .yh-workspace-tab-link,
  .yh-badge,
  .yh-alert-title,
  .yh-chart-tooltip-row strong,
  .yh-stat-value,
  .yh-import-cell[data-invalid] > :first-child,
  .yh-app-name,
  .yh-nav a[aria-current],
  .yh-nav a[aria-current='page'],
  .yh-avatar,
  .yh-sidebar-group,
  .yh-nav-item[aria-current],
  .yh-nav-item[aria-current='page'],
  .yh-nav-item[data-active],
  .yh-nav-item[aria-current]:hover,
  .yh-nav-item[aria-current='page']:hover,
  .yh-nav-item[data-active]:hover,
  .yh-danger-title,
  .yh-work-row-title,
  .yh-dialog-title,
  .yh-drawer-title,
  .yh-menu-name,
  .yh-menu-item[aria-current='page'],
  .yh-scope-item[aria-checked='true'],
  .yh-menu-item[aria-current='page']:hover,
  .yh-menu-item[aria-current='page']:focus-visible,
  .yh-menu-item[aria-current='page'][data-highlighted],
  .yh-select-item[data-state='checked'],
  .yh-toast-title,
  .yh-launcher-group,
  .yh-launcher-item[aria-current='true'],
  .yh-tree-item[aria-selected='true'],
  .yh-tree-view .yh-tree-item[aria-current],
  .yh-tree-view .yh-tree-item[aria-current]:hover,
  .yh-timeline-title,
  .yh-calendar-title,
  .yh-calendar-day[data-today],
  .yh-step-marker,
  .yh-step[data-status='current'] .yh-step-label,
  .yh-bulk-count,
  .yh-disclosure,
  .yh-filter-chip[data-state='checked'],
  .yh-dropzone-prompt,
  .yh-step[data-status='current'] .yh-step-body,
  .yh-stepper-summary,
  .yh-palette-heading,
  .yh-shortcut-heading,
  .yh-form-bar-status[data-tone='danger'],
  .yh-form-nav-title,
  .yh-form-nav-item[aria-current],
  .yh-form-nav-errors,
  .yh-skeleton-frame[data-shape='button'],
  .yh-skeleton-link
) {
  --yh-icon-weight: 1;
}

:where(
  b,
  strong,
  .yh-page-title,
  .yh-entry-title,
  .yh-state-page h1
) {
  --yh-icon-weight: 2;
}

[data-icon-weight='regular'] {
  --yh-icon-weight: 0;
}

[data-icon-weight='medium'] {
  --yh-icon-weight: 1;
}

[data-icon-weight='bold'] {
  --yh-icon-weight: 2;
}

/* ------------------------------------------------------------ beside text */

/*
 * An icon and its label: centred on the line, 4px apart at 12, 6px at 16, 8px at 20 and 24. Inside running text use
 * .yh-icon-inline instead: the icon's centre sits on the middle of the capital letters.
 */
.yh-icon-label {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--space-1) * 1.5);
}

.yh-icon-label > .yh-line-icon[data-size='12']:first-child {
  margin-inline-end: calc(var(--space-1) * -0.5);
}

.yh-icon-label > .yh-line-icon[data-size='12']:last-child {
  margin-inline-start: calc(var(--space-1) * -0.5);
}

.yh-icon-label > .yh-line-icon:is([data-size='20'], [data-size='24']):first-child {
  margin-inline-end: calc(var(--space-1) * 0.5);
}

.yh-icon-label > .yh-line-icon:is([data-size='20'], [data-size='24']):last-child {
  margin-inline-start: calc(var(--space-1) * 0.5);
}

.yh-line-icon.yh-icon-inline {
  vertical-align: -0.125em;
  vertical-align: calc((1cap - var(--yh-icon-px) * 1px) / 2);
}

/* ------------------------------------------------------------ colour roles */

/*
 * The icon takes the colour of its text (currentColor). A tone is for an icon that carries a state by itself, always
 * next to words that say the same: success, warning, danger; brand for the current or selected item; muted for an
 * icon that only decorates a secondary line.
 */
.yh-line-icon[data-tone='success'] {
  color: var(--color-success);
}

.yh-line-icon[data-tone='warning'] {
  color: var(--color-warning);
}

.yh-line-icon[data-tone='danger'] {
  color: var(--color-danger);
}

.yh-line-icon[data-tone='brand'] {
  color: var(--color-brand);
}

.yh-line-icon[data-tone='muted'] {
  color: var(--color-text-secondary);
}

/* Part 3: content. Card, Table, Tabs, Badge, Alert, DescriptionList, EmptyState, Skeleton, Pagination, filter bar. */

.yh-table > :is(thead, tbody) > tr > [data-expand] {
  width: 2.75rem;
  padding-inline: var(--space-2);
}

/* Things that fill the edge of a box that clips (a cell, the table, a flush card) draw the ring inside themselves:
 * the expand button of a row, a sort header, a part cut with an ellipsis (a tab stop), a tab panel. */
.yh-table > :is(thead, tbody) > tr > [data-expand] .yh-icon-button:focus-visible,
.yh-sort:focus-visible,
.yh-table [data-cut-tab]:focus-visible,
.yh-tabs > [role='tabpanel']:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}

.yh-table > tbody > tr[data-expanded-row][hidden] { display: none; }
.yh-table > tbody > tr[data-expanded-row] > td {
  max-width: 0;
  padding: var(--space-4);
  white-space: normal;
  background: var(--color-surface);
}
.yh-table-expanded-content { min-width: 0; }

/* ------------------------------------------------------------ card */

.yh-card {
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  padding: var(--card-padding);
  min-width: 0;
  /* What a flush card tells the parts inside it stops at the next card (see "flush" below): this one is a padded box. */
  --yh-flush: 0;
  --yh-table-inline-pad: initial;
  /*
   * The card spaces its children: the head 16px above the body, the blocks of the body 16px apart (--gap-card-head).
   * A flush card has no gap: its strips (title bar, filter bar, table, pagination) meet at their own lines.
   */
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap-card-head) * (1 - var(--yh-flush)));
}

/*
 * Text in a card wraps inside it: a name, an identifier or a URL without a break opportunity breaks anywhere instead of
 * running out of the card (min-width 0 above lets the card shrink; this lets its text). gallery:shots `checkCardText`.
 */
.yh-card :where(p, h1, h2, h3, h4, dd, .yh-card-title, .yh-card-desc, .yh-card-text) {
  overflow-wrap: anywhere;
}

/* A button, link or badge written straight into a card keeps its own width instead of stretching across the column. */
.yh-card > :where(.yh-button, .yh-badge, .yh-link, a, button) {
  align-self: flex-start;
}

/*
 * A card that is a frame for a table or a list ("flush"): the content fills the card from edge to edge and the card is
 * the only frame, so what is inside draws no line of its own where it meets the card's edge, and text starts and ends
 * at the card padding, in line with the title. A card is flush when it says so (`data-flush`, React `flush`), and
 * also by itself when its direct children are only the title bar, one or more tables and the filter bar and
 * pagination of a table: nothing in it needs the padding. Browsers without :has() only know the explicit form; the
 * card then holds the table as a box inside its padding, which is still a valid table.
 *
 *   FLUSH = .yh-card[data-flush], or the card made of the parts above
 *
 * The title bar is a direct child of the card. The parts that may sit inside wrappers (tables, the filter bar, the
 * pagination, tabs) learn about it through one inherited custom property, --yh-flush: 1 in a flush card, 0 in every
 * other card (the base rule above) and in a dialog. They read it with `calc(… * var(--yh-flush, 0))`: 0 is their plain
 * look, 1 the flush look, and with no card around at all the fallback 0 applies. Because the nearest card decides, a
 * padded card nested in a flush card is a padded card again (its table keeps its frame), and a flush card in a padded
 * one is flush. The condition is written once, here (the selector cannot be shared without a build step).
 */
:is(.yh-card[data-flush], .yh-card:has(> .yh-table-wrap):not(:has(> :not(.yh-card-header, .yh-table-wrap, .yh-filters, .yh-pagination)))) {
  --yh-flush: 1;
  /* Where a table starts and ends its first and last column: the card padding (see "table" below). */
  --yh-table-inline-pad: var(--card-padding);
  padding: 0;
  overflow: hidden;
}

/* A titled flush card: the title keeps the card's padding and a line separates it from the rows. */
:is(.yh-card[data-flush], .yh-card:has(> .yh-table-wrap):not(:has(> :not(.yh-card-header, .yh-table-wrap, .yh-filters, .yh-pagination)))) > .yh-card-header {
  padding: var(--space-4) var(--card-padding);
  border-bottom: 1px solid var(--color-border);
}

/* Description list in a flush card: every row runs from edge to edge, its text at the card padding. */
.yh-card[data-flush] > .yh-dl > div {
  padding-inline: var(--card-padding);
}
.yh-card[data-flush] > .yh-card-slot > .yh-dl > div {
  padding-inline: var(--card-padding);
}

.yh-card-slot { display: contents; }
.yh-card-slot:has(+ .yh-card-slot > .yh-table-wrap) > .yh-table-wrap .yh-table tbody tr:last-child td {
  border-bottom-color: var(--color-border);
}

/*
 * Something in a flush card that keeps its own frame (an alert) or is not a row (a line of text) goes into
 * `.yh-card-inset`: a strip with the card padding at the sides and 16px above and below, so it does not meet the
 * card's edge. Without it a framed part would sit flush against the card's border.
 */
.yh-card-inset,
.yh-card-slot:has(> .yh-alert, > .yh-card) {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  padding: var(--space-4) var(--card-padding);
}

.yh-card[data-tone='danger'] {
  border-color: var(--color-danger-border);
}

/*
 * A card that is itself a target (a link or a button made of a card, `data-interactive`): flat at rest, like every card,
 * and on hover the border darkens and --shadow-card lifts it; pressed, it sinks back (no shadow, subtle fill). The
 * focus ring is the one of the page.
 */
.yh-card[data-interactive] {
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-instant) var(--ease-out),
    transform var(--duration-spring-snappy) var(--ease-spring-snappy);
}

.yh-card[data-interactive]:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-card);
  transform: translateY(calc(var(--motion-shift) / -4));
}

.yh-card[data-interactive]:active {
  box-shadow: none;
  background: var(--color-surface-subtle);
  transform: scale(calc((1 + var(--motion-press-scale)) / 2));
  transition-duration: var(--duration-instant);
}

/*
 * A card that is one link (React `Card href`, R001): the title is the link (`.yh-card-link`) and its ::after covers the
 * card, so the whole card is the link's hit area: a click anywhere follows it, and a middle click, Ctrl/⌘-click and the
 * context menu get the link. The title keeps the title's look; the card has the `interactive` look and draws the focus
 * ring of the link around itself. Controls inside the card are lifted above the cover (zero specificity: a control
 * that positions itself keeps its own position), and while the pointer is on one of them the card stays flat, so the
 * press reads as the control's.
 */
.yh-card[data-link] {
  position: relative;
}

.yh-card-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: inherit;
  text-decoration: none;
}

/* The arrow of a card that leads to another site: 4px after the title, in the secondary colour. */
.yh-card-link .yh-external {
  color: var(--color-text-secondary);
}

.yh-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
}

:where(.yh-card[data-link]) :where(a:not(.yh-card-link), button, input, select, textarea, summary, label, [role='button'], [tabindex]:not([tabindex='-1']), [data-tip]) {
  position: relative;
  z-index: 1;
}

@supports selector(:has(*)) {
  .yh-card .yh-card-link:focus-visible {
    outline: none;
  }

  .yh-card[data-link]:has(.yh-card-link:focus-visible) {
    outline: var(--focus-ring);
    outline-offset: 2px;
  }

  .yh-card[data-link]:has(:is(a:not(.yh-card-link), button, input, select, textarea, label, [role='button']):hover) {
    border-color: var(--color-border);
    box-shadow: none;
    transform: none;
  }

  .yh-card[data-link]:has(:is(a:not(.yh-card-link), button, input, select, textarea, label, [role='button']):active) {
    background: var(--color-surface);
    transform: none;
  }
}

.yh-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

/* A card title with a description under it (Card `description`): 4px apart, the actions centred beside the pair. */
.yh-card-heading {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  gap: var(--gap-title-text);
  min-width: 0;
}

.yh-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-inline);
  margin-inline-start: auto;
  min-width: 0;
  max-width: 100%;
}

.yh-card-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: var(--line-md);
}

.yh-card-text {
  margin: 0;
  color: var(--color-text-secondary);
}

/* A line of the body that explains the section, before its controls (16px, the card's gap). Under the title, use Card `description`. */
.yh-card-lead {
  min-width: 0;
}

/* ------------------------------------------------------------ table */

.yh-table-wrap {
  position: relative; /* contains the visually hidden labels, so they never widen the page */
  isolation: isolate; /* the sticky actions cell stacks inside the wrapper, not against the page header */
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow-x: auto;
  /* In a flush card the card is the only frame: no border and no rounded corners of the table's own (the card clips the header row). */
  border: calc(1px * (1 - var(--yh-flush, 0))) solid var(--color-border);
  border-radius: calc(var(--card-radius) * (1 - var(--yh-flush, 0)));
  background: var(--color-surface);
}

.yh-table-wrap:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}

/* Fade only the viewport edge, never paint a sticky white layer over data or change table layout. */
.yh-table-wrap[data-overflow-end]:not(:has([data-actions])) {
  mask-image: linear-gradient(to right, black calc(100% - var(--space-4)), transparent);
}

/* Two tables one under the other in a flush card: a line where the first one ends (a table has no bottom border on its last row). */
.yh-table-wrap + .yh-table-wrap {
  border-top-width: 1px;
}

.yh-table {
  width: 100%;
  /* "separate", not "collapse": borders and the shadow of a sticky cell stay with the cell while the table scrolls. */
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-base);
}

.yh-table th,
.yh-table td {
  /* Overridable per cell (below) without raising the specificity of the padding: an application's own rule for the cells of one table still wins. */
  --yh-cell-pad-start: var(--space-4);
  --yh-cell-pad-end: var(--space-4);
  box-sizing: border-box;
  height: var(--row-height);
  /* 1px on top balances the 1px line at the bottom: what is centred in the row lands on a whole pixel (44 - 2 = 42). */
  padding: 1px var(--yh-cell-pad-end) 0 var(--yh-cell-pad-start);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap; /* narrow screens scroll the table instead of breaking Chinese text one character per line */
  line-height: var(--leading-compact);
}

/* A lone badge is centred as a box, independently of the platform font's inline baseline. */
.yh-table td > .yh-badge:only-child {
  display: flex;
  width: max-content;
  max-width: 100%;
}

/*
 * The first and last column start and end at --yh-table-inline-pad: 16px for a table on its own page (the frame is
 * its own, the text sits 16px inside it), the card padding in a flush card (the card draws the frame and the title
 * is at the card padding, so the columns line up with it). A container of an application's own that frames a
 * table sets the property on itself. The cells take it through --yh-cell-pad-start and --yh-cell-pad-end, so the
 * padding itself is still declared once, at the specificity of `.yh-table td`: an application's own rule for the
 * cells of one table (a phone layout that gives 8px back) still wins over it, first and last column included.
 */
.yh-table th:first-child,
.yh-table td:first-child {
  --yh-cell-pad-start: var(--yh-table-inline-pad, var(--space-4));
}

.yh-table th:last-child,
.yh-table td:last-child {
  --yh-cell-pad-end: var(--yh-table-inline-pad, var(--space-4));
}

.yh-table tbody tr {
  /* The row's colour, also read by the fade of the pinned actions cell (below), which must end in exactly this colour. */
  --yh-row-bg: var(--color-surface);
  background: var(--yh-row-bg); /* the sticky actions cell inherits it, so it hides what scrolls underneath */
  transition: background-color var(--duration-fast) var(--ease-out);
}

/* Text never wraps in a cell: what is wider than --cell-max-width is cut with an ellipsis (DataTable and ./dom add the full text as title). */
.yh-table td {
  max-width: var(--cell-max-width);
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * What a table's `empty` slot holds besides an EmptyState (one line of text, a link) sits where the first column
 * starts and has room above and below, instead of touching the edge of the table or the card.
 */
.yh-table-wrap > :where(:not(.yh-table, .yh-empty, .yh-sr-only)) {
  display: block;
  padding: var(--space-4) var(--yh-table-inline-pad, var(--space-4));
}

/*
 * Two-line density: when a column holds CellStack cells, every row is 56px: 8px above the content, 40px of content,
 * 7px and the 1px line below it (8 + 40 + 7 + 1). The content box is even, so a 40px stack, a 28px button and a 24px
 * badge all centre on whole pixels. The header keeps its height.
 */
.yh-table[data-density='two-line'] tbody td {
  height: var(--row-height-two-line);
  padding-top: var(--space-2);
  padding-bottom: calc(var(--space-2) - 1px);
}

/* The last row draws no line (the frame ends the table) but keeps its width, so every row has the same 42px inside. */
.yh-table tbody tr:last-child td {
  border-bottom-color: transparent;
}

/* The header is a quiet caption row: 36px, small secondary text on the card's own surface, a line below it. No grey bar, so the first data row is the first thing the eye lands on. */
.yh-table thead th {
  height: var(--head-height);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  white-space: nowrap;
}

/*
 * Numbers: right-aligned header and cells, digits of equal width so decimals line up. width: 1% makes the column
 * as narrow as its widest content (the same way the actions and checkbox cells do): in an auto-layout table the
 * spare width is shared by columns without a width, and a right-aligned column would put its digits at the far
 * end of a wide cell, with a big empty band to their left. A column with data-wrap keeps its 12rem minimum.
 */
.yh-table [data-align='right'] {
  width: 1%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Free text that may wrap (a description column): 12rem to 28rem wide, never a list. */
.yh-table [data-wrap] {
  min-width: 12rem;
  max-width: 28rem;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

/*
 * Column widths, the packed model (web 0.16.0; docs/consuming-web.md "表格的列宽", handbook web-ui.md 3.6.3). Every
 * column is as wide as its content (width: 1% is the narrowest a column of an auto-layout table can be), a text column
 * at most --cell-max-width and cut there with the tip, the columns one cell padding apart. The spare width of a wide
 * table is collected in one place, the filler cell (data-fill) just before the end cell (actions, chevron), instead of
 * being shared out among the data columns: the cells of a row stay next to its name at 1280 as at 2560, and nothing
 * but the row end sits at the far edge. DataTable and SkeletonTable write the filler; a server-rendered table writes
 * `<th data-fill aria-hidden="true">` / `<td data-fill aria-hidden="true">` in every row to get the same (without one
 * the browser shares the spare width out, as before). No application sets a column width (rule table-width).
 */
.yh-table:has(> thead > tr > [data-fill]) > :is(thead, tbody) > tr > :is(th, td) {
  width: 1%;
}

.yh-table:has(> thead > tr > [data-fill]) > :is(thead, tbody) > tr > [data-fill] {
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
}

/* A table without a row end ends in its filler: the column before it keeps the table's end padding (16px, the card padding in a flush card), so a table with no width to spare (the filler empty, a phone) ends as before. */
.yh-table:has(> thead > tr > [data-fill]) > :is(thead, tbody) > tr > :has(+ [data-fill]:last-child) {
  --yh-cell-pad-end: var(--yh-table-inline-pad, var(--space-4));
}

/* Wrapping free text takes up to 28rem while there is room and gives it back first when there is not (to 12rem). */
.yh-table:has(> thead > tr > [data-fill]) > :is(thead, tbody) > tr > [data-wrap] {
  width: 28rem;
}

/*
 * The primary column (the row's name: `meta.primary`, else DataTable's first column that is not a number, status, time,
 * date, badge, progress, icon or avatar column) is never narrower than 12rem in a
 * wide table (DataTable marks the table `data-wide` while its frame is at least 48rem: a page, a full-width card): a
 * list of short names does not look jammed into its corner, and the columns after it start at the same place from page
 * to page as long as the names fit. A narrower frame (a half-width card, a dialog, a phone) keeps every column at its
 * content, so the minimum never makes a table scroll. (Not a container query: size containment on the frame would
 * collapse a table whose container is as wide as its content.)
 */
.yh-table[data-wide] [data-primary] {
  min-width: 12rem;
}

/* A right-aligned (number) column is never a name: it keeps its content width even when it is marked primary. */
.yh-table[data-wide] [data-primary][data-align='right'] {
  min-width: 0;
}

/*
 * Sentence columns (`meta.wrap: 'long'`: the findings column of ImportPage, a remark): never narrower than 18rem, wrapping
 * at words (a number or a name that fits a line stays whole), also in a narrow frame, where the table scrolls inside its
 * frame instead of squeezing the column to a few characters. Declared after the primary column's 12rem so that it wins when the two meet.
 */
.yh-table [data-wrap='long'],
.yh-table[data-wide] [data-wrap='long'] {
  min-width: 18rem;
  overflow-wrap: break-word;
}

/* A single data column is the record, not one of several packed values. Give it the room before selection/actions,
 * instead of growing an empty filler or enforcing a prose column's 12rem minimum inside a narrow card. */
.yh-table[data-single-column] > :is(thead, tbody) > tr > [data-primary] {
  width: 100%;
  min-width: 0;
}

.yh-table[data-single-column] > tbody > tr > [data-primary][data-wrap] {
  max-width: none;
}

/*
 * The row end. A row that opens something (DataTable `rowHref` or `onRowClick`) ends in a chevron, the last item of
 * the end cell's `.yh-table-actions`, after the row's actions: muted at rest, the secondary colour while the row is
 * hovered or focused. It is drawn, not read: the link in the primary cell (`rowHref`) or the focusable row
 * (`onRowClick`) is what assistive technology meets. Server-rendered rows write
 * the chevron-right icon of the set with the class `yh-table-open` (aria-hidden) there.
 */
/* The filler before it already holds the spare width: the end cell of a row that opens starts 8px before its content. */
.yh-table [data-actions][data-open] {
  --yh-cell-pad-start: var(--space-2);
}

.yh-table-open {
  display: block;
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.yh-table tbody tr[data-clickable]:is(:hover, :focus-visible, :focus-within) .yh-table-open {
  color: var(--color-text-secondary);
}

/*
 * In a table whose rows open (data-opens), a row's own text actions ("设置") are the secondary colour at rest and the
 * brand colour while their row is hovered or holds the focus: a column of the same word repeated down the rows does
 * not compete with the data, and the action is still there, at the row end, on every row and on touch. A danger
 * action keeps its red.
 */
.yh-table[data-opens] > tbody > tr .yh-table-actions .yh-button[data-variant='ghost']:not([data-tone='danger']) {
  color: var(--color-text-secondary);
}

.yh-table[data-opens] > tbody > tr:is(:hover, :focus-within) .yh-table-actions .yh-button[data-variant='ghost']:not([data-tone='danger']) {
  color: var(--color-brand-text);
}

/*
 * The link of a row with `rowHref`: the primary cell's content, in the cell's own look (no link colour, no underline:
 * the row's hover, the chevron and the pointer say it opens). It stays inline and clips nothing itself: the cell (or
 * the CellStack lines inside it) cuts the text and shows the tip, as in any other cell; its focus ring is the row's.
 */
.yh-row-link {
  color: inherit;
  text-decoration: none;
}

@supports selector(:has(*)) {
  .yh-table .yh-row-link:focus-visible {
    outline: none;
  }

  .yh-table tbody tr[data-clickable]:has(> td > .yh-row-link:focus-visible) {
    --yh-row-bg: var(--color-surface-subtle);
    outline: var(--focus-ring);
    outline-offset: -2px;
  }

  .yh-table tbody tr[data-clickable]:has(> td > .yh-row-link:focus-visible) > td[data-actions] {
    border-bottom-color: var(--color-focus);
    box-shadow: inset 0 2px var(--color-focus), inset -2px 0 var(--color-focus), inset 0 -1px var(--color-focus);
  }
}

/* The pinned end cell paints over the row's outline: it draws its part of the ring itself (top, right and, with its 1px bottom line, bottom). */
.yh-table tbody tr[data-clickable]:focus-visible > td[data-actions] {
  border-bottom-color: var(--color-focus);
  box-shadow: inset 0 2px var(--color-focus), inset -2px 0 var(--color-focus), inset 0 -1px var(--color-focus);
}

/*
 * A value that is not there or is nothing: a muted "—" (NoValue) or a muted 0 (numberColumn does both by default). The
 * eye skips it and finds the rows that have something.
 */
.yh-quiet {
  color: var(--color-text-muted);
}

/*
 * Two lines in one cell: the main information, then the supporting one 2px below it. Each line is a box of its own
 * height (20px and 18px: 1.43 and 1.38 times the font size, both above the 1.3 minimum for Chinese text), so the
 * stack is 40px whatever is in the line: a badge, a monospace id or a link may be taller than the text around them
 * and still cannot push the row out of its 56px (8 + 40 + 7 + 1px border); it overflows into the 4px of room each
 * line has around it instead. A two-line row is therefore as high as a row of the same table with one line.
 */
.yh-cell-stack {
  --yh-cell-line-primary: 1.25rem;
  --yh-cell-line-secondary: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
  max-width: var(--cell-max-width);
}

/*
 * An icon before the two lines (an app's AppIcon, 32px, then its name over its kind): 12px apart, centred on the row.
 * The `icon-two-line` placeholder of a loading table is the same box.
 */
.yh-cell-media {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.yh-cell-media > .yh-cell-stack,
.yh-cell-media > .yh-skeleton-stack {
  flex: 1 1 auto;
}

/*
 * Each line clips its overflow for the ellipsis, which would also clip the focus ring of a link or button inside it
 * (2px ring + 2px offset). The padding gives the ring room and the negative margin takes it back, so the box
 * layout, the 2px gap and the row height stay as they were.
 */
.yh-cell-primary,
.yh-cell-secondary {
  box-sizing: content-box;
  min-width: 0;
  padding: var(--space-1);
  margin: calc(var(--space-1) * -1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-cell-primary {
  height: var(--yh-cell-line-primary);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: var(--yh-cell-line-primary);
}

.yh-cell-secondary {
  height: var(--yh-cell-line-secondary);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--yh-cell-line-secondary);
}

/*
 * A badge in a line sits at the top of the line box: the small one (`data-size="sm"`) is 20px, exactly the primary
 * line, so it fills it on whole pixels (vertical-align: middle would centre it on the x-height, half a pixel off).
 */
.yh-cell-primary .yh-badge,
.yh-cell-secondary .yh-badge {
  vertical-align: top;
}

/*
 * The lines of a cell start their text on one vertical line. A first line that starts with a status puts the second
 * line in by the status's own lead, so the date under "有效" starts where "有效" does: the dot and its gap (10px) for
 * the dot state, the badge padding before them (18px) for a filled badge, the padding alone (8px) for a badge without
 * a dot. CellStack sets data-lead from what its first line starts with (plain markup writes it itself); text-indent
 * moves the text only, so the line keeps its box, its ellipsis and its focus room.
 */
.yh-cell-stack[data-lead='badge'] > .yh-cell-secondary {
  text-indent: var(--space-2);
}

.yh-cell-stack[data-lead='badge-dot'] > .yh-cell-secondary {
  text-indent: calc(var(--space-2) + 0.375rem + var(--space-1));
}

.yh-cell-stack[data-lead='dot'] > .yh-cell-secondary {
  text-indent: calc(0.375rem + var(--space-1));
}

/* A monospace identifier in a table follows the same optical match as everywhere (base.css, .yh-mono). */

/* A list that can grow: the first items, then "共 M 项". */
.yh-list-inline {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
  vertical-align: bottom;
}

.yh-list-items {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-list-count {
  flex: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  white-space: nowrap;
}

/* A part cut with an ellipsis is a tab stop (data-cut-tab, set by DataTable and ./dom): a cell or a line in it keeps its
 * ring inside (the rule at the top of this file), where the cell does not clip it. */

.yh-table tbody tr[data-clickable] {
  cursor: pointer;
}

.yh-table tbody tr[data-clickable]:hover,
.yh-table tbody tr[data-clickable]:focus-visible {
  --yh-row-bg: var(--color-surface-subtle);
}

.yh-table tbody tr[aria-selected='true'] {
  --yh-row-bg: var(--color-brand-subtle);
}

/* Data rows remain readable from their first frame. The containing page owns entrance motion;
 * per-row delays leave false gaps in long tables and conflict with sticky cells. */

.yh-table tbody tr[data-clickable]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}

/*
 * The actions cell: pinned to the right edge, so on a narrow screen the other columns scroll underneath it and
 * the actions are never pushed out of sight. While there is more to scroll to (the wrapper carries
 * data-overflow-end; DataTable and ./dom set it) the columns fade out over 32px before the cell, in the row's own
 * colour: a cut column reads as "more this way", never as a glyph chopped in half.
 */
.yh-table td[data-actions],
.yh-table th[data-actions] {
  position: sticky;
  right: 0;
  z-index: 1;
  width: 1%;
  max-width: none;
  overflow: visible;
  white-space: nowrap;
  text-align: left;
  background: inherit;
}

.yh-table thead th[data-actions] {
  --yh-row-bg: var(--color-surface);
  background: var(--yh-row-bg);
}

.yh-table-wrap[data-overflow-end] .yh-table [data-actions]::before {
  content: '';
  position: absolute;
  inset-block: 0;
  right: 100%;
  width: var(--space-8);
  background: linear-gradient(to right, transparent, var(--yh-row-bg, var(--color-surface)));
  pointer-events: none;
}

/* Row actions: the first action starts at the left of the cell, the "⋯" is always the last slot. */
.yh-table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.yh-table-actions .yh-button {
  flex: none;
  min-height: var(--yh-control-sm);
  padding: 0 var(--space-2);
}

/*
 * Row actions are text buttons of one style (docs/design-system-css.md, 表格单元格与行内操作): brand-coloured, red for
 * a danger action, no border or fill until hovered; an outline or filled button never sits in a row. The kit's row
 * actions mark their tone (data-tone); a page's own ghost buttons in the column get the brand colour too.
 */
.yh-table-actions .yh-button[data-variant='ghost'] {
  color: var(--color-brand-text);
  font-weight: var(--weight-normal);
}

.yh-table-actions .yh-button[data-variant='ghost'][data-tone='danger'] {
  color: var(--color-danger);
}

.yh-table-actions .yh-button[data-variant='ghost'][data-tone='danger']:hover {
  --yh-button-fill: var(--color-danger-subtle);
}

/*
 * Each button position is a slot as wide as the widest label any row has there (invisible copies of the other
 * labels share its grid cell): a row with fewer actions leaves the slot empty, and nothing after it moves.
 */
.yh-table-slot {
  display: inline-grid;
  flex: none;
  justify-items: start;
}

.yh-table-slot > * {
  grid-area: 1 / 1;
}

.yh-table-slot > [data-sizer] {
  visibility: hidden;
  pointer-events: none;
}

.yh-table-actions .yh-icon-button {
  width: var(--yh-control-sm);
  min-height: var(--yh-control-sm);
}

.yh-table-more {
  flex: none;
  margin-left: auto;
}

/* A row with fewer actions keeps the slot, so the "⋯" of the other rows stays in one column. */
.yh-table-more[data-empty] {
  display: block;
  width: var(--yh-control-sm);
  height: var(--yh-control-sm);
}

/* A row of controls inside a cell never wraps: the row keeps its height. */
.yh-table .yh-row {
  flex-wrap: nowrap;
}

.yh-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--head-height);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

/* Reserve the arrow and gap before sorting; auto-layout must not resize empty or loading tables. */
.yh-sort:not([data-direction]) > .yh-sort-indicator { visibility: hidden; }

.yh-sort:hover {
  color: var(--color-text);
}

/* Content refreshing behind the old rows: keep the rows, dim them. */
.yh-table-wrap[aria-busy='true']:not([data-loading]) .yh-table tbody {
  opacity: 0.55;
}

/* ------------------------------------------------------------ filter bar and toolbar */

.yh-more-filters:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--gap-field);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.yh-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  /* In a flush card the bar is a strip of the card: its padding at the sides, a line towards the table. Elsewhere the parent's gap spaces it. */
  padding: calc(var(--space-3) * var(--yh-flush, 0)) calc(var(--card-padding) * var(--yh-flush, 0));
  border-bottom: calc(1px * var(--yh-flush, 0)) solid var(--color-border);
}

.yh-filters .yh-input[type='search'],
.yh-filters .yh-search-box {
  width: 16rem;
  max-width: 100%;
}

/* The outer search box owns the filter width, including its clear button. */
.yh-filters .yh-search-box > .yh-input {
  width: 0;
}

.yh-filters .yh-select,
.yh-filters .yh-select-trigger {
  width: auto;
  min-width: 8rem;
}

/* List display preferences stay at the right edge, including when the filters wrap. */
.yh-column-settings {
  margin-inline-start: auto;
  flex: 0 0 auto;
}

.yh-column-settings-panel {
  width: 18rem;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
}

.yh-column-settings-title {
  margin: 0;
  font-weight: var(--weight-medium);
}

/* The list scrolls and its checkboxes and arrows sit at its edges: --focus-room (taken back by the margin) keeps their rings whole. */
.yh-column-settings-list {
  list-style: none;
  margin: calc(var(--focus-room) * -1);
  padding: var(--focus-room);
  max-height: 50vh;
  overflow-y: auto;
}

.yh-column-settings-row {
  display: flex;
  align-items: center;
  gap: var(--gap-choice);
}

.yh-column-settings-row > .yh-check {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.yh-column-settings-moves {
  display: flex;
  flex: 0 0 auto;
}

.yh-column-settings-fixed {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.yh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ------------------------------------------------------------ row selection and the bulk-action bar */

/* The checkbox column of a table with row selection: as narrow as the box, the box centred on the row; the whole cell is the target. */
.yh-table th[data-select],
.yh-table td[data-select] {
  --yh-cell-pad-end: var(--space-1);
  width: 1%;
  max-width: none;
}

.yh-table-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--yh-control-sm);
  min-height: var(--yh-control-sm);
  margin-inline: calc((var(--yh-control-sm) - 1.125rem) / -2);
  cursor: pointer;
}

.yh-table tbody tr[data-selected] {
  --yh-row-bg: var(--color-brand-subtle);
}

/* Disabled checkboxes pass touch to their focusable explanation, not to the row's detail action. */
.yh-table-select[data-tip] {
  border-radius: var(--radius-sm);
  outline-offset: -2px;
}
.yh-table-select[data-tip] > input:disabled {
  pointer-events: none;
}

/*
 * Row highlight (DataTable highlightRowId, docs/design-system-css.md 行高亮): the row that was just created or changed
 * holds --color-highlight for 1 s, over its hover and selection, appearing at once; then (data-highlight="fade") it goes
 * back to its own colour over --duration-slow. The reduced-motion rule makes that 1ms. The pinned actions cell inherits
 * the row's background, so it follows. Nothing here takes input away: it is only a colour.
 */
.yh-table tbody tr[data-highlight='hold'],
.yh-table tbody tr[data-highlight='hold']:is(:hover, :focus-visible) {
  --yh-row-bg: var(--color-highlight);
  transition: none;
}

.yh-table tbody tr[data-highlight='fade'] {
  transition: background-color var(--duration-slow) var(--ease-out);
}

/*
 * Editing in place (DataTable onSave / onCreate, docs/design-system-css.md 表内录入). One row at a time becomes its
 * editors; nothing moves when it does: the control's text starts where the column's text starts (the control reaches
 * --yh-control-inset into the cell padding on both sides), it sits where a centred 36px control sits in the 44px row, and
 * an editable cell shows that same frame on hover. The phone form (yh-table-edit-form) is the row's editors one under
 * another, as wide as the visible table.
 */
.yh-table {
  /* Top of a control centred in a row: 4px in a 44px row; never above the 1px top padding (44px controls on touch). */
  --yh-edit-top: max(1px, calc((var(--row-height) - var(--control-height)) / 2));
}

.yh-table[data-density='two-line'] {
  --yh-edit-top: max(1px, calc((var(--row-height-two-line) - var(--control-height)) / 2));
}

.yh-table td[data-editable] {
  position: relative;
  cursor: text;
}

.yh-table td[data-editable]::after {
  content: '';
  position: absolute;
  top: calc(50% - var(--control-height) / 2 + 0.5px);
  height: var(--control-height);
  left: calc(var(--yh-cell-pad-start) - var(--yh-control-inset));
  right: calc(var(--yh-cell-pad-end) - var(--yh-control-inset));
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  pointer-events: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .yh-table td[data-editable]:hover::after {
    border-color: var(--color-control-border);
  }
}

/* While a row is edited the columns keep their widths (DataTable sets them from the last layout without editors). */
.yh-table[data-frozen] {
  table-layout: fixed;
}

/* The row being edited (and the new row) on its own background, so its white controls read as one line. */
.yh-table tbody tr[data-editing],
.yh-table tbody tr.yh-table-edit-note,
.yh-table tbody tr.yh-table-form-row {
  --yh-row-bg: var(--color-surface-subtle);
}

/* A row with an error line or a phone form under it (DataTable marks it): one block, no line in between. */
.yh-table tbody tr[data-edit-joined] > td {
  border-bottom-color: transparent;
}

/* Every cell of an inline editing row starts at the top, where the controls start: an error under one cell grows the row downwards only. */
.yh-table tbody tr[data-edit-scope] > td {
  height: auto;
  min-height: var(--row-height);
  padding-top: var(--yh-edit-top);
  padding-bottom: calc(var(--yh-edit-top) - 1px);
  vertical-align: top;
}

/* A read-only cell of that row (text, a status): its line centred on the controls. */
.yh-table tbody tr[data-edit-scope] > td:not([data-editing], [data-actions], [data-select]) {
  padding-top: calc(var(--yh-edit-top) + (var(--control-height) - var(--line-control)) / 2);
  line-height: var(--line-control);
}

/* The actions and the checkbox (28px) centred on the controls (36px). */
.yh-table tbody tr[data-edit-scope] > td:is([data-actions], [data-select]) {
  padding-top: calc(var(--yh-edit-top) + (var(--control-height) - var(--yh-control-sm)) / 2);
}

.yh-table td[data-editing] {
  max-width: none;
  overflow: visible; /* the focus halo of the control is never cut */
  white-space: normal;
}

.yh-table-editor {
  display: flex;
  flex-direction: column;
  gap: var(--gap-label);
  min-width: 8rem;
  margin-inline: calc(var(--yh-control-inset) * -1);
}

.yh-table-editor[data-editor='number'] {
  min-width: 6rem;
}

.yh-table-editor[data-editor='date'] {
  min-width: var(--field-width-sm);
}

.yh-table-editor[data-editor='reference'] {
  min-width: 10rem;
}

/* Frozen columns are already wide enough for their editors (DataTable widens a narrower one): the editor fills the cell. */
.yh-table[data-frozen] .yh-table-editor {
  min-width: 0;
}

/* The control fills the column (a control's own width is for forms). */
.yh-table-editor > :not(.yh-error) {
  width: 100%;
  max-width: none;
}

.yh-table-editor > .yh-error {
  max-width: 16rem;
  margin: 0;
  line-height: var(--line-sm);
}

/*
 * In a cell the buttons inside a choice or a date (clear, calendar) show only while the pointer or the focus is on it:
 * at rest the column's width goes to the name or the date (a cut name shows whole in the kit tip on hover). On the
 * phone form they stay, there is room.
 */
.yh-table-editor .yh-combobox:not(:hover, :focus-within) .yh-combobox-clear,
.yh-table-editor .yh-date:not(:hover, :focus-within) .yh-combobox-button {
  display: none;
}

/* A number column keeps its numbers right-aligned while they are typed. */
.yh-table td[data-align='right'] .yh-table-editor input {
  text-align: right;
}

/* What went wrong with the whole row, under it, from the first column's edge. */
.yh-table tbody tr.yh-table-edit-note > td {
  height: auto;
  max-width: none;
  padding-top: 0;
  padding-bottom: var(--space-3);
  white-space: normal;
}

.yh-table-edit-note .yh-error {
  margin: 0;
}

/* A save that runs while the row already shows its new values (optimistic): the values in the quieter colour until it is done. */
.yh-table tbody tr[data-pending] > td:not([data-actions]) {
  color: var(--color-text-secondary);
}

/* A disabled row action is muted like every disabled button (the brand colour of the column would read as usable). */
.yh-table-actions .yh-button[data-variant='ghost']:is(:disabled, [aria-disabled='true']):not([aria-busy='true']) {
  color: var(--color-text-muted);
}

/* 取消 beside 保存: the same text button, in the text colour (only the action that changes something is brand-coloured). */
.yh-table-actions .yh-button[data-variant='ghost'][data-tone='neutral'] {
  color: var(--color-text-secondary);
}

/* A disabled row action that says why ("编辑" of a row that cannot be edited): the kit tooltip on a focusable wrapper. */
.yh-table-action-tip {
  display: inline-flex;
  border-radius: var(--control-radius);
  outline-offset: -2px;
}

.yh-table-action-tip > .yh-button:disabled {
  pointer-events: none;
}

/* The phone form under the row: as wide as the visible table, never scrolled sideways with the columns. */
.yh-table tbody tr.yh-table-form-row > td {
  height: auto;
  max-width: none;
  padding: 0;
  overflow: visible;
  white-space: normal;
  line-height: var(--leading-base);
}

.yh-table-edit-form {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  max-width: 100%;
  padding: var(--space-2) var(--yh-table-inline-pad, var(--space-4)) var(--space-4);
}

.yh-table-edit-form > .yh-error {
  margin: 0;
}

/*
 * The `under` fields of a row edited on a wide screen: labelled, side by side, in a line of the row's own background
 * under it, the first one where the first column's text starts. They wrap when the table is narrower than all of them.
 */
.yh-table tbody tr.yh-table-under-row {
  --yh-row-bg: var(--color-surface-subtle);
}

.yh-table tbody tr.yh-table-under-row > td {
  height: auto;
  max-width: none;
  padding: 0;
  overflow: visible;
  white-space: normal;
  line-height: var(--leading-base);
}

.yh-table-edit-under {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--gap-field) var(--space-4);
  max-width: 100%;
  padding: var(--space-1) var(--yh-table-inline-pad, var(--space-4)) var(--space-3);
}

.yh-table-edit-under > [data-edit-field] {
  width: var(--field-width-sm);
}

/* "新增一行" under the table: a row of its own, its "+" where the first column's text starts. */
.yh-table-wrap > .yh-table-add {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: var(--row-height);
  padding: 0 var(--yh-table-inline-pad, var(--space-4));
  border-top: 1px solid var(--color-border);
}

.yh-table-add > .yh-button {
  gap: var(--space-1);
  margin-inline-start: calc(var(--space-2) * -1);
  padding: 0 var(--space-2);
  color: var(--color-brand-text);
  font-weight: var(--weight-normal);
}

/*
 * The anchor holds the bar in the flow after the table and sticks to the bottom of the window, so the bar floats over
 * the rows while the page scrolls and the last rows can still be scrolled clear of it. Pointer events go through the
 * anchor (only the bar takes them).
 */
.yh-bulk-anchor {
  position: sticky;
  bottom: 0;
  z-index: var(--z-feedback);
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0 max(var(--space-4), env(safe-area-inset-bottom));
  pointer-events: none;
}

/*
 * A glass capsule (materials.css): 52px high, the 36px buttons inside it 8px from its edge and as round as it is
 * (concentric), the count in front and "取消选择" at the end. On a phone it is as wide as the screen allows and the
 * actions scroll sideways rather than wrap.
 */
.yh-bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  max-width: 100%;
  min-height: calc(var(--yh-control) + 2 * var(--space-2));
  /* 8px from the outer edge to the buttons: 7px of padding inside the 1px hairline. */
  padding: calc(var(--space-2) - 1px) calc(var(--space-2) - 1px) calc(var(--space-2) - 1px) var(--space-5);
  border-radius: var(--bar-radius);
  color: var(--color-text);
  pointer-events: auto;
}

.yh-bulk-count {
  flex: none;
  padding-inline-end: var(--space-3);
  border-inline-end: 1px solid var(--color-border);
  font-weight: var(--weight-medium);
  line-height: var(--line-control);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.yh-bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  /* It scrolls sideways, so it clips: --focus-room around the buttons, taken back by the margin, keeps their rings whole. */
  margin: calc(var(--focus-room) * -1);
  padding: var(--focus-room);
  overflow-x: auto;
  scrollbar-width: none;
}

/* More actions than fit (a phone): the row scrolls, and its end fades out while there are more to the right. */
.yh-bulk-actions[data-overflow-end] {
  mask-image: linear-gradient(to left, transparent, black var(--space-6));
}

.yh-bulk-bar .yh-button,
.yh-bulk-bar .yh-icon-button {
  flex: none;
  border-radius: var(--bar-radius);
}

.yh-bulk-bar[data-state='open'] {
  animation:
    yh-bulk-in var(--duration-spring-bouncy) var(--ease-spring-bouncy),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-bulk-bar[data-state='closed'] {
  animation: yh-bulk-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none;
}

@keyframes yh-bulk-in {
  from {
    transform: translateY(calc((100% + var(--space-4)) * var(--motion-travel))) scale(var(--motion-pop-scale));
  }
}

@keyframes yh-bulk-out {
  to {
    opacity: 0;
    transform: translateY(calc(var(--motion-shift) * 2)) scale(calc((1 + var(--motion-pop-scale)) / 2));
  }
}

@media (max-width: 480px) {
  .yh-bulk-bar {
    width: 100%;
    padding-left: var(--space-4);
  }
}

/* ------------------------------------------------------------ tabs */

/*
 * Tabs (`.yh-tabs`, the root) put the segmented control 16px above the panel. In a flush card the control is inset by
 * the card padding, like the title, and 12px below the card's top edge, while the panel (a table) still runs from edge
 * to edge: a three-column grid whose side columns are the card padding (0 elsewhere), with no margins.
 */
.yh-tabs {
  display: grid;
  grid-template-columns: calc(var(--card-padding) * var(--yh-flush, 0)) minmax(0, 1fr) calc(var(--card-padding) * var(--yh-flush, 0));
  row-gap: var(--gap-field);
  padding-top: calc(var(--space-3) * var(--yh-flush, 0));
  min-width: 0;
}

.yh-tabs > * {
  grid-column: 1 / -1;
  min-width: 0;
}

.yh-tabs > .yh-tabs-list {
  grid-column: 2;
  justify-self: start;
  max-width: 100%;
}

/* Tabs are a segmented control: a grey track with a raised white segment under the selected tab. The track is as wide as its tabs (and scrolls when they do not fit). */
.yh-tabs-list {
  display: flex;
  box-sizing: border-box;
  width: fit-content;
  gap: var(--space-0-5);
  padding: var(--space-0-5);
  overflow-x: auto;
  /* Keep horizontal scrolling without a classic Windows scrollbar changing
   * the track height. Keyboard focus scrolls each tab into view. */
  scrollbar-width: none;
  border-radius: calc(var(--control-radius) + var(--space-0-5));
  background: var(--color-segment);
  position: relative;
}

.yh-tabs-list:is([data-overflow-start], [data-overflow-end]) {
  --yh-tabs-fade-start: 0px;
  --yh-tabs-fade-end: 0px;
  mask-image: linear-gradient(var(--yh-tabs-flow, to right), transparent, black var(--yh-tabs-fade-start), black calc(100% - var(--yh-tabs-fade-end)), transparent);
}

.yh-tabs-list:dir(rtl) {
  --yh-tabs-flow: to left;
}

.yh-tabs-list[data-overflow-start] {
  --yh-tabs-fade-start: var(--space-6);
}

.yh-tabs-list[data-overflow-end] {
  --yh-tabs-fade-end: var(--space-6);
}

.yh-tab {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

/* A count after a tab's label ("待审批 3"): secondary, figures of one width, 4px after the label. */
.yh-tab-count {
  padding-inline-start: var(--space-1);
  color: var(--color-text-secondary);
  font-weight: var(--weight-normal);
  font-variant-numeric: tabular-nums;
}

.yh-tab:hover {
  color: var(--color-text);
}

.yh-tab:active:not([data-state='active'], [aria-selected='true']) {
  background: var(--color-fill-hover);
}

.yh-tab[aria-selected='true'],
.yh-tab[data-state='active'],
.yh-tab[aria-current='page'] {
  background: var(--color-segment-active);
  box-shadow: var(--shadow-control);
  color: var(--color-text);
}

.yh-tab:focus-visible {
  outline-offset: -2px;
}

/*
 * The sliding segment (React TabsList; inputs.tsx measures the selected tab). The track is 10px round with 2px of
 * padding, so the segment is concentric at 8px, the control radius. Once it is placed the selected tab paints nothing of
 * its own and the segment slides to the next tab without overshooting either label. Without it (server-rendered tabs, the first
 * frame, no script) the selected tab paints its own segment (above), the same look without the slide.
 */
.yh-tabs-indicator {
  display: none;
}

.yh-tabs-list[data-indicator] > .yh-tabs-indicator {
  display: block;
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: var(--yh-segment-w, 0);
  border-radius: var(--control-radius);
  background: var(--color-segment-active);
  box-shadow: var(--shadow-control);
  transform: translateX(var(--yh-segment-x, 0));
  transition:
    transform var(--duration-base) var(--ease-out),
    width var(--duration-base) var(--ease-out);
  pointer-events: none;
}

.yh-tabs-list[data-indicator-still] > .yh-tabs-indicator {
  transition: none;
}

.yh-tabs-list[data-indicator] > .yh-tab {
  z-index: 1;
}

.yh-tabs-list[data-indicator] > .yh-tab[data-state='active'] {
  background: transparent;
  box-shadow: none;
}

/* ------------------------------------------------------------ badge */

.yh-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  min-height: 1.5rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--line-sm);
  white-space: nowrap;
}

.yh-badge[data-tone='success'] {
  background: var(--color-success-subtle);
  color: var(--color-success);
}

.yh-badge[data-tone='warning'] {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}

.yh-badge[data-tone='danger'] {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

.yh-badge[data-tone='info'] {
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
}

/* Status badges carry a dot so that the state is not told by colour alone. */
.yh-badge[data-dot]::before {
  content: '';
  flex: none;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Small: 20px, for the main line of a two-line cell. Same text size, so the type levels stay five. */
.yh-badge[data-size='sm'] {
  min-height: 1.25rem;
  padding: 0 var(--space-2);
}

/*
 * Plain: a dot in the colour of the state, then the text in the normal text colour; no background and no side
 * padding, so it lines up with the text above and below it in a cell. The words still say the state.
 */
.yh-badge[data-plain],
.yh-badge[data-plain][data-tone] {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font-weight: var(--weight-normal);
}

.yh-badge[data-plain][data-dot]::before {
  background: var(--color-text-muted);
}

.yh-badge[data-plain][data-tone='success']::before {
  background: var(--color-success);
}

.yh-badge[data-plain][data-tone='warning']::before {
  background: var(--color-warning);
}

.yh-badge[data-plain][data-tone='danger']::before {
  background: var(--color-danger);
}

.yh-badge[data-plain][data-tone='info']::before {
  background: var(--color-brand);
}

/*
 * In a table, a status is the dot and the words, without a background (the quiet way Apple lists show a state): a
 * Badge with a dot inside a table cell is drawn as `data-plain` unless it asks for its fill (`filled`, data-filled).
 * The rows of a tree (Tree, TreeSelect) do the same.
 * Filled badges belong where a state stands alone: beside a page title, in a card header, as the value of a field.
 */
:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot]:not([data-filled]) {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font-weight: var(--weight-normal);
}

:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot]:not([data-filled])::before {
  background: var(--color-text-muted);
}

:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot][data-tone='success']:not([data-filled])::before {
  background: var(--color-success);
}

:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot][data-tone='warning']:not([data-filled])::before {
  background: var(--color-warning);
}

:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot][data-tone='danger']:not([data-filled])::before {
  background: var(--color-danger);
}

:is(.yh-table td, .yh-tree-item) .yh-badge[data-dot][data-tone='info']:not([data-filled])::before {
  background: var(--color-brand);
}

/* ------------------------------------------------------------ alert */

.yh-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.yh-alert[data-tone='info'] {
  border-color: var(--color-brand-subtle);
  background: var(--color-brand-subtle);
}

.yh-alert[data-tone='success'] {
  border-color: var(--color-success-subtle);
  background: var(--color-success-subtle);
}

.yh-alert[data-tone='warning'] {
  border-color: var(--color-warning-subtle);
  background: var(--color-warning-subtle);
}

.yh-alert[data-tone='danger'] {
  border-color: var(--color-danger-border);
  background: var(--color-danger-subtle);
}

.yh-alert-icon {
  --yh-icon: 1.25rem;
  flex: none;
  box-sizing: content-box;
  width: var(--yh-icon);
  height: var(--yh-icon);
  /* Centred on the first line of text (22px; with actions the first line is as high as a button): the icon box is as high as the line. */
  padding-block: calc((var(--yh-alert-line, var(--line-base)) - var(--yh-icon)) / 2);
}

.yh-alert[data-tone='info'] .yh-alert-icon {
  color: var(--color-brand);
}

.yh-alert[data-tone='success'] .yh-alert-icon {
  color: var(--color-success);
}

.yh-alert[data-tone='warning'] .yh-alert-icon {
  color: var(--color-warning);
}

.yh-alert[data-tone='danger'] .yh-alert-icon {
  color: var(--color-danger);
}

.yh-alert-body {
  display: flex;
  flex: 1 1 auto;
  flex-flow: row wrap;
  align-items: flex-start;
  min-width: 0;
  overflow-wrap: anywhere;
}

/*
 * The actions share the message's row, at its end (the message grows, so they need no auto margin), and they wrap under
 * the text, left, only when the row cannot hold the message at 16rem and the buttons. A button is higher than a line of
 * text (36px, 44px on touch, against 22px), so in an alert with actions the first line of the message is as high as a
 * button: the message gets the difference as padding above, which centres the text on the button (the row is as high
 * as the button), and the icon follows (--yh-alert-line). No negative margin and no padding under the text: the last
 * line of text and a wrapped button keep the alert's full padding below them and the row gap of 8px between them.
 */
.yh-alert {
  --yh-alert-overhang: calc((var(--yh-control) - var(--line-base)) / 2);
}

.yh-alert:has(> .yh-alert-body > .yh-alert-actions) {
  --yh-alert-line: var(--yh-control);
}

.yh-alert-body {
  gap: var(--space-2) var(--space-3);
}

.yh-alert-message {
  flex: 1 1 16rem;
  min-width: 0;
}

.yh-alert:has(> .yh-alert-body > .yh-alert-actions) .yh-alert-message {
  padding-block-start: var(--yh-alert-overhang);
}

/* Markup written by hand without the message wrapper (title and text straight in the body) keeps them stacked and full width. */
.yh-alert-body > :is(.yh-alert-title, .yh-alert-text) {
  flex: 1 1 100%;
}

.yh-alert-title {
  margin: 0;
  font-weight: var(--weight-semibold);
}

.yh-alert-text {
  margin: 0;
  color: var(--color-text-secondary);
}

.yh-alert-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: var(--gap-inline);
  max-width: 100%;
}

/* ------------------------------------------------------------ description list */

.yh-dl {
  margin: 0;
}

.yh-dl > div {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.yh-dl > div:last-child {
  border-bottom: 0;
}

/* In a padded card the card's padding is the space at both ends: the first row has no space above, the last none below. */
.yh-card:not([data-flush]) > .yh-dl > div:first-child {
  padding-top: 0;
}

.yh-card:not([data-flush]) > .yh-dl > div:last-child {
  padding-bottom: 0;
}

.yh-dl dt {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  /* A length, not a ratio: 13px x 1.5715 was 20.43px, and stacked on a phone every row below sat on a fraction of a pixel. 22px is the line of the dd beside it. */
  line-height: var(--line-base);
}

.yh-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .yh-dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }
}

/* ------------------------------------------------------------ empty state and skeleton */

.yh-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-secondary);
  text-align: center;
}

.yh-empty > p {
  margin: 0;
}

/*
 * Skeleton (docs/design-system-css.md 加载态与骨架). A bar takes exactly the room of what it stands for: a text bar is one
 * line of its context (1lh, so it follows the font and line height it is set in) with a thinner bar drawn in the
 * middle by the clip; the other shapes take the height of their real part (a control, a badge, an avatar, a block).
 *
 * Time: nothing shows for the first 150ms (a fast load never flashes a skeleton, the room is held all the same); then
 * the bars fade in, and a soft light sweeps across them from left to right every 2.4s (1.6s of travel, then a pause).
 * One light for the whole group: the light is not drawn by each bar over its own width but by an absolutely positioned
 * ::after as wide as the nearest positioned ancestor (`.yh-skeleton-group`, a table, a card), clipped to the bar. Every
 * bar of the group moves the same light at the same time, so it reads as one light crossing them; a transform on an
 * ancestor moves the whole group with it. No style attribute and no variable is set at run time (strict CSP). The kit's
 * script (React `Skeleton`, `./dom`) also starts every sweep on one clock (Animation.startTime), so groups that appeared
 * at different moments sweep together; without it each group sweeps on its own clock. Reduced motion: no sweep.
 */
.yh-skeleton-group {
  position: relative;
}

/* LoadState's holder of a skeleton: no box of its own, the skeleton sits in the parent's layout like the content will. */
.yh-load-state {
  display: contents;
}

.yh-skeleton {
  --yh-sk-h: 1.5em;
  --yh-sk-inset: 0.4em;
  --yh-sk-radius: var(--radius-xs);
  display: block;
  position: static;
  flex: none;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: var(--yh-sk-h);
  background: var(--color-skeleton);
  clip-path: inset(var(--yh-sk-inset) 0 round var(--yh-sk-radius));
  pointer-events: none;
  user-select: none;
  animation: yh-skeleton-in 200ms ease-out 150ms backwards;
}

@supports (height: 1lh) {
  .yh-skeleton {
    /* One line of the context; the bar is 0.7em high in its middle, at most 18px (a large title is not a slab). */
    --yh-sk-h: 1lh;
    --yh-sk-inset: calc((1lh - min(0.7em, 1.125rem)) / 2);
  }
}

.yh-skeleton::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: var(--yh-sk-h);
  /*
   * The light is an 18rem band in the middle of an image 2 widths + 18rem wide; moving the image from 100% to 0% takes
   * the band from just before the left edge to just after the right one. The ::after itself never leaves its box (a
   * transform would add scrollable overflow to the page or to a table that scrolls).
   */
  background: linear-gradient(90deg, transparent calc(50% - 9rem), var(--color-skeleton-highlight) 50%, transparent calc(50% + 9rem)) 100% 0 / calc(200% + 18rem) 100% no-repeat;
  animation: yh-skeleton-sweep 2400ms infinite;
}

/* Inline in a line of text (beside a label, in a title row): a bar of its own width on the line. */
span.yh-skeleton:not([data-shape='block']) {
  display: inline-block;
  vertical-align: top;
}

@keyframes yh-skeleton-in {
  from {
    opacity: 0;
  }
}

@keyframes yh-skeleton-sweep {
  0% {
    background-position-x: 100%;
    animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
  }

  66.667%,
  100% {
    background-position-x: 0%;
  }
}

/*
 * A bar sized by a sample of its text (`sample`, data-sample="2026-10-29 21:12"): ::before sets that text, invisible, so
 * the bar is exactly as wide as the text would be in that place. Generated content is no text of the page: find in page,
 * copying and screen readers do not meet it.
 */
.yh-skeleton[data-sample] {
  width: max-content;
  overflow: hidden;
  color: transparent;
  white-space: nowrap;
}

.yh-skeleton[data-sample]::before {
  content: attr(data-sample);
}

/*
 * Shapes. Text is the default; a heading is a bar 0.65em high in its line, without the 18px cap of a text bar: a 32px
 * page title gets a 21px bar, in proportion to the bold title it stands for, not a hairline.
 */
.yh-skeleton[data-shape='heading'] {
  --yh-sk-radius: var(--radius-sm);
  width: 40%;
}

@supports (height: 1lh) {
  .yh-skeleton[data-shape='heading'] {
    --yh-sk-inset: calc((1lh - 0.65em) / 2);
  }
}

.yh-skeleton[data-shape='circle'] {
  --yh-sk-h: var(--yh-sk-size, 2rem);
  --yh-sk-inset: 0;
  --yh-sk-radius: 50%;
  width: var(--yh-sk-size, 2rem);
}

.yh-skeleton[data-shape='circle'][data-size='xs'],
.yh-skeleton[data-shape='square'][data-size='xs'] {
  --yh-sk-size: 1.25rem;
}

/* An app icon (AppIcon, the launcher's tiles): a square with the tile's rounded corners (11 of its 48 units). */
.yh-skeleton[data-shape='square'] {
  --yh-sk-h: var(--yh-sk-size, 2rem);
  --yh-sk-inset: 0;
  --yh-sk-radius: 22.5%;
  width: var(--yh-sk-size, 2rem);
}

.yh-skeleton[data-shape='square'][data-size='icon'] { --yh-sk-size: var(--icon-size); }
.yh-skeleton[data-shape='square'][data-size='sm'] { --yh-sk-size: 1.5rem; }
.yh-skeleton[data-shape='square'][data-size='lg'] { --yh-sk-size: 2.5rem; }
.yh-skeleton[data-shape='square'][data-size='xl'] { --yh-sk-size: 4rem; }

.yh-skeleton[data-shape='circle'][data-size='dot'] {
  --yh-sk-size: 0.5rem;
}

.yh-skeleton[data-shape='circle'][data-size='icon'] {
  --yh-sk-size: var(--icon-size);
}

.yh-skeleton[data-shape='circle'][data-size='sm'] {
  --yh-sk-size: 1.5rem;
}

.yh-skeleton[data-shape='circle'][data-size='lg'] {
  --yh-sk-size: 2.5rem;
}

.yh-skeleton[data-shape='circle'][data-size='xl'] {
  --yh-sk-size: 4rem;
}

/*
 * A control or a button is not a filled slab: it is the real control's empty frame (`.yh-skeleton-frame`: the input's
 * border, surface, height and radius; a plain button's hairline, surface and shadow) with one short bar inside where
 * its text goes. It appears after the same delay as the bars. Its heights are the kit's control heights, which grow
 * to the touch target on a touch screen.
 */
.yh-skeleton-frame {
  display: inline-flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  width: 6rem;
  max-width: 100%;
  min-height: var(--yh-control, var(--control-height));
  padding: 0 var(--space-3);
  overflow: hidden;
  border: 1px solid var(--color-control-border);
  border-radius: var(--control-radius);
  background: var(--color-surface);
  line-height: var(--line-control);
  vertical-align: middle;
  pointer-events: none;
  user-select: none;
  animation: yh-skeleton-in 200ms ease-out 150ms backwards;
}

div.yh-skeleton-frame {
  display: flex;
}

/* A multi-line text box (FormField `multiline`): the textarea's height, its bar on the first line. */
.yh-skeleton-frame.yh-skeleton-textarea {
  align-items: flex-start;
  min-height: 5.5rem;
  padding-block: var(--space-2);
}

/* The bar of an input: a short value, at most 8em. */
.yh-skeleton-frame[data-shape='control'] > .yh-skeleton:not([data-sample]) {
  width: min(40%, 8em);
}

.yh-skeleton-frame[data-shape='button'] {
  justify-content: center;
  width: auto;
  padding: 0 var(--space-4);
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-control);
  font-weight: var(--weight-medium);
}

.yh-skeleton-frame[data-size='sm'] {
  min-height: var(--yh-control-sm, var(--control-height-sm));
}

/* A small button: the real one's 8px sides and its text size (the kit's small button keeps the body size). */
.yh-skeleton-frame[data-size='sm'][data-shape='button'] {
  padding: 0 var(--space-2);
}

.yh-skeleton-frame[data-size='lg'] {
  min-height: var(--yh-control-lg, var(--control-height-lg));
}

/*
 * A real part of the kit that holds a bar (a status badge's dot, a row action's padding, a checkbox, a step marker):
 * it fades in with the bars, takes no pointer, and is no positioned box of its own, so the group's one light crosses
 * the bar inside it.
 */
.yh-skeleton-host {
  pointer-events: none;
  user-select: none;
  animation: yh-skeleton-in 200ms ease-out 150ms backwards;
}

.yh-button.yh-skeleton-host {
  position: static;
  --yh-button-shadow: none;
}

/* A status in a loading table: the badge's dot in the bar colour. */
.yh-badge[data-dot].yh-skeleton-host:not([data-filled])::before {
  background: var(--color-skeleton);
}

/* A badge: as high as `.yh-badge` (24px) and as round. */
.yh-skeleton[data-shape='badge'] {
  --yh-sk-h: 1.5rem;
  --yh-sk-inset: 0;
  --yh-sk-radius: var(--radius-full);
  width: 3.5rem;
}

/*
 * In a line of text it sits on the line as a status badge does: a StatusBadge is an inline flex box whose baseline is
 * the bottom of its 6px dot (its first item), so a line holding one is a pixel taller than a line of text. The
 * placeholder has the same empty dot, without colour.
 */
span.yh-skeleton[data-shape='badge'] {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
}

span.yh-skeleton[data-shape='badge']::before {
  content: '';
  width: 0;
  height: 0.375rem;
}

/* A progress bar or meter track: 6px, round, in the middle of its line. */
.yh-skeleton[data-shape='bar'] {
  --yh-sk-radius: var(--radius-full);
  width: 6rem;
}

@supports (height: 1lh) {
  .yh-skeleton[data-shape='bar'] {
    --yh-sk-inset: calc((1lh - 0.375rem) / 2);
  }
}

/*
 * A block (a chart, a picture, a preview): 5rem by default, a height step (data-h, in rem), a ratio (data-ratio) or the
 * whole height of its container (data-fill). Its corners follow the container's concentric radius where one is set,
 * else the control radius. A block sweeps its own light (it is usually the whole width anyway).
 */
.yh-skeleton[data-shape='block'] {
  --yh-sk-h: 5rem;
  --yh-sk-inset: 0;
  --yh-sk-radius: var(--yh-inner-radius, var(--radius-md));
  position: relative;
}

.yh-skeleton[data-shape='block']::after {
  top: 0;
  bottom: 0;
  height: auto;
}

.yh-skeleton[data-ratio] {
  height: auto;
}

.yh-skeleton[data-ratio='1'] { aspect-ratio: 1; }
.yh-skeleton[data-ratio='4/3'] { aspect-ratio: 4 / 3; }
.yh-skeleton[data-ratio='3/2'] { aspect-ratio: 3 / 2; }
.yh-skeleton[data-ratio='16/9'] { aspect-ratio: 16 / 9; }
.yh-skeleton[data-ratio='2'] { aspect-ratio: 2; }
.yh-skeleton[data-ratio='3'] { aspect-ratio: 3; }
.yh-skeleton[data-ratio='4'] { aspect-ratio: 4; }

.yh-skeleton[data-fill] {
  height: 100%;
  min-height: 5rem;
}

.yh-skeleton[data-h='2'] { --yh-sk-h: 2rem; }
.yh-skeleton[data-h='3'] { --yh-sk-h: 3rem; }
.yh-skeleton[data-h='4'] { --yh-sk-h: 4rem; }
.yh-skeleton[data-h='6'] { --yh-sk-h: 6rem; }
.yh-skeleton[data-h='8'] { --yh-sk-h: 8rem; }
.yh-skeleton[data-h='10'] { --yh-sk-h: 10rem; }
.yh-skeleton[data-h='12'] { --yh-sk-h: 12rem; }
.yh-skeleton[data-h='15'] { --yh-sk-h: 15rem; }
.yh-skeleton[data-h='16'] { --yh-sk-h: 16rem; }
.yh-skeleton[data-h='20'] { --yh-sk-h: 20rem; }
.yh-skeleton[data-h='24'] { --yh-sk-h: 24rem; }
.yh-skeleton[data-h='30'] { --yh-sk-h: 30rem; }

/*
 * Widths without a style attribute (strict CSP: style-src 'self'): data-w is a percentage of the line in steps of 5,
 * data-em a length in em (a label of four characters is 4em).
 */
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='10'] { width: 10%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='15'] { width: 15%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='20'] { width: 20%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='25'] { width: 25%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='30'] { width: 30%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='35'] { width: 35%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='40'] { width: 40%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='45'] { width: 45%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='50'] { width: 50%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='55'] { width: 55%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='60'] { width: 60%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='65'] { width: 65%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='70'] { width: 70%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='75'] { width: 75%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='80'] { width: 80%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='85'] { width: 85%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='90'] { width: 90%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='95'] { width: 95%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-w='100'] { width: 100%; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='1'] { width: 1em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='2'] { width: 2em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='3'] { width: 3em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='4'] { width: 4em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='5'] { width: 5em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='6'] { width: 6em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='7'] { width: 7em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='8'] { width: 8em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='9'] { width: 9em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='10'] { width: 10em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='12'] { width: 12em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='14'] { width: 14em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='16'] { width: 16em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='20'] { width: 20em; }
:is(.yh-skeleton, .yh-skeleton-frame)[data-em='24'] { width: 24em; }

/* Right-aligned (a number column): the bar ends where the numbers end. */
.yh-skeleton[data-align='end'],
.yh-skeleton-frame[data-align='end'] {
  margin-inline-start: auto;
}

/* Reduced motion: no sweep, and the bars appear at once (still after the delay, so a fast load still shows nothing). */
@media (prefers-reduced-motion: reduce) {
  .yh-skeleton::after {
    display: none;
    animation: none;
  }

  .yh-skeleton,
  .yh-skeleton-frame,
  .yh-skeleton-host,
  .yh-loading-status {
    animation-duration: var(--duration-instant);
  }
}

/* Windows high contrast: the bars are drawn faintly in the system's grey instead of disappearing. */
@media (forced-colors: active) {
  .yh-skeleton {
    background: GrayText;
    opacity: 0.4;
  }
}

/*
 * Presets. Each is the markup of the real part (a card, a description list, a table, a stat, a form, a list row) with
 * bars in the place of the text, so its height is the real part's by construction (gallery:shots checkSkeletons holds
 * every preset to 2px of its loaded counterpart, light and dark).
 */
.yh-skeleton-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.yh-skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--gap-inline);
  min-width: 0;
}

.yh-skeleton-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.yh-skeleton-cell[data-align='end'] {
  justify-content: flex-end;
}

/* The buttons of a form stack on a phone, as `.yh-form-actions .yh-button` do. */
@media (max-width: 480px) {
  .yh-form-actions > .yh-skeleton-frame {
    flex: 1 1 100%;
  }
}

/* A two-line table cell: the CellStack's two lines, 2px apart; the second in the small size. */
.yh-skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.yh-skeleton-stack > .yh-skeleton:first-child {
  line-height: 1.25rem;
}

.yh-skeleton-stack > .yh-skeleton + .yh-skeleton {
  font-size: var(--text-sm);
  line-height: 1.125rem;
}

/*
 * A value of a description list followed by a small button (a "复制"): the value's line and the button side by side,
 * centred, as `.yh-dl-value` lays out the real one.
 */
.yh-skeleton-value,
.yh-dl-value {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

/* A tree that is loading: rows indented by level without a style attribute (data-skeleton-level 1–3). */
.yh-tree-item[data-skeleton-level='1'] { --yh-tree-level: 1; }
.yh-tree-item[data-skeleton-level='2'] { --yh-tree-level: 2; }
.yh-tree-item[data-skeleton-level='3'] { --yh-tree-level: 3; }

.yh-tree[data-skeleton] > .yh-tree-item {
  cursor: default;
}

/* The launcher's tiles while the list loads: the icon is the launcher's 40px. */
.yh-launcher-item > .yh-skeleton[data-shape='square'] {
  --yh-sk-size: var(--launcher-icon);
}

.yh-launcher-item > .yh-skeleton-name {
  display: flex;
  justify-content: center;
  width: 100%;
}

/*
 * A log that is loading, in the log viewer's own dark box: monospace lines of the box's line height, light bars on the
 * dark surface in both themes (the viewer is dark in both).
 */
.yh-skeleton-log {
  --color-skeleton: var(--color-skeleton-inverse);
  --color-skeleton-highlight: var(--color-skeleton-inverse-highlight);
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: var(--font-mono);
}

/* A log line with its prefix (SkeletonLog `stamp`): the prefix's bar, a character's space, the message's bar. */
.yh-skeleton-log-line {
  display: flex;
  gap: 1ch;
  min-width: 0;
}

.yh-skeleton-log-line > .yh-skeleton:last-child {
  flex: 0 1 auto;
}

/* A Select whose options are still loading: the real control, not greyed, with a bar where the value will be. */
.yh-select-loading {
  flex: 1 1 auto;
  min-width: 0;
}

.yh-select-trigger[data-loading]:disabled {
  --yh-field-fill: var(--color-surface);
  color: var(--color-text);
  cursor: progress;
}

/*
 * The title row of a page that is loading keeps a control's height: a status badge or the buttons that come with the
 * data cannot make it grow when they arrive.
 */
.yh-page-head[data-loading] .yh-page-header {
  min-height: var(--yh-control, var(--control-height));
}

/* A form's tab bar while the form loads: the real bar, the first tab chosen, nothing pressable. */
.yh-tabs-list[data-skeleton] {
  pointer-events: none;
}

/*
 * A wrapping table cell while it loads (`data-wrap`): a typical sentence, transparent, wraps in the cell as the real text
 * will; each of its lines carries a bar (the background of every line box, `box-decoration-break: clone`), so the column
 * takes its share of the table and the row its height. It has no sweep of its own (it fades in with the bars).
 */
.yh-skeleton-lines {
  color: transparent;
  background: linear-gradient(var(--color-skeleton), var(--color-skeleton)) 0 50% / 100% min(0.7em, 1.125rem) no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  pointer-events: none;
  user-select: none;
  animation: yh-skeleton-in 200ms ease-out 150ms backwards;
}

.yh-skeleton-lines::before {
  content: attr(data-sample);
}

/* A link column (`link`): its sample is measured in the link's weight, as wide as the link will be. */
.yh-skeleton-link {
  font-weight: var(--weight-medium);
}

/* The place of WorkRow's arrow (a 16px icon). */
.yh-skeleton-go {
  display: inline-block;
  width: var(--icon-size);
  height: var(--icon-size);
}

/* A grid with a fixed number of columns (data-columns); without it the grid's own auto-fit. */
.yh-grid[data-columns='2'] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.yh-grid[data-columns='3'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.yh-grid[data-columns='4'] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 640px) {
  .yh-grid[data-columns] { grid-template-columns: minmax(0, 1fr); }
}

/*
 * Content that took the place of a skeleton fades in (160ms), only when the skeleton was really shown (the load took
 * longer than its 150ms delay); a fast load shows the content at once. React adds it (LoadState, DataTable, the page
 * templates); a server-rendered page adds `.yh-loaded` to what it puts in place of the skeleton.
 */
.yh-loaded {
  animation: yh-loaded var(--duration-fast) var(--ease-out) backwards;
}

@keyframes yh-loaded {
  from {
    opacity: 0;
  }
}

/* ------------------------------------------------------------ pagination */

.yh-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  /* In a flush card the pagination is a strip of the card, like the filter bar. Elsewhere the parent's gap spaces it. */
  padding: calc(var(--space-3) * var(--yh-flush, 0)) calc(var(--card-padding) * var(--yh-flush, 0));
  border-top: calc(1px * var(--yh-flush, 0)) solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/*
 * The page-size select and the pager (previous, "第 2 / 12 页", next) are two units: on a narrow screen the pager goes
 * under the select as a whole, at the right, instead of the page text breaking into one character per line.
 */
/* Pages by cursor: no total on the left, so the controls keep the right end. */
.yh-pagination[data-cursor] {
  justify-content: flex-end;
}

.yh-pagination-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-inline);
}

.yh-pagination-pager {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-inline);
  white-space: nowrap;
}

/* The "rows per page" select of the pagination: as wide as its longest choice, not the whole row. */
.yh-pagination-size {
  width: auto;
}

/* ------------------------------------------------------------ timeline */

/*
 * Timeline (docs/design-system-css.md 时间线): events 16px apart; a 16px marker column, the text 12px after it, so the
 * text of every event starts at one x. The marker sits on the centre of the title's first line; the rail is a 1px line
 * on the marker column's centre, one segment per event from 4px under its marker to 4px above the next marker (a dot or
 * ring is 8px, an icon 16px; data-mark and data-next-mark on the item say which, --yh-mark and --yh-next-mark carry them).
 */
.yh-timeline {
  --yh-mark-col: var(--icon-size);
  --yh-mark-y: calc(var(--line-base) / 2);
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-timeline-item {
  --yh-mark: 0.5rem;
  --yh-next-mark: 0.5rem;
  position: relative;
  display: grid;
  grid-template-columns: var(--yh-mark-col) minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: start;
}

.yh-timeline-item[data-mark='icon'] {
  --yh-mark: var(--icon-size);
}

.yh-timeline-item[data-next-mark='icon'] {
  --yh-next-mark: var(--icon-size);
}

.yh-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  top: calc(var(--yh-mark-y) + var(--yh-mark) / 2 + var(--space-1));
  bottom: calc(var(--yh-next-mark) / 2 + var(--space-1) - var(--yh-mark-y) - var(--gap-field));
  left: calc(var(--yh-mark-col) / 2 - 0.5px);
  width: 1px;
  background: var(--color-border-hover);
}

.yh-timeline-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--yh-mark-col);
  height: var(--line-base);
  color: var(--color-text-muted);
}

/* The neutral marker: a dot in the muted colour. A pending step: a ring (hollow), the text quieter. */
.yh-timeline-item[data-mark='dot'] > .yh-timeline-marker::before {
  content: '';
  box-sizing: border-box;
  width: var(--yh-mark);
  height: var(--yh-mark);
  border-radius: var(--radius-full);
  background: currentColor;
}

.yh-timeline-item[data-pending] > .yh-timeline-marker::before {
  border: 1.5px solid currentColor;
  background: transparent;
}

.yh-timeline-item[data-tone='success'] > .yh-timeline-marker {
  color: var(--color-success);
}

.yh-timeline-item[data-tone='warning'] > .yh-timeline-marker {
  color: var(--color-warning);
}

.yh-timeline-item[data-tone='danger'] > .yh-timeline-marker {
  color: var(--color-danger);
}

.yh-timeline-item[data-tone='info'] > .yh-timeline-marker {
  color: var(--color-brand);
}

.yh-timeline-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.yh-timeline-title {
  font-weight: var(--weight-medium);
  line-height: var(--line-base);
  overflow-wrap: anywhere;
}

.yh-timeline-meta {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-timeline-meta time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yh-timeline-reason {
  color: var(--color-text-secondary);
  line-height: var(--line-base);
  overflow-wrap: anywhere;
}

.yh-timeline-item[data-pending] .yh-timeline-title {
  color: var(--color-text-secondary);
  font-weight: var(--weight-normal);
}

.yh-timeline-details-body {
  padding-top: var(--space-2);
}

/* Placeholder events of the first load: bars in the title and meta lines, which keep their own heights. */

/* ------------------------------------------------------------ chart (TrendChart, RankingChart) */

.yh-chart {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  min-width: 0;
  color: var(--color-text);
  font-size: var(--text-sm);
}

.yh-chart-plot {
  position: relative;
  width: 100%;
  min-width: 0;
}

/*
 * A ranking's rows carry a hover highlight with 8px between its edge and the content (labels, bars, values) on both
 * sides. The plot reaches 8px past the chart on each side for it, so the labels stay in line with the card title and
 * the "查看数据表" button; the highlight never leaves the card (its padding is at least 16px).
 */
.yh-chart[data-kind='ranking'] > .yh-chart-plot {
  width: calc(100% + var(--space-2) * 2);
  margin-inline: calc(var(--space-2) * -1);
}

.yh-chart-plot > svg {
  display: block;
  max-width: 100%;
  overflow: visible;
}

.yh-chart-empty {
  margin: 0;
  padding: var(--space-6) 0;
  color: var(--color-text-muted);
  text-align: center;
}

.yh-chart-grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.yh-chart-grid[data-zero] {
  stroke: var(--color-control-border);
}

.yh-chart-axis {
  fill: var(--color-text-muted);
  font-size: var(--text-xs);
}

.yh-chart-label,
.yh-chart-value {
  font-size: var(--text-sm);
}

.yh-chart-label {
  fill: var(--color-text);
}

.yh-chart-value {
  fill: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.yh-chart-crosshair {
  stroke: var(--color-text-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.yh-chart-series {
  --yh-series: var(--color-brand);
}

.yh-chart-line {
  fill: none;
  stroke: var(--yh-series, var(--color-brand));
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* A marker has a ring of the surface colour so that it stays apart from a line it sits on. */
.yh-chart-dot {
  fill: var(--yh-series, var(--color-brand));
  stroke: var(--color-surface);
  stroke-width: 2;
}

.yh-chart-bar {
  fill: var(--color-brand);
}

/* A value of 0: a short stub at the baseline in the muted colour, so the row reads "0", not "missing". */
.yh-chart-zero {
  fill: var(--color-text-muted);
}

/* The hovered row: the hover fill of every list row, the control radius (charts.tsx sets rx; this keeps it on the token). */
.yh-chart-band {
  fill: transparent;
  rx: var(--radius-md);
}

.yh-chart-row[data-active] .yh-chart-band {
  fill: var(--color-fill-hover);
}

.yh-chart-hit {
  fill: transparent;
  touch-action: pan-y;
}

@supports (interpolate-size: allow-keywords) {
  :root:not([data-platform-fallback]) :is(.yh-chart-data, .yh-timeline-details) { interpolate-size: allow-keywords; }
  :root:not([data-platform-fallback]) :is(.yh-chart-data, .yh-timeline-details)::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size var(--duration-fast) var(--ease-out), content-visibility var(--duration-fast) allow-discrete;
  }
  :root:not([data-platform-fallback]) :is(.yh-chart-data, .yh-timeline-details)[open]::details-content { block-size: auto; }
  @starting-style { :root:not([data-platform-fallback]) :is(.yh-chart-data, .yh-timeline-details)[open]::details-content { block-size: 0; } }
}
@media (prefers-reduced-motion: reduce) { :is(.yh-chart-data, .yh-timeline-details)::details-content { transition: none; } }

.yh-chart-tooltip {
  position: absolute;
  z-index: var(--z-popover);
  min-width: 6rem;
  max-width: 16rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  font-size: var(--text-xs);
  pointer-events: none;
}

.yh-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: var(--gap-field);
}

.yh-stat {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow-wrap: anywhere;
}

.yh-stat dt { color: var(--color-text-secondary); }
.yh-stat dd { display: flex; flex-direction: column; gap: var(--gap-title-text); margin: 0; }
.yh-stat-value { display: block; min-width: 0; font-size: var(--text-2xl); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.yh-stat-value[data-long] { font-size: var(--text-base); }
.yh-stat-description { color: var(--color-text-secondary); font-size: var(--text-sm); }
.yh-stat-action { position: absolute; inset: 0; width: 100%; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.yh-stat-action:focus-visible { outline-offset: -3px; }
.yh-stat-action:disabled { cursor: default; }
.yh-stat[data-pressed] { border-color: var(--color-brand); background: var(--color-brand-subtle); }
.yh-stat[data-interactive]:not([data-disabled]):hover { border-color: var(--color-brand); }

.yh-checklist { --yh-step-marker: 1.75rem; display: flex; flex-direction: column; gap: var(--gap-head-content); }
.yh-checklist-heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.yh-checklist-items { display: flex; flex-direction: column; gap: var(--gap-field); padding: 0; margin: 0; list-style: none; }
.yh-checklist-item { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
.yh-checklist-content { display: flex; flex: 1; flex-direction: column; gap: var(--gap-title-text); min-width: 0; overflow-wrap: anywhere; }
.yh-checklist-item > .yh-step-marker { flex: none; }
.yh-checklist-item[data-complete] > .yh-step-marker { color: var(--color-on-brand); background: var(--color-brand); border-color: var(--color-brand); }
.yh-checklist-item > .yh-button { flex: none; }

@media (max-width: 480px) {
  .yh-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.yh-chart-tooltip-title {
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.yh-chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.yh-chart-tooltip-row strong {
  margin-left: auto;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.yh-chart-tooltip-row > span:not(.yh-chart-swatch),
.yh-chart-tooltip-row strong { min-width: 0; overflow-wrap: anywhere; }

.yh-chart-swatch {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--yh-series, var(--color-brand));
}

.yh-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-secondary);
}

.yh-chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.yh-chart-data {
  min-width: 0;
}

/*
 * A disclosure (`<details>` with `<summary class="yh-disclosure">`): the browser's triangle is gone; a chevron from the
 * icon set after the text (so the text lines up with the title above) turns down when it is open. A brand text
 * button: 20px line, 44px tall on touch, the focus ring round it.
 * Reusable wherever something is shown on demand ("查看数据表").
 */
.yh-disclosure {
  display: flex;
  align-items: center;
  width: fit-content;
  gap: var(--space-1);
  min-height: var(--line-control);
  border-radius: var(--radius-sm);
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
  line-height: var(--line-control);
  list-style: none;
  cursor: pointer;
}

.yh-disclosure::-webkit-details-marker,
.yh-disclosure::marker {
  display: none;
  content: '';
}

@media (pointer: coarse) {
  .yh-disclosure {
    min-height: var(--hit-target);
  }
}

.yh-disclosure:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.yh-disclosure-icon {
  flex: none;
  width: 14px;
  height: 14px;
  transition: transform var(--duration-fast) var(--ease-out);
}

details[open] > .yh-disclosure .yh-disclosure-icon {
  transform: rotate(90deg);
}

.yh-disclosure:focus-visible,
.yh-chart-table-wrap:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.yh-chart-table-wrap {
  max-height: 16rem;
  overflow: auto;
}

.yh-chart-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.yh-chart-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.yh-chart-table th,
.yh-chart-table td {
  padding: var(--space-1) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--weight-normal);
  text-align: left;
}

.yh-chart-table thead th {
  color: var(--color-text-secondary);
}

.yh-chart-table [data-align='right'] {
  text-align: right;
}

/* Usage and long identifiers: layout belongs to the component, outer spacing to its parent. */
.yh-meter,
.yh-copyable-value {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: var(--gap-choice);
  margin: 0;
}

.yh-meter-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap-choice) var(--gap-inline);
  overflow-wrap: anywhere;
}

.yh-meter-value {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}

.yh-meter-bar {
  display: block;
  fill: var(--color-brand);
}

.yh-meter-track {
  fill: var(--color-surface-subtle);
}

.yh-meter[data-tone='warning'] .yh-meter-bar {
  fill: var(--color-warning);
}

.yh-meter[data-tone='danger'] .yh-meter-bar {
  fill: var(--color-danger);
}

.yh-meter-note {
  font-size: var(--text-sm);
}

.yh-meter[data-tone='warning'] .yh-meter-note {
  color: var(--color-warning);
}

.yh-meter[data-tone='danger'] .yh-meter-note,
.yh-copyable-value > [data-tone='danger'] {
  color: var(--color-danger);
}

.yh-copyable-row {
  display: flex;
  align-items: center;
  gap: var(--gap-inline);
  min-width: 0;
}

.yh-copyable-row > .yh-copyable-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: var(--line-base);
}

.yh-copyable-row > .yh-button {
  flex: none;
}

.yh-copyable-value > [role='status']:empty {
  display: none;
}

/* ------------------------------------------------------------ status dot and short facts */

/* A mark of severity or state, without text of its own (the dot of a Badge has words beside it, this one may not). */
.yh-status-dot {
  display: inline-block;
  flex: none;
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-text-muted);
}

.yh-status-dot[data-tone='success'] {
  background: var(--color-success);
}

.yh-status-dot[data-tone='warning'] {
  background: var(--color-warning);
}

.yh-status-dot[data-tone='danger'] {
  background: var(--color-danger);
}

.yh-status-dot[data-tone='info'] {
  background: var(--color-brand);
}

.yh-status-dot[data-tone='brand'] {
  background: var(--color-brand);
}

/* FactList: label at the start, answer at the end. A long answer wraps beside its label, which keeps its width up to 60%; nothing widens the card. */
.yh-facts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
}

.yh-fact {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  min-width: 0;
  line-height: var(--line-base);
}

.yh-fact dt {
  display: flex;
  flex: none;
  gap: var(--space-2);
  align-items: center;
  max-width: 60%;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.yh-fact dd {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  text-align: end;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ work rows */

/*
 * WorkList and WorkRow: one line of title and one of how it stands, each cut with an ellipsis rather than wrapped, so
 * every row of a list is as high as the others. Hover and keyboard focus are those of a clickable table row: rows touch,
 * so no rounded highlight, and the focus ring is drawn inside the row.
 */
.yh-work-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-work-item {
  min-width: 0;
}

/* In a flush card, under something else of the card (a search box): a line between them, as between the rows. */
.yh-card[data-flush] > .yh-card-slot + .yh-card-slot > .yh-work-list {
  border-top: 1px solid var(--color-border);
}

.yh-work-item + .yh-work-item {
  border-top: 1px solid var(--color-border);
}

.yh-work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'body time go';
  gap: var(--space-0-5) var(--space-3);
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  text-decoration: none;
}

.yh-work-row[data-dot] {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: 'dot body time go';
}

:is(a, button).yh-work-row {
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
}

:is(a, button).yh-work-row:hover {
  background: var(--color-surface-subtle);
}

:is(a, button).yh-work-row:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}

.yh-work-row-dot {
  grid-area: dot;
}

.yh-work-row-body {
  display: flex;
  grid-area: body;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.yh-work-row-title,
.yh-work-row-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-work-row-title {
  font-weight: var(--weight-medium);
  line-height: var(--line-base);
}

.yh-work-row-desc,
.yh-work-row-time {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}

.yh-work-row-time {
  grid-area: time;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yh-work-row-go {
  grid-area: go;
  color: var(--color-text-muted);
}

/* The row's own control stands where the arrow would, and stays there on the narrowest phones. Two controls are 8px apart, like every button group. */
.yh-work-row-action {
  display: inline-flex;
  gap: var(--gap-inline);
  grid-area: go;
}

/* A plain row holds the arrow's place, so the times of a list with both kinds of rows line up. */
.yh-work-row[data-plain] .yh-work-row-go {
  visibility: hidden;
}

/* On a phone the title has the first line to itself; the time goes beside the description. */
@media (max-width: 480px) {
  .yh-work-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      'title title go'
      'desc time go';
    column-gap: var(--space-2);
    padding: var(--space-3);
  }

  .yh-work-row[data-dot] {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      'dot title title go'
      'dot desc time go';
  }

  .yh-work-row-body {
    display: contents;
  }

  .yh-work-row-title {
    grid-area: title;
  }

  .yh-work-row-desc {
    grid-area: desc;
    min-width: 0;
  }
}

/* The narrowest phones: the whole row is the link, so its arrow gives its room to the title. */
@media (max-width: 360px) {
  .yh-work-row-go {
    display: none;
  }

  .yh-work-row:not([data-action]) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'title title'
      'desc time';
  }

  .yh-work-row[data-dot]:not([data-action]) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'dot title title'
      'dot desc time';
  }
}

/* ------------------------------------------------------------ filter chips */

/* The choices of a filter that are all in sight: the height of the filter's other controls, the chosen one in brand colours. */
.yh-filter-chips {
  display: inline-flex;
  gap: var(--space-1);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.yh-filter-chip {
  flex: none;
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  line-height: var(--line-control);
  cursor: pointer;
}

.yh-filter-chip:hover:not(:disabled) {
  background: var(--color-fill-hover);
}

/*
 * The chosen chip looks chosen at once, also under the pointer (the click that chose it leaves the pointer there, and the
 * hover fill must not hide it), and the chip it replaces loses its fill at once: there is no background transition, which
 * would leave both chips filled for the length of the fade. Only the chosen chip is ever brand-filled.
 */
.yh-filter-chip[data-state='checked'] {
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

.yh-filter-chip[data-state='checked']:hover:not(:disabled) {
  background: var(--color-brand-subtle);
}

.yh-filter-chip:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}

.yh-filter-chip:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* ------------------------------------------------------------ disclosure */

/* What a Disclosure opens: 8px under its summary. */
.yh-details-body {
  padding-block-start: var(--space-2);
  min-width: 0;
}

@media (max-width: 640px) {
  .yh-filters[data-collapse-mobile] > .yh-search-box { flex: 1 1 12rem; }
}

/* Structured queries keep the collection visible until the draft is applied. */
.yh-query-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.yh-query-toolbar > .yh-search-box { width: 20rem; max-width: 100%; }
.yh-query-end { margin-inline-start: auto; }
.yh-query-summary, .yh-query-token-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.yh-query-token { display: flex; align-items: center; min-width: 0; max-width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.yh-query-token > .yh-button:first-child { white-space: normal; text-align: start; overflow-wrap: anywhere; }
.yh-query-token > .yh-button:last-child { flex: 0 0 auto; }
.yh-query-join { font-size: var(--text-sm); color: var(--color-text-secondary); }
.yh-query-drawer.yh-drawer { width: min(60rem, 100vw); }
.yh-query-builder .ruleGroup { min-width: 0; padding-inline-start: var(--space-4); border-inline-start: 2px solid var(--color-border); }
.yh-query-builder > .ruleGroup { padding: 0; border: 0; }
.yh-query-builder .ruleGroup-header { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding-block: var(--space-2); }
.yh-query-builder .ruleGroup-body { display: grid; gap: var(--space-3); padding-block: var(--space-2); }
.yh-query-builder .rule { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(7rem, .8fr) minmax(12rem, 1.6fr) auto; align-items: start; gap: var(--space-2); }
.yh-query-builder .rule > *, .yh-query-value > * { min-width: 0; max-width: 100%; }
.yh-query-value { display: grid; gap: var(--space-2); }
.yh-query-value .yh-input { width: 100%; }
.yh-query-builder .ruleGroup-header .yh-select-trigger { width: auto; min-width: 10rem; }
@media (max-width: 640px) {
  .yh-query-toolbar > .yh-search-box { width: 100%; flex-basis: 100%; }
  .yh-query-builder .rule { grid-template-columns: minmax(0, 1fr) auto; }
  .yh-query-builder .rule > .rule-fields { grid-column: 1; }
  .yh-query-builder .rule > .rule-remove { grid-column: 2; grid-row: 1; }
  .yh-query-builder .rule > .rule-operators, .yh-query-builder .rule > .yh-query-value { grid-column: 1 / -1; }
  .yh-query-builder .ruleGroup { padding-inline-start: var(--space-2); }
}

.yh-query-dialog.yh-dialog[data-size='lg'] { width: min(60rem, calc(100vw - var(--space-6))); }

/* Part 4: floating layers. Dialog, Menu, Popover, Tooltip, Toast, Select list, Launcher panel. */

/* Radix portals render outside .yh-root, so every floating layer sets the type itself. */
.yh-popup {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-control);
  color: var(--color-text);
}

/* ------------------------------------------------------------ dialog (Radix and native <dialog>) */

/*
 * The scrim is on the layer of the dialogs (each one comes before its dialog in the DOM), so the order of opening stacks
 * them: a dialog opened over another (the question before changes are thrown away) dims and blurs the one below.
 */
.yh-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 1);
  background: var(--color-backdrop);
}

dialog.yh-dialog::backdrop {
  background: var(--color-backdrop);
}

/*
 * The native <dialog> of ./dom, and the [hidden] panels (menu, launcher) below, move with transitions: `display` (and
 * `overlay`, which keeps the dialog in the top layer) switch only after the exit has played, and @starting-style
 * gives the first frame of the enter. This is CSS only; the script just opens and closes. A browser that does not
 * know `allow-discrete` drops the whole `transition` declaration and the layer simply appears and disappears.
 * Firefox and Safari do not animate `overlay`: there the dialog leaves the top layer at once, its backdrop with it, and
 * only the box fades.
 */
dialog.yh-dialog {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-spring-smooth) var(--ease-spring-smooth),
    overlay var(--duration-spring-smooth) allow-discrete,
    display var(--duration-spring-smooth) allow-discrete;
}

dialog.yh-dialog:not([open]) {
  opacity: 0;
  transform: scale(var(--motion-pop-scale));
  pointer-events: none;
  transition:
    opacity var(--duration-fast) var(--ease-in),
    transform var(--duration-fast) var(--ease-in),
    overlay var(--duration-fast) allow-discrete,
    display var(--duration-fast) allow-discrete;
}

@starting-style {
  dialog.yh-dialog[open] {
    opacity: 0;
    transform: translateY(var(--motion-shift)) scale(var(--motion-pop-scale));
  }
}

dialog.yh-dialog::backdrop {
  transition:
    opacity var(--duration-base) var(--ease-out),
    backdrop-filter var(--duration-base) var(--ease-out),
    overlay var(--duration-base) allow-discrete,
    display var(--duration-base) allow-discrete;
}

dialog.yh-dialog:not([open])::backdrop {
  opacity: 0;
  pointer-events: none;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease-in);
}

@starting-style {
  dialog.yh-dialog[open]::backdrop {
    opacity: 0;
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

/*
 * Enter and exit of the Radix layers (Dialog, Menu, Popover, Tooltip, Select, Toast, the lists of Combobox and the date
 * panels). Radix sets data-state and keeps the element until its animation has ended, so a layer needs only keyframes.
 *
 * A layer materialises rather than fades: its shape grows on a spring (scale and a short move, `yh-pop-scale`) while
 * its opacity comes up on a short ease-out (`yh-fade-in`), two animations on two properties, so the shape may overshoot
 * a hair while the glass is already solid. An exit is shorter than the enter, does not bounce and accelerates away;
 * `pointer-events: none` lets the click through to what is under a layer that is leaving. Reduced motion: the
 * durations are 1ms and the scale and shift are none (base.css), so layers simply appear. The native <dialog> and the
 * [hidden] panels of ./dom use transitions instead (see above and below).
 */
/*
 * The page is never made dead to the pointer. Radix puts `pointer-events: none` on <body> (inline) while a modal layer
 * is mounted: the select list always, and a layer stays mounted for its exit animation. Two bugs came from it: the
 * first click on another button while a list or menu was open only closed the list (the button never got it), and a
 * lock left behind (a dialog opened from a menu item) froze the whole page. The rule: only a dialog or drawer blocks
 * the page, and it does so with its scrim, a real element that takes the press (and closes it). Everything else
 * (select lists, menus, popovers) closes on the outside press and lets that same press reach what was under it, as
 * native controls and Google's apps do. While a kit dialog or drawer is open Radix's lock stays as a second guard.
 * The phone sheet of Select keeps its dimmed layer (the ::before of its wrapper), which takes a tap the same way.
 */
body:not(:has(> :is(.yh-dialog, .yh-drawer)[data-state='open'])) {
  pointer-events: auto !important;
}

.yh-dialog-overlay[data-state='open'] {
  animation: yh-scrim-in var(--duration-base) var(--ease-out);
}

.yh-dialog-overlay[data-state='closed'] {
  animation: yh-scrim-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none !important;
}

/* The scrim dims and blurs the page together: the blur grows from none with the dimming. */
@keyframes yh-scrim-in {
  from {
    opacity: 0;
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

@keyframes yh-scrim-out {
  to {
    opacity: 0;
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

/* A dialog comes up from a little below, growing from 92% on the smooth spring (no overshoot: it carries a decision). */
.yh-dialog[data-state='open'] {
  --yh-from-x: 0;
  --yh-from-y: var(--motion-shift);
  animation:
    yh-pop-scale var(--duration-spring-smooth) var(--ease-spring-smooth),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-dialog[data-state='closed'] {
  --yh-from-x: 0;
  --yh-from-y: 0;
  animation: yh-pop-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none !important;
}

/*
 * A dialog that opens while the one before it is still leaving takes its place at once: both sit in the middle of the
 * window, and the old one fading out under the new one would show two texts on top of each other. A dialog that closes
 * over one that stays open (opened before it) keeps its exit.
 */
.yh-dialog[data-state='closed']:has(~ .yh-dialog[data-state='open']) {
  animation: none;
}

/*
 * Menu, popover, select list, combobox list, date panel and tooltip grow out of their trigger: transform-origin is the
 * point Radix gives (the side of the trigger they open from), with a small move toward the trigger, on the snappy spring.
 */
:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-state] {
  --yh-from-x: 0;
  --yh-from-y: 0;
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-side='bottom'] {
  --yh-from-y: calc(var(--motion-shift) / -2);
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-side='top'] {
  --yh-from-y: calc(var(--motion-shift) / 2);
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-side='left'] {
  --yh-from-x: calc(var(--motion-shift) / 2);
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-side='right'] {
  --yh-from-x: calc(var(--motion-shift) / -2);
}

.yh-menu[data-state] {
  transform-origin: var(--radix-dropdown-menu-content-transform-origin);
}

:is(.yh-popover, .yh-combobox-popup, .yh-calendar-popup)[data-state] {
  transform-origin: var(--radix-popover-content-transform-origin);
}

.yh-select-content[data-state] {
  transform-origin: var(--radix-select-content-transform-origin);
}

.yh-tooltip[data-state] {
  transform-origin: var(--radix-tooltip-content-transform-origin);
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-state]:not([data-state='closed']) {
  animation:
    yh-pop-scale var(--duration-spring-snappy) var(--ease-spring-snappy),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

:is(.yh-menu, .yh-popover, .yh-select-content, .yh-tooltip, .yh-combobox-popup, .yh-calendar-popup)[data-state='closed'] {
  animation: yh-pop-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none !important;
}

/* The shape of an entering layer (its opacity is a separate animation, yh-fade-in). */
@keyframes yh-pop-scale {
  from {
    transform: translate(var(--yh-from-x, 0), var(--yh-from-y, 0)) scale(var(--motion-pop-scale));
  }
}

/* One-piece enter, for the React launcher panel (a single animation on a [data-state] element). */
@keyframes yh-pop-in {
  from {
    opacity: 0;
    transform: translate(var(--yh-from-x, 0), var(--yh-from-y, 0)) scale(var(--motion-pop-scale));
  }
}

/* The exit shrinks half as far as the enter grew. */
@keyframes yh-pop-out {
  to {
    opacity: 0;
    transform: translate(var(--yh-from-x, 0), var(--yh-from-y, 0)) scale(calc((1 + var(--motion-pop-scale)) / 2));
  }
}

.yh-dialog {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 1);
  box-sizing: border-box;
  width: min(28rem, calc(100vw - var(--space-8)));
  max-height: calc(100vh - var(--space-8));
  max-height: calc(100dvh - var(--space-8));
  height: fit-content;
  margin: auto;
  padding: var(--space-6);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--dialog-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-dialog);
  color: var(--color-text);
  line-height: var(--line-base);
  /* A native <dialog> written inside a flush card is not part of the card: its tables keep their frame (see "flush" in data.css). */
  --yh-flush: 0;
  --yh-table-inline-pad: initial;
  /* The parts of a dialog (the head, fields, a table, the footer) are 24px apart: the dialog's gap. */
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
}

/* A closed native <dialog> stays hidden (the display above would otherwise show it). */
dialog.yh-dialog:not([open]) {
  display: none;
}

/* The title and the description: one head, 8px apart (a 20px title). The head keeps its place however long the content is. */
.yh-dialog-head {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--gap-display-text);
  min-width: 0;
}

/*
 * The description is a line or two. A text that is longer (a list of changes written into it) must not push the buttons
 * out of the window: it scrolls on its own after about eight lines, and what belongs there goes into the content.
 */
.yh-dialog-head > .yh-dialog-body {
  max-height: min(12rem, 30dvh);
  overflow: auto;
  overscroll-behavior: contain;
}

.yh-dialog[data-size='lg'] {
  width: min(40rem, calc(100vw - var(--space-8)));
}

.yh-dialog[data-size='xl'] {
  width: min(56rem, calc(100vw - var(--space-8)));
}

.yh-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--line-lg);
}

.yh-dialog-body {
  margin: 0;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.yh-dialog-footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--gap-inline);
}

/*
 * Between the head and the footer only the content scrolls (React `Dialog`): the title, "取消" and the primary action stay
 * in sight however long the content is. It reaches the dialog's edges and gives the room back as padding, so a focus ring
 * or the shadow of a field is not cut. A hand-written `<dialog>` has no
 * such part and scrolls as a whole.
 */
.yh-dialog-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--gap-block);
  min-height: 0;
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-6));
  padding: var(--space-1) var(--space-6);
  overflow: auto;
  overscroll-behavior: contain;
}

.yh-dialog-content:empty {
  display: none;
}

/*
 * What a confirmation touches (ConfirmDialog and ReasonDialog `children`): the one part of the content that gives way. The
 * field that asks for the name or the reason and a failure stay in view under it, with the buttons. It reaches the edges
 * of the dialog and gives the room back as padding, like the fields of a form (.yh-form-scroll), so a focus ring is not cut.
 */
.yh-confirm-scroll {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--gap-block);
  min-height: 0;
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-6));
  padding: var(--space-1) var(--space-6);
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}

/* The fields of a confirmation that asks for a reason or a name: a form inside the dialog, fields 16px apart. */
.yh-dialog > .yh-form,
.yh-dialog-content > .yh-form {
  gap: var(--gap-field);
}

/* A form scrolls its fields and keeps its buttons: `Form` puts everything but the buttons in `.yh-form-scroll`. */
.yh-dialog-content > .yh-form[data-scrolls] {
  flex: 1 1 auto;
  min-height: 0;
}

.yh-dialog-content > .yh-form > .yh-form-scroll {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--gap-field);
  min-height: 0;
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-6));
  padding: var(--space-1) var(--space-6);
  overflow: auto;
  overscroll-behavior: contain;
}

.yh-dialog-content > .yh-form > .yh-form-actions {
  flex: none;
}

/* A value that is shown once (RevealDialog): easy to select, wraps instead of widening the dialog. */
.yh-reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
}

.yh-reveal-value {
  box-sizing: border-box;
  flex: 1 1 12rem;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--control-radius);
  background: var(--color-surface-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-base);
  overflow-wrap: anywhere;
  user-select: all;
}

@media (max-width: 480px) {
  .yh-dialog-footer {
    flex-direction: column-reverse;
  }

  .yh-dialog-footer .yh-button {
    width: 100%;
  }
}

/*
 * A form dialog on a phone (Dialog `sheet`, FormDialog): a sheet at the bottom of the screen with the shape of a Select's
 * sheet, 8px from the edges and above the home indicator, the dialog's corners all round (the sheets of Liquid Glass
 * float). It keeps the dialog's opaque surface: it holds fields. It rises on the smooth spring and leaves downward,
 * faster; with reduced motion it simply appears. Its buttons span its width, the primary one on top (controls.css).
 * A confirmation has no `sheet`: it stays a centred alert.
 */
@media (max-width: 480px) {
  .yh-dialog[data-sheet] {
    --yh-sheet-shift: calc(100% * var(--motion-travel));
    inset: auto max(var(--space-2), env(safe-area-inset-right)) max(var(--space-2), env(safe-area-inset-bottom)) max(var(--space-2), env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - var(--header-height) - var(--space-2));
    margin: 0;
  }

  .yh-dialog[data-sheet][data-state='open'] {
    animation:
      yh-sheet-rise var(--duration-spring-smooth) var(--ease-spring-smooth),
      yh-fade-in var(--duration-fast) var(--ease-out);
  }

  .yh-dialog[data-sheet][data-state='closed'] {
    animation: yh-sheet-leave var(--duration-base) var(--ease-in) forwards;
  }
}

/* ------------------------------------------------------------ drawer (Drawer) */

/* The panel is as high as the viewport: title bar and footer keep their place, the body scrolls between them. */
/* A floating sheet: inset from the window by --sidebar-inset on three sides, with the dialog's corners. */
.yh-drawer {
  position: fixed;
  inset: var(--sidebar-inset) var(--sidebar-inset) var(--sidebar-inset) auto;
  z-index: calc(var(--z-overlay) + 1);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(26rem, calc(100vw - 2 * var(--sidebar-inset)));
  max-width: 100vw;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--dialog-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-dialog);
  color: var(--color-text);
  line-height: var(--line-base);
}

.yh-drawer[data-size='lg'] {
  width: min(40rem, calc(100vw - 2 * var(--sidebar-inset)));
}

.yh-drawer-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.yh-drawer-title {
  min-width: 0;
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: var(--line-md);
  overflow-wrap: anywhere;
}

.yh-drawer-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--gap-field);
  min-height: 0;
  padding: var(--space-5);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.yh-drawer-description {
  margin: 0;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.yh-drawer-footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/*
 * Slides in from the right edge, the whole way, on the smooth spring (a sheet does not bounce); the exit is shorter and
 * accelerates. With reduced motion the durations are 1 ms (base.css), so it just appears.
 */
.yh-drawer[data-state='open'] {
  animation: yh-drawer-in var(--duration-spring-smooth) var(--ease-spring-smooth);
}

.yh-drawer[data-state='closed'] {
  animation: yh-drawer-out var(--duration-base) var(--ease-in) forwards;
  pointer-events: none !important;
}

@keyframes yh-drawer-in {
  from {
    transform: translateX(calc((100% + var(--sidebar-inset)) * var(--motion-travel)));
  }
}

@keyframes yh-drawer-out {
  to {
    transform: translateX(calc((100% + var(--sidebar-inset)) * var(--motion-travel)));
  }
}

@media (max-width: 640px) {
  /* A phone: the sheet fills the screen edge to edge, square. */
  .yh-drawer,
  .yh-drawer[data-size='lg'] {
    inset: 0 0 0 auto;
    width: 100vw;
    border-width: 0;
    border-radius: 0;
  }

  .yh-drawer-header,
  .yh-drawer-footer {
    padding-inline: var(--space-4);
  }

  .yh-drawer-body {
    padding: var(--space-4);
  }

  .yh-drawer-footer {
    flex-direction: column-reverse;
  }

  .yh-drawer-footer .yh-button {
    width: 100%;
  }
}

/* ------------------------------------------------------------ menu */

.yh-menu-root {
  position: relative;
  display: inline-block;
}

.yh-menu {
  box-sizing: border-box;
  min-width: 12rem;
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  z-index: var(--z-popover);
}

/* Server-rendered menus are positioned by CSS; Radix menus by its popper. */
.yh-menu-root > .yh-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
}

.yh-menu-root > .yh-menu[data-align='end'] {
  right: 0;
  left: auto;
}

.yh-menu[hidden] {
  display: none;
}

.yh-menu[data-scrollable] {
  max-block-size: var(--radix-dropdown-menu-content-available-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}

/* The [hidden] menu of ./dom: closed state = hidden. The exit plays before `display: none` takes effect (see the native dialog above). */
.yh-menu-root > .yh-menu {
  --yh-from-y: calc(var(--motion-shift) / -2);
  transform-origin: top left;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-spring-snappy) var(--ease-spring-snappy),
    display var(--duration-spring-snappy) allow-discrete;
}

.yh-menu-root > .yh-menu[data-align='end'] {
  transform-origin: top right;
}

.yh-menu-root > .yh-menu[hidden] {
  opacity: 0;
  transform: translateY(var(--yh-from-y)) scale(var(--motion-pop-scale));
  pointer-events: none;
  transition-duration: var(--duration-instant);
  transition-timing-function: var(--ease-in);
}

@starting-style {
  .yh-menu-root > .yh-menu:not([hidden]) {
    opacity: 0;
    transform: translateY(var(--yh-from-y)) scale(var(--motion-pop-scale));
  }
}

/*
 * The head of a menu (the account's name): its line is drawn 4px above its own bottom edge, so the space under the
 * line belongs to the head and the first item follows straight after (12px of text room, the 1px line, 4px).
 */
.yh-menu-head {
  padding: var(--space-2) var(--space-3) calc(var(--space-3) + 1px + var(--space-1));
  background: linear-gradient(var(--color-border), var(--color-border)) left bottom var(--space-1) / 100% 1px no-repeat;
}

.yh-menu-name {
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.yh-menu-detail {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.yh-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 100%;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  transition: background-color var(--duration-instant) var(--ease-out);
}

.yh-menu-item:hover,
.yh-menu-item:focus-visible,
.yh-menu-item[data-highlighted] {
  background: var(--color-fill-hover);
}

.yh-menu-item:active {
  background: var(--color-fill-pressed);
}

.yh-menu-item[data-tone='danger'] {
  color: var(--color-danger);
}

/* The item for the page that is open, as the sidebar marks its current entry: brand colour on the subtle brand fill. */
.yh-menu-item[aria-current='page'],
.yh-menu-item[aria-current='page']:hover,
.yh-menu-item[aria-current='page']:focus-visible,
.yh-menu-item[aria-current='page'][data-highlighted] {
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

/* Hover and keyboard focus keep the fill, so they show as an outline instead. */
.yh-menu-item[aria-current='page']:hover,
.yh-menu-item[aria-current='page']:focus-visible,
.yh-menu-item[aria-current='page'][data-highlighted] {
  box-shadow: inset 0 0 0 1px var(--color-brand);
}

.yh-menu-item[data-disabled],
.yh-menu-item:disabled,
.yh-menu-item[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

/* A 1px line with 4px above and below it, all inside the separator's own box (no margins). */
.yh-menu-separator {
  box-sizing: content-box;
  height: 1px;
  padding-block: var(--space-1);
  background: var(--color-border) content-box;
}

/* ------------------------------------------------------------ popover and tooltip */

.yh-notification-center { display: inline-flex; position: relative; }
/* The bell sits with the search and the account: the height of a control, no frame, the number only when there is one. */
.yh-notification-bell {
  width: auto;
  min-width: var(--yh-control);
  gap: var(--space-1);
  padding-inline: var(--space-2);
}
.yh-notification-bell-icon { position: relative; display: inline-flex; }
.yh-notification-bell-dot {
  position: absolute;
  top: calc(-1 * var(--space-0-5));
  right: calc(-1 * var(--space-0-5));
}
.yh-notification-bell-count {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  .yh-notification-bell { padding-inline: 0; }
}
.yh-notifications, .yh-notification-body, .yh-notification-feed { display: flex; flex-direction: column; gap: var(--gap-field); min-width: 0; }
/* The feed scrolls, so it clips: --focus-room around its buttons, taken back by the margin, keeps their rings whole. */
.yh-notification-popover .yh-notification-feed { max-height: min(52vh, 28rem); margin: calc(var(--focus-room) * -1); padding: var(--focus-room); overflow: auto; overscroll-behavior: contain; }
.yh-notification-items { display: flex; flex-direction: column; gap: var(--gap-field); padding: 0; margin: 0; list-style: none; }
.yh-notification-item { display: flex; flex-direction: column; gap: var(--gap-title-text); min-width: 0; overflow-wrap: anywhere; }
.yh-notification-item-title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.yh-notification-item-title > .yh-button { white-space: normal; text-align: start; justify-content: flex-start; height: auto; min-width: 0; }
.yh-notification-dot { flex: none; width: var(--space-2); height: var(--space-2); border-radius: var(--radius-full); background: var(--color-brand); }
@supports (anchor-name: --yh-active-tip) {
  :root:not([data-platform-fallback]) [data-yh-tip-anchor] { anchor-name: --yh-active-tip; }
}

.yh-popover {
  box-sizing: border-box;
  width: max-content;
  max-width: min(22rem, calc(100vw - var(--space-8)));
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  z-index: var(--z-popover);
  line-height: var(--line-base);
}

.yh-tooltip {
  box-sizing: border-box;
  max-width: 20rem;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--control-radius);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--text-sm);
  z-index: var(--z-toast);
  overflow-wrap: anywhere;
}

/* The whole text of a table cell that is cut with an ellipsis, for touch and keyboard (DataTable and ./dom place it with left and top). */
.yh-cut-tip {
  position: fixed;
  top: 0;
  left: 0;
  width: max-content;
  max-width: min(28rem, calc(100vw - var(--space-4)));
  line-height: var(--leading-compact);
  pointer-events: none;
}

.yh-cut-tip[hidden] {
  display: none;
}

/* ------------------------------------------------------------ select list (Radix) */

.yh-select-content {
  box-sizing: border-box;
  min-width: var(--radix-select-trigger-width, 8rem);
  max-height: min(20rem, var(--radix-select-content-available-height, 20rem));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  z-index: var(--z-popover);
}

.yh-select-viewport {
  padding: var(--space-1);
}

.yh-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  user-select: none;
}

.yh-select-item[data-highlighted] {
  background: var(--color-fill-hover);
}

.yh-select-item[data-state='checked'] {
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

/*
 * The highlighted row's fill is the focus indicator of a list (as in a native select and Apple's menus): Radix moves
 * the focus from row to row, and a ring inside the row on top of the fill would only crowd it.
 */
.yh-popup .yh-select-item:focus-visible {
  outline: none;
}

.yh-select-item[data-disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/*
 * On a phone a Select opens as a sheet (Apple's action sheet): Radix still places the list under the trigger, so the
 * wrapper is pinned to the bottom of the screen instead, 8px from the edges, above the home indicator. The sheet is
 * the glass of every layer (materials.css), 24px corners like the drawer, rows 44px high, at most 60% of the screen
 * (the rest scrolls). It rises on the smooth spring and leaves faster downward; reduced motion: it simply appears.
 * The page behind is dimmed like under a dialog; a tap there or a downward drag on the grabber closes it.
 */
[data-radix-popper-content-wrapper]:has(> .yh-select-content[data-sheet]) {
  position: fixed !important;
  inset: auto 0 0 !important;
  min-width: 0 !important;
  transform: none !important;
  /* Radix sets will-change: transform, which would make the dimmed layer below fixed to the wrapper, not the screen. */
  will-change: auto !important;
  padding: 0 max(var(--space-2), env(safe-area-inset-right)) max(var(--space-2), env(safe-area-inset-bottom)) max(var(--space-2), env(safe-area-inset-left));
}

[data-radix-popper-content-wrapper]:has(> .yh-select-content[data-sheet])::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--color-backdrop);
  animation: yh-fade-in var(--duration-base) var(--ease-out);
}

[data-radix-popper-content-wrapper]:has(> .yh-select-content[data-sheet][data-state='closed'])::before {
  animation: yh-fade-out var(--duration-fast) var(--ease-in) forwards;
}

/* The leaving sheet and its dimmed wrapper release the page together; the backdrop must not eat a quick re-click. */
[data-radix-popper-content-wrapper]:has(> .yh-select-content[data-sheet][data-state='closed']) {
  pointer-events: none;
}

.yh-select-content[data-sheet] {
  --yh-radius: var(--dialog-radius);
  width: 100%;
  min-width: 0;
  max-height: 60vh;
  border-radius: var(--yh-radius);
  display: flex;
  flex-direction: column;
  --yh-sheet-shift: calc(100% * var(--motion-travel));
  transition: translate var(--duration-fast) var(--ease-out);
}

.yh-select-content[data-sheet][data-state='open'] {
  animation:
    yh-sheet-rise var(--duration-spring-smooth) var(--ease-spring-smooth),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-select-content[data-sheet][data-state='closed'] {
  animation: yh-sheet-leave var(--duration-base) var(--ease-in) forwards;
}

/* A grabbed sheet follows the pointer directly; only a cancelled/short drag eases back to rest. */
:is(.yh-select-content, .yh-palette)[data-sheet][data-sheet-dragging] {
  transition: none;
}

@keyframes yh-sheet-rise {
  from {
    transform: translateY(var(--yh-sheet-shift));
  }
}

@keyframes yh-sheet-leave {
  to {
    transform: translateY(var(--yh-sheet-shift));
    opacity: 0;
  }
}

/* The grabber: a 36 x 5 capsule 8px from the top, in a 20px strip that is the place to drag the sheet down. */
.yh-sheet-grabber {
  flex: none;
  box-sizing: border-box;
  height: var(--space-5);
  padding-top: var(--space-2);
  touch-action: none;
  cursor: grab;
}

.yh-sheet-grabber::before {
  content: '';
  display: block;
  width: 36px;
  height: 5px;
  margin-inline: auto;
  border-radius: var(--radius-full);
  background: var(--color-border-hover);
}

.yh-select-content[data-sheet] .yh-select-viewport {
  padding-top: 0;
}

.yh-select-content[data-sheet] .yh-select-item {
  min-height: 44px;
}

/* ------------------------------------------------------------ toast */

/*
 * One look for the React `Toaster` and the `./dom` toast. A single line is about as high as a control: 8px above
 * and below the 20px text line, 38px with the border. The close button (28px) is centred on the first line by a
 * negative margin, so it never makes the toast taller than its text, and a text of two or more lines keeps the
 * button level with the first one. On touch screens the button is 44px and its margins take the extra back.
 */
.yh-toast-region {
  position: fixed;
  right: max(var(--space-4), env(safe-area-inset-right));
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  width: min(26rem, calc(100vw - var(--space-8)));
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.yh-toast {
  --yh-toast-button: var(--control-height-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  box-sizing: border-box;
  min-width: min(12rem, 100%);
  max-width: 100%;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
}

/*
 * The tone is an 8px dot in front of the text, centred on the first line (the words say the same thing, so colour is
 * not the only carrier): the dot's box is as high as the line and the dot is painted in its middle, so no margin
 * places it. The toast's 8px gap separates it from the text.
 */
.yh-toast[data-tone]::before {
  --yh-toast-tone: var(--color-brand);
  content: '';
  flex: none;
  width: 0.5rem;
  height: calc(var(--text-base) * var(--leading-compact));
  background: radial-gradient(circle closest-side, var(--yh-toast-tone) calc(100% - 0.5px), transparent);
}

.yh-toast[data-tone='success']::before {
  --yh-toast-tone: var(--color-success);
}

.yh-toast[data-tone='danger']::before {
  --yh-toast-tone: var(--color-danger);
}

.yh-toast[data-tone='warning']::before {
  --yh-toast-tone: var(--color-warning);
}

.yh-toast-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  line-height: var(--leading-compact);
}

.yh-toast-title {
  margin: 0;
  font-weight: var(--weight-semibold);
}

/* The action and the close button are as high as --yh-toast-button and centred on the first text line. */
.yh-toast-close,
.yh-toast-action {
  flex: none;
  box-sizing: border-box;
  height: var(--yh-toast-button);
  min-height: 0;
  margin-block: calc((var(--text-base) * var(--leading-compact) - var(--yh-toast-button)) / 2);
  margin-inline: calc((var(--control-height-sm) - var(--yh-toast-button)) / 2);
}

.yh-toast-action {
  padding: 0 var(--space-2);
  color: var(--color-brand-text);
}

.yh-toast-close {
  width: var(--yh-toast-button);
}

/*
 * The cross is the `close` icon of the set (a mask file, see the checkbox in controls.css), 14px like the clear button of
 * a field, in the colour of the button; centred whatever the font. Forced-colours mode paints the mask in ButtonText.
 */
.yh-toast-close::before {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  mask: url('./masks/close.svg?no-inline') center / 0.875rem no-repeat;
}

@media (forced-colors: active) {
  .yh-toast-close::before {
    background: ButtonText;
  }
}

/* Touch: the button is 44px. Its negative margins take back what it adds, so the toast keeps its height and the 28px look. */
@media (pointer: coarse) {
  .yh-toast {
    --yh-toast-button: var(--hit-target);
  }
}

/*
 * A toast springs in from the bottom edge (the bouncy spring: it is news, and a little life is welcome) and leaves to
 * the right, the side the swipe-to-dismiss goes to. Radix marks the leaving one data-state="closed", ./dom data-closing.
 *
 * Several toasts stack with depth: the newest is at full size, the one behind it a step smaller, the rest two steps,
 * all scaled from their bottom edge, so the eye reads the newest first. Pointing at the stack or moving the focus into
 * it brings every toast to full size for reading and clicking. Only with a mouse: a touch screen cannot point, so its
 * toasts stay at full size (and at the 44px touch size). The steps are the press scale, so reduced motion (press
 * scale 1) leaves every toast at full size.
 */
.yh-toast {
  transform-origin: 50% 100%;
  transition: transform var(--duration-spring-snappy) var(--ease-spring-snappy);
  animation:
    yh-toast-in var(--duration-spring-bouncy) var(--ease-spring-bouncy),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .yh-toast-region:not(:hover, :focus-within) > .yh-toast:nth-last-child(2) {
    transform: scale(var(--motion-press-scale));
  }

  .yh-toast-region:not(:hover, :focus-within) > .yh-toast:nth-last-child(n + 3) {
    transform: scale(calc(2 * var(--motion-press-scale) - 1));
  }
}

.yh-toast[data-state='closed'],
.yh-toast[data-closing] {
  animation: yh-toast-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none !important;
}

@keyframes yh-toast-in {
  from {
    transform: translateY(calc((100% + var(--space-4)) * var(--motion-travel))) scale(var(--motion-pop-scale));
  }
}

@keyframes yh-toast-out {
  to {
    opacity: 0;
    transform: translateX(calc(var(--motion-shift) * 4));
  }
}

@media (max-width: 480px) {
  .yh-toast-region {
    right: max(var(--space-4), env(safe-area-inset-right));
    left: max(var(--space-4), env(safe-area-inset-left));
    width: auto;
    align-items: stretch;
  }
}

/* ------------------------------------------------------------ launcher panel (the "nine dots" menu) */

.yh-launcher {
  position: relative;
  display: inline-flex;
}

/*
 * When the window is too low the panel scrolls inside itself, and says so: a thin scrollbar in the control-border
 * colour (the default one is nearly invisible on white, and overlay scrollbars hide), and a fade over the bottom
 * edge. The fade is a sticky pseudo-element laid over the last --yh-launcher-fade of the visible part; the grid
 * ends with the same amount of padding, so at the end of the list the fade covers only empty space and the last
 * row stays at full strength. `scroll-padding` keeps a focused tile out from under it.
 */
.yh-launcher-panel {
  --yh-launcher-fade: var(--space-6);
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  z-index: var(--z-popover);
  box-sizing: border-box;
  width: 21rem;
  max-width: calc(100vw - var(--space-4));
  max-height: calc(100vh - var(--header-height) - var(--space-4));
  overflow-y: auto;
  scroll-padding-block-end: var(--yh-launcher-fade);
  scrollbar-width: thin;
  scrollbar-color: var(--color-control-border) transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
}

.yh-launcher-panel::after {
  content: '';
  display: block;
  position: sticky;
  bottom: 0;
  height: var(--yh-launcher-fade);
  margin-top: calc(-1 * var(--yh-launcher-fade));
  background: linear-gradient(to bottom, transparent, var(--color-surface));
  pointer-events: none;
}

.yh-launcher-panel[hidden] {
  display: none;
}

/* The [hidden] panel of ./dom, as the menu above. The React panel is marked data-state and animates with keyframes (below). */
.yh-launcher-panel:not([data-state]) {
  --yh-from-y: calc(var(--motion-shift) / -2);
  transform-origin: top right;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-spring-snappy) var(--ease-spring-snappy),
    display var(--duration-spring-snappy) allow-discrete;
}

.yh-launcher-panel[hidden]:not([data-state]) {
  opacity: 0;
  transform: translateY(var(--yh-from-y)) scale(var(--motion-pop-scale));
  pointer-events: none;
  transition-duration: var(--duration-instant);
  transition-timing-function: var(--ease-in);
}

@starting-style {
  .yh-launcher-panel:not([hidden]):not([data-state]) {
    opacity: 0;
    transform: translateY(var(--yh-from-y)) scale(var(--motion-pop-scale));
  }
}

/* The React launcher marks its panel data-state and keeps it mounted until the exit has played (Launcher.tsx). */
.yh-launcher-panel[data-state='open'] {
  --yh-from-y: calc(var(--motion-shift) / -2);
  transform-origin: top right;
  animation:
    yh-pop-scale var(--duration-spring-snappy) var(--ease-spring-snappy),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-launcher-panel[data-state='closed'] {
  --yh-from-y: calc(var(--motion-shift) / -2);
  transform-origin: top right;
  animation: yh-pop-out var(--duration-instant) var(--ease-in) forwards;
  pointer-events: none !important;
}

.yh-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3) var(--yh-launcher-fade);
}

.yh-launcher-group {
  grid-column: 1 / -1;
  /* A group's label row carries its own room above it (8px more than the grid's 4px between rows) and the tile inset at the side. */
  padding: var(--space-2) var(--space-1) 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.yh-launcher-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  min-height: var(--hit-target);
  padding: var(--space-2) var(--space-1);
  border-radius: var(--popup-radius);
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: var(--leading-compact);
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color var(--duration-fast) var(--ease-out);
}

/*
 * Three states, three marks: hover is a light fill; keyboard focus is the ring of the page (base.css) with no fill, so
 * it shows only after a key and never after a click; the current app is its name in the brand colour behind a dot,
 * with no fill, so it never reads as hovered or focused. `aria-current` carries it for assistive technology.
 */
.yh-launcher-item:hover {
  background: var(--color-fill-hover);
}

.yh-launcher-item[aria-current='true'] {
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

.yh-launcher-item[aria-current='true'] .yh-launcher-name::before {
  content: '';
  display: inline-block;
  width: 0.375rem;
  height: 0.375rem;
  margin-right: var(--space-1);
  border-radius: var(--radius-full);
  background: currentColor;
  vertical-align: middle;
}

.yh-launcher-icon {
  width: var(--launcher-icon);
  height: var(--launcher-icon);
  object-fit: contain;
}

/* At most two lines, balanced, then an ellipsis; the link's title carries the whole name. */
.yh-launcher-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.yh-launcher-message {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--space-4);
  color: var(--color-text-secondary);
}

/* Directly in the panel (loading) there is no grid to end with the fade's padding. */
.yh-launcher-panel > .yh-launcher-message {
  padding-bottom: var(--yh-launcher-fade);
}

/*
 * Under 480px the panel is a full-width sheet below the header. It hangs from the bottom edge of `.yh-header` (the
 * sticky header is the positioned ancestor, as `.yh-launcher` is static here), so it clears a header of two rows
 * too: without a sidebar the top navigation moves into a second row at 720px and below. The height left under the
 * header is the viewport minus the header's own height (`100%` is the height of the positioned ancestor).
 */
@media (max-width: 480px) {
  .yh-launcher {
    position: static;
  }

  .yh-launcher-panel {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 100%);
    border-width: 1px 0;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
  }
}

/* Part 5: page frame. Header, Sidebar, PageHeader, Breadcrumb, standard (entry/status) pages. */

.yh-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg);
}

/* Startup is a bounded page state, never six text lines at the top of the viewport.
 * These classes also support a static, public pre-React placeholder; no session data belongs in it. */
.yh-loading-page {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0;
  background: var(--color-bg);
}

.yh-loading-page[data-layout='screen'] {
  min-height: 100vh;
  min-height: 100svh;
}

.yh-loading-page[data-layout='content'] {
  min-height: calc(var(--space-12) * 4);
  background: transparent;
}

.yh-loading-main {
  display: grid;
  flex: 1;
  min-width: 0;
  place-items: center;
  padding: var(--space-6);
}

.yh-loading-status {
  /* Like a skeleton: nothing for the first 150ms, so a start that is fast enough never flashes the spinner. */
  animation: yh-skeleton-in 200ms ease-out 150ms backwards;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  max-width: 100%;
  color: var(--color-text-secondary);
  text-align: center;
  overflow-wrap: anywhere;
}

.yh-loading-status .yh-spinner {
  flex: none;
}

/* ------------------------------------------------------------ header (fixed at the top) */

.yh-skip {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--hit-target);
  position: absolute;
  left: var(--space-2);
  top: -100%;
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--control-radius);
  background: var(--color-brand);
  color: var(--color-on-brand);
}

.yh-skip:focus {
  top: var(--space-2);
}

/*
 * The header is chrome: the colour of the page canvas with no line below it (its glass is in materials.css). Where the
 * page scrolls under it, a scroll edge takes the place of a divider: a soft fade from the header's tint into the
 * content, 24px deep, so text dissolves under the header instead of being cut by a line (Apple's "soft" scroll edge
 * effect). At the top of the page the fade lies over the empty canvas and cannot be seen. With a sidebar on a wide
 * screen it starts at the content column, so the floating sidebar keeps a clean top edge.
 */
.yh-page-head[data-collapsible] {
  position: sticky;
  top: var(--header-height);
  z-index: var(--z-navigation);
  background: var(--color-bg);
}
/* Interpolating font-size changes line breaks mid-scroll on narrow screens, moving controls
 * after the pointer has already reached them. Commit the compact typography in one layout. */
.yh-page-head[data-collapsible] .yh-page-title { font-size: var(--text-3xl); }
.yh-page-head[data-compact] .yh-page-title { font-size: var(--text-xl); }
@media (prefers-reduced-motion: reduce) { .yh-page-head[data-collapsible] .yh-page-title { transition: none; } }

@supports (text-wrap: balance) {
  :root:not([data-platform-fallback]) .yh-page-title { text-wrap: balance; }
}
@supports (text-wrap: pretty) {
  :root:not([data-platform-fallback]) .yh-page-desc { text-wrap: pretty; }
}
@supports (container-type: inline-size) {
  :root:not([data-platform-fallback]) .yh-grid { container-type: inline-size; }
  @container (max-width: 30rem) { .yh-grid > .yh-card > .yh-card-header { flex-wrap: wrap; } }
}

.yh-split-pane {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  overflow: hidden;
}
.yh-split-pane-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--gap-card-head);
  padding: var(--card-padding);
  min-width: 0;
  border-inline-end: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
}
.yh-split-pane-sidebar .yh-button { justify-content: flex-start; }
.yh-split-pane-main { --yh-flush: 1; --yh-table-inline-pad: var(--card-padding); min-width: 0; }
@media (max-width: 800px) {
  .yh-split-pane { grid-template-columns: minmax(0, 1fr); }
  .yh-split-pane-sidebar { border-inline-end: 0; border-bottom: 1px solid var(--color-border); }
}

.yh-header {
  position: sticky;
  top: 0;
  z-index: var(--z-navigation);
  background: var(--color-chrome);
}

.yh-header::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: var(--space-6);
  background: linear-gradient(to bottom, var(--color-chrome-glass), transparent);
  pointer-events: none;
}

@media (min-width: 801px) {
  .yh-shell[data-sidebar='true'] .yh-header::after {
    left: calc(var(--sidebar-width) + var(--sidebar-inset));
  }
}

.yh-header-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  box-sizing: border-box;
  min-height: var(--header-height);
  padding: 0 var(--space-4);
}

.yh-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 0 1 auto;
}

.yh-logo {
  display: inline-flex;
  flex: none;
}

/*
 * The Yihe mark (YiheMark, markSvg()). Stroke colours are theme tokens, so the mark flips with the theme; the
 * data-tone forms pin it to the light or the dark artwork for a surface that does not follow the theme. Classes only,
 * no inline style: server-rendered pages under style-src 'self' use the same rules. The lime accent is a logo and
 * marketing colour (--color-brand-accent); do not use it for controls.
 */
.yh-mark {
  flex: none;
}

.yh-mark-accent {
  stroke: var(--color-brand-accent);
}

.yh-mark-body {
  stroke: var(--color-logo-body);
}

.yh-mark[data-tone='light'] .yh-mark-accent {
  stroke: var(--lime-500);
}

.yh-mark[data-tone='light'] .yh-mark-body {
  stroke: var(--teal-700);
}

.yh-mark[data-tone='dark'] .yh-mark-accent {
  stroke: var(--lime-400);
}

.yh-mark[data-tone='dark'] .yh-mark-body {
  stroke: var(--teal-300);
}

.yh-app-icon {
  flex: none;
}

.yh-app-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: var(--line-md);
}

.yh-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
}

.yh-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border-radius: var(--control-radius);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.yh-nav a:hover {
  background: var(--color-fill-hover);
  color: var(--color-text);
}

.yh-nav a[aria-current],
.yh-nav a[aria-current='page'] {
  background: var(--color-selected);
  color: var(--color-on-selected);
  font-weight: var(--weight-medium);
}

.yh-header-end {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.yh-account {
  position: relative;
}

.yh-account-button {
  gap: var(--space-2);
  width: auto;
  padding: 0 var(--space-2);
}

.yh-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: var(--color-on-brand);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.yh-account-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* R023: a range is secondary to the app name; the parent header owns its gap. */
.yh-shell-scope { min-width: 0; max-width: 16rem; }
.yh-scope-trigger { max-width: 100%; min-width: 0; }
.yh-scope-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yh-scope-trigger > .yh-line-icon, .yh-scope-item > .yh-line-icon { flex: none; }
.yh-scope-menu { width: 20rem; max-height: var(--radix-dropdown-menu-content-available-height); overflow-y: auto; }
.yh-scope-item { justify-content: space-between; }
.yh-scope-item[aria-checked='true'] { color: var(--color-brand-text); font-weight: var(--weight-medium); }
.yh-scope-status { padding: var(--space-2) var(--space-3); overflow-wrap: anywhere; }
.yh-scope-create { flex-wrap: wrap; gap: 0 var(--gap-inline); padding-block: var(--space-2); }
.yh-scope-count { font-size: var(--text-sm); color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.yh-account[data-scope] > .yh-menu { width: 20rem; max-height: calc(100dvh - var(--header-height) - var(--space-4)); overflow-y: auto; }

/* ------------------------------------------------------------ body, sidebar and main */

.yh-body {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  min-width: 0;
}

/*
 * The content column. `main` is the column: at most --content-width (76rem, page gutters included, so 1152px of
 * content at 16px), centred in the area to the right of the sidebar, or in the window when there is no sidebar.
 * It is a flex item that grows up to its maximum, and the auto margins share what is left. The page itself
 * scrolls, so the scrollbar stays at the window edge. Below the maximum the column simply fills the area.
 */
:where(.yh-shell, .yh-main) {
  --yh-content-column-width: var(--ak-content-width, var(--content-width));
}

.yh-main {
  flex: 1 1 auto;
  box-sizing: border-box;
  min-width: 0;
  max-width: var(--yh-content-column-width);
  margin: 0 auto;
  padding: var(--space-8) var(--page-gutter);
  /* The blocks of a page (its header, notices, cards, tables, sections) are 24px apart: the column's gap, not their margins. */
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
}

/* Full width: a page that needs the whole area (two panes, a table with many columns) takes the maximum off. */
.yh-main[data-width='full'] {
  max-width: none;
  margin: 0;
}

.yh-main:focus {
  outline: none;
}

/*
 * The sidebar floats: inset from the window edges by --sidebar-inset, with rounded corners (--sidebar-radius) and the
 * glass of materials.css, so it reads as a pane laid over the canvas rather than a column cut out of it. It stays in
 * view while the page scrolls. Its items take the concentric radius (radius minus padding = the control radius).
 */
.yh-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--sidebar-inset));
  flex: none;
  box-sizing: border-box;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height) - 2 * var(--sidebar-inset));
  margin: var(--sidebar-inset) 0 var(--sidebar-inset) var(--sidebar-inset);
  padding: var(--space-3) var(--sidebar-padding);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid transparent;
  border-radius: var(--sidebar-radius);
  background: var(--color-chrome);
}

/*
 * Sidebar rhythm, all from gaps: groups are 24px apart, a group label sits 4px above its items, items are 2px apart
 * (24 > 4 > 2). SidebarNav writes a `.yh-sidebar-section` per group: the label, then `.yh-sidebar-items`. The label is
 * 12px / 600 / muted against 14px / 400 items, so the two never read alike. The footer (links to other sites) is the
 * last group, pushed to the bottom by a spacer; no divider: like the groups above it, space sets it apart.
 */
.yh-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  box-sizing: border-box;
  min-height: 100%;
}

.yh-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.yh-sidebar-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.yh-sidebar-group {
  padding: 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--line-xs);
}

.yh-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-base);
  line-height: var(--line-control);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.yh-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 16px icon in front of the label: secondary at rest, the colour of the label when hovered or current. */
.yh-nav-item .yh-line-icon {
  color: var(--color-text-secondary);
}

.yh-nav-item:hover .yh-line-icon,
.yh-nav-item[aria-current] .yh-line-icon,
.yh-nav-item[data-active] .yh-line-icon {
  color: inherit;
}

/* Links that leave the app (the footer area): the arrow sits at the right end. */
.yh-nav-item .yh-nav-external {
  margin-left: auto;
  color: var(--color-text-muted);
}

/*
 * The bottom group of the sidebar for the few links to other sites: an auto margin (alignment, not spacing) takes the
 * free height, so the group sits at the bottom and at least the nav's 24px gap below the navigation. The old spacer
 * element is no longer needed.
 */
.yh-sidebar-spacer {
  display: none;
}

.yh-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  margin-top: auto;
}

.yh-nav-item:hover {
  background: var(--color-fill-hover);
  color: var(--color-text);
}

.yh-nav-item:active {
  background: var(--color-fill-pressed);
}

/*
 * The current entry is a solid fill, as in System Settings: --color-selected with white text (5:1). It is the brand
 * teal in both themes: in dark the brand itself is the brighter teal-300 with dark text, so the fill stays a calm block
 * and not the brightest thing on the screen, and it keeps 3:1 against the dark surfaces.
 */
.yh-nav-item[aria-current],
.yh-nav-item[aria-current='page'],
.yh-nav-item[data-active],
.yh-nav-item[aria-current]:hover,
.yh-nav-item[aria-current='page']:hover,
.yh-nav-item[data-active]:hover {
  background: var(--color-selected);
  color: var(--color-on-selected);
  font-weight: var(--weight-medium);
}

.yh-sidebar-toggle {
  display: none;
}

.yh-sidebar-backdrop {
  display: none;
}

/* Narrow screens: the sidebar becomes a drawer opened from the header. */
@media (max-width: 800px) {
  .yh-sidebar-toggle {
    display: inline-flex;
  }

  /* The drawer is the same floating pane, over the page, sliding in from the left edge on the smooth spring. */
  .yh-sidebar {
    position: fixed;
    top: calc(var(--header-height) + var(--sidebar-inset));
    bottom: var(--sidebar-inset);
    left: var(--sidebar-inset);
    z-index: var(--z-popover);
    height: auto;
    width: min(var(--sidebar-width), calc(100vw - var(--space-12)));
    margin: 0;
    transform: translateX(calc(-100% - 2 * var(--sidebar-inset)));
    visibility: hidden;
    transition:
      transform var(--duration-base) var(--ease-in),
      visibility 0s linear var(--duration-base);
  }

  .yh-sidebar[data-open='true'] {
    transform: none;
    visibility: visible;
    transition:
      transform var(--duration-spring-smooth) var(--ease-spring-smooth),
      visibility 0s linear 0s;
  }

  .yh-sidebar-backdrop[data-open='true'] {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: calc(var(--z-popover) - 1);
    background: var(--color-backdrop);
    animation: yh-scrim-in var(--duration-base) var(--ease-out);
  }
}

@media (max-width: 720px) {
  .yh-nav {
    display: none;
  }

  /* Without a sidebar the top navigation moves into a scrollable second row. */
  .yh-shell[data-sidebar='false'] .yh-header-bar {
    flex-wrap: wrap;
    padding-bottom: var(--space-1);
  }

  .yh-shell[data-sidebar='false'] .yh-nav {
    display: flex;
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 480px) {
  .yh-header-bar {
    gap: var(--space-1) var(--space-2);
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .yh-account-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .yh-main {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .yh-sidebar {
    transition: none;
  }
}

/* ------------------------------------------------------------ first paint */

/*
 * A page change is not animated (no view transition, no crossfade: two pages' text never overlap); the new page is
 * there at once. Only the first paint of a document lets the first blocks settle together, once.
 */
/* First paint keeps content legible. All blocks settle together; nested data never staggers. */
@keyframes yh-enter {
  from {
    opacity: 0.92;
    transform: translateY(var(--motion-shift));
  }
}

html[data-yh-enter] .yh-main > :nth-child(-n + 8):not(.yh-skeleton, [aria-busy='true']) {
  animation: yh-enter var(--duration-base) var(--ease-out) backwards;
}

/* ------------------------------------------------------------ page header and breadcrumb */

/*
 * The top of a page: `.yh-page-head` holds the breadcrumb and the header row 8px apart; the header row holds the heading
 * (title row, then the description 8px below) and the actions. The page column puts the next block 24px below. Without a
 * breadcrumb or a description the title is still 24px from the content.
 */
.yh-page-head {
  display: flex;
  flex-direction: column;
  gap: var(--gap-display-text);
  min-width: 0;
}

.yh-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}

.yh-page-heading {
  display: flex;
  flex: 1 1 16rem;
  flex-direction: column;
  gap: var(--gap-display-text);
  min-width: 0;
}

.yh-page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
}

/*
 * A status badge on the title's baseline reaches 2px below the 40px title line; it gives that back, so the header is as
 * high with a status as without one (a detail page that loads without its status does not grow when it arrives).
 */
.yh-page-title-row > :is(.yh-badge, .yh-skeleton[data-shape='badge']) {
  margin-block-end: -0.25rem;
}

.yh-page-title {
  /* The large title (Apple, 2025): 34 / 40, bold, left-aligned; 28 / 36 on a phone (below). One per page. */
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-cjk);
  line-height: var(--line-3xl);
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .yh-page-title {
    font-size: var(--text-2xl);
    line-height: var(--line-2xl);
  }
}

/*
 * The compact title (`titleSize="compact"`, `pageTitleSize` on AppKitProvider): 22 / 30, semibold, at every width, for
 * applications that are mostly lists and tables. The breadcrumb and the description sit closer, as they do under any
 * title of this size (--gap-title-text). It does not change on scroll.
 */
.yh-page-head[data-title-size='compact'],
.yh-page-head[data-title-size='compact'] .yh-page-heading {
  gap: var(--gap-title-text);
}

.yh-page-head[data-title-size='compact'] .yh-page-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--line-xl);
}

/* The number beside a page title: secondary text, so 13px in the secondary colour (web-ui.md 3.5.1). */
.yh-count {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  font-variant-numeric: tabular-nums;
}

/* 8px under the large title (4px read as part of the title line at 34px): the gap of .yh-page-heading. */
.yh-page-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: var(--line-base);
}

.yh-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end; /* wrapped under the title on a narrow screen, the actions still sit at the right */
  gap: var(--gap-inline);
  margin-left: auto;
}

/* A group of controls (badges and a button) inside the actions stays one group. */
.yh-page-actions .yh-row {
  justify-content: flex-end;
}

.yh-breadcrumb {
  font-size: var(--text-sm);
}

.yh-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-secondary);
}

.yh-breadcrumb li {
  display: inline-flex;
  gap: var(--space-1);
}

.yh-breadcrumb li + li::before {
  content: '/';
  color: var(--color-text-muted);
}

.yh-breadcrumb a {
  color: var(--color-brand-text);
  text-decoration: none;
}

.yh-breadcrumb a:hover {
  text-decoration: underline;
}

/*
 * The bottom "危险操作" card of a detail page: --gap-section (32px) below the rest, a step more than the 24px between
 * cards (DetailPage puts the two in a section stack). Its items are rows divided by lines; in the card's padding the
 * first row has no space above and the last none below, so the card's own padding is the space at both ends.
 */
.yh-danger-zone .yh-danger-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.yh-danger-zone > .yh-card-header + .yh-danger-item,
.yh-danger-zone > .yh-danger-item:first-child {
  padding-top: 0;
}

.yh-danger-zone .yh-danger-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.yh-danger-item > div {
  display: flex;
  flex-direction: column;
  gap: var(--gap-title-text);
}

.yh-danger-title {
  font-weight: var(--weight-medium);
}

/* An inline error or notice between the page header and the content it concerns: a block of the page like the others (24px). */
.yh-page-notice {
  min-width: 0;
}

/* ------------------------------------------------------------ standard pages (sign-in, status, errors) */

/*
 * Entry pages (EntryGate's pages, EntryPage: sign-in, sign-up, reset): the card in the middle of the window, 400px wide
 * (--entry-width), on the page colour. A tall card keeps 48px from the top and bottom. On a phone there is no card: the
 * content sits on the surface colour from the top, where the keyboard does not push it around.
 */
.yh-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-12) var(--space-4);
  background: var(--color-bg);
}

.yh-entry:focus {
  outline: none;
}

.yh-entry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--entry-width);
  padding: var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--dialog-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.yh-entry-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-cjk);
  line-height: var(--line-xl);
}

.yh-entry-text {
  margin: 0;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.yh-entry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
}

/* EntryPage: the card and the row of links under it, 24px apart. */
.yh-entry-body {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
  width: 100%;
  max-width: var(--entry-width);
}

/*
 * A card with a form: the head (mark, title, one line) is centred, the content is left-aligned and fills the card, 32px
 * under the head (two alignments need more air than the 24px between blocks). The buttons of its form fill the width,
 * 40px high (44px on touch), the primary one first.
 */
.yh-entry-card[data-form] {
  align-items: stretch;
  gap: var(--space-8);
  text-align: start;
}

.yh-entry-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.yh-entry-heading {
  display: flex;
  flex-direction: column;
  gap: var(--gap-display-text);
}

.yh-entry-mark {
  display: flex;
}

/* What the page puts in the card (an Alert, the form, tabs): blocks 24px apart. */
.yh-entry-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
  min-width: 0;
}

.yh-entry-card[data-form] .yh-form {
  max-width: none;
}

.yh-entry-card[data-form] :is(.yh-form-actions, .yh-entry-actions) {
  flex-direction: column;
  align-items: stretch;
}

.yh-entry-card[data-form] :is(.yh-form-actions, .yh-entry-actions) > .yh-button,
.yh-entry-content > .yh-button {
  min-height: var(--yh-control-lg);
}

/* Two ways in (验证码 / 密码): the segmented control spans the card, its segments equal. */
.yh-entry-content > .yh-tabs > .yh-tabs-list {
  justify-self: stretch;
  width: auto;
}

.yh-entry-content > .yh-tabs > .yh-tabs-list > .yh-tab {
  flex: 1 1 0;
  justify-content: center;
}

/* Secondary links under the card: one centred row, each link one control high (44px on touch). */
.yh-entry-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--space-6);
}

.yh-entry-links > .yh-button[data-variant='link'] {
  min-height: var(--yh-control);
}

@media (max-width: 480px) {
  .yh-entry {
    justify-content: flex-start;
    background: var(--color-surface);
  }

  .yh-entry-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .yh-entry-actions .yh-button {
    flex: 1 1 100%;
  }
}

/* A status page inside the frame (403, 404, 500, empty): left-aligned, no card. */
.yh-state-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 32rem;
  padding: var(--space-12) 0;
}

.yh-state-page h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--line-xl);
}

.yh-state-page p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* ------------------------------------------------------------ resizable panels */

.yh-panels,
.yh-sortable {
  /* The 28px a handle or a collapsed stripe takes. */
  --yh-handle-area: calc(var(--space-6) + var(--space-0-5) * 2);
}
.yh-panels {
  display: flex;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.yh-panels[data-orientation='vertical'] { flex-direction: column; }
.yh-panels[data-dragging] { user-select: none; }
.yh-panel {
  position: relative;
  display: flex;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.yh-panel-body { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; }
.yh-panel-body[hidden] { display: none; }

/* A 1px line; the grab area around it is wider than the line, as the desktop client's divider. */
.yh-panels-handle,
.yh-panels-rule {
  position: relative;
  z-index: 1;
  flex: none;
  background: var(--color-border);
}
.yh-panels[data-orientation='horizontal'] > :is(.yh-panels-handle, .yh-panels-rule) { width: 1px; }
.yh-panels[data-orientation='vertical'] > :is(.yh-panels-handle, .yh-panels-rule) { height: 1px; }
.yh-panels-handle { cursor: col-resize; touch-action: none; outline: none; }
.yh-panels[data-orientation='vertical'] > .yh-panels-handle { cursor: row-resize; }
.yh-panels-handle::before {
  content: '';
  position: absolute;
  inset: 0 calc(var(--space-2) * -1);
}
.yh-panels[data-orientation='vertical'] > .yh-panels-handle::before { inset: calc(var(--space-2) * -1) 0; }
.yh-panels-handle::after {
  content: '';
  position: absolute;
  inset: 0 -1px;
  background: var(--color-brand);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.yh-panels[data-orientation='vertical'] > .yh-panels-handle::after { inset: -1px 0; }
/* The focus is the brand line and the fold button; the page's ring (base.css, more specific than the outline: none above)
 * would sit outside the 1px handle, where a nested panel cuts it. A transparent outline is the ring in forced-colours mode. */
.yh-panels-handle:focus-visible { outline: 2px solid transparent; }
.yh-panels-handle:hover::after,
.yh-panels-handle:focus-visible::after,
.yh-panels[data-dragging] > .yh-panels-handle::after { opacity: 1; }

.yh-panels-fold {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-5);
  height: var(--space-5);
  padding: 0;
  transform: translate(-50%, -50%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.yh-panels-handle:hover > .yh-panels-fold,
.yh-panels-handle:focus-visible > .yh-panels-fold { opacity: 1; }
.yh-panels-fold:hover { background: var(--color-fill-hover); color: var(--color-text); }

.yh-panel[data-collapsed] { flex: 0 0 var(--yh-handle-area); background: var(--color-surface-subtle); }
.yh-panel-stripe {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-3) 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.yh-panel-stripe:hover { background: var(--color-fill-hover); color: var(--color-text); }
.yh-panel-stripe:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
.yh-panels[data-orientation='vertical'] > .yh-panel[data-collapsed] { flex-basis: var(--yh-handle-area); }
.yh-panels[data-orientation='vertical'] .yh-panel-stripe { align-items: center; padding: 0 var(--space-3); justify-content: flex-start; }

/* ------------------------------------------------------------ sortable list */

.yh-sortable { margin: 0; padding: 0; list-style: none; }
.yh-sortable-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--yh-control);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.yh-sortable-row + .yh-sortable-row { border-top: 1px solid var(--color-border); }
.yh-sortable-row[data-dragging] {
  z-index: 2;
  border-top-color: transparent;
  box-shadow: var(--shadow-raised);
}
.yh-sortable-row[data-dragging] + .yh-sortable-row { border-top-color: transparent; }
.yh-sortable-content { flex: 1 1 auto; min-width: 0; }
.yh-sortable-handle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  box-sizing: border-box;
  width: var(--yh-handle-area);
  min-height: var(--yh-control);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: grab;
  touch-action: none;
}
.yh-sortable-handle:hover { background: var(--color-fill-hover); color: var(--color-text); }
.yh-sortable-handle:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
.yh-sortable-row[data-dragging] .yh-sortable-handle { cursor: grabbing; }
.yh-sortable-handle[data-disabled] { cursor: default; visibility: hidden; }

/* Route navigation belongs to the page header and never wraps into another row. */
.yh-page-head[data-navigation] { gap: var(--space-4); }
.yh-page-heading-area { display: flex; flex-direction: column; gap: var(--gap-display-text); min-width: 0; }
.yh-page-head[data-title-size='compact'] .yh-page-heading-area { gap: var(--gap-title-text); }
.yh-page-navigation-slot { min-width: 0; }
.yh-page-navigation {
  display: flex;
  gap: var(--space-6);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: thin;
}
.yh-page-navigation[data-overflow-end] { mask-image: linear-gradient(to right, black calc(100% - var(--space-4)), transparent); }
.yh-page-navigation-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: var(--space-2) var(--space-1);
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}
.yh-page-navigation-link:hover { color: var(--color-text); }
.yh-page-navigation-link[aria-current='page'] {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  border-bottom-color: var(--color-brand);
}
.yh-page-navigation-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* Application-level opt-in: content is closer without shrinking controls or form fields. */
.yh-shell[data-content-density='workspace'] { --gap-block: var(--space-4); }
.yh-shell[data-content-density='workspace'] .yh-main { padding-block: var(--space-6); }
.yh-shell[data-content-density='workspace'] .yh-list-body { gap: var(--space-3); }
@media (max-width: 640px) {
  .yh-shell[data-content-density='workspace'] .yh-main { padding-block: var(--space-4); }
}

/* Optional workspace tools share the content column's left edge. */
.yh-shell-workspace-toolbar { flex: 1 1 auto; min-width: 0; }
.yh-workspace-toolbar, .yh-workspace-history, .yh-workspace-actions { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.yh-workspace-toolbar { gap: var(--space-3); }
.yh-workspace-history, .yh-workspace-actions { flex: none; }
.yh-workspace-location { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.yh-workspace-location .yh-breadcrumb { margin: 0; }
.yh-workspace-location .yh-breadcrumb ol { flex-wrap: nowrap; }
.yh-workspace-location .yh-breadcrumb li { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yh-workspace-location .yh-breadcrumb li:last-child { flex: 0 1 auto; }
.yh-workspace-actions .yh-palette-trigger { width: auto; }
@media (min-width: 801px) {
  .yh-shell[data-sidebar='true'][data-workspace-toolbar] .yh-brand { flex: 0 0 calc(var(--sidebar-width) + var(--sidebar-inset) + var(--page-gutter) - 2 * var(--space-4)); }
}
@media (max-width: 800px) {
  .yh-shell[data-workspace-toolbar] .yh-app-name { display: none; }
  .yh-workspace-toolbar { gap: var(--space-1); }
  .yh-workspace-location .yh-breadcrumb li:not(:last-child) { display: none; }
}
@media (max-width: 480px) {
  .yh-workspace-location { display: none; }
  .yh-workspace-actions { margin-inline-start: auto; }
}

/* Window-level page navigation stays in the shell chrome while the page scrolls. */
.yh-shell[data-workspace-tabs] {
  --yh-expanded-header: calc(var(--header-height) + var(--yh-control) + var(--space-2));
}
.yh-shell[data-workspace-tabs] > .yh-body { --header-height: var(--yh-expanded-header); }
.yh-shell-workspace-tab-column {
  box-sizing: border-box;
  max-width: var(--yh-content-column-width);
  margin-inline: auto;
  padding: 0 var(--page-gutter) var(--space-2);
}
.yh-shell-workspace-tab-column[data-width='full'] { max-width: none; }
@media (min-width: 801px) {
  .yh-shell[data-sidebar='true'] .yh-shell-workspace-tabs {
    padding-inline-start: calc(var(--sidebar-width) + var(--sidebar-inset));
  }
}
.yh-workspace-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-inline-size: 0;
}
.yh-workspace-tabs > .yh-icon-button { flex: none; }
.yh-workspace-tabs-strip {
  --yh-workspace-edge: var(--space-2);
  --yh-workspace-fade-start: 0px;
  --yh-workspace-fade-end: 0px;
  --yh-workspace-flow: to right;
  display: flex;
  flex: 1 1 auto;
  gap: var(--space-1);
  min-inline-size: 0;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding-inline: var(--yh-workspace-edge);
  margin: 0;
  padding: 0;
  list-style: none;
}
.yh-workspace-tabs-strip:dir(rtl) { --yh-workspace-flow: to left; }
.yh-workspace-tabs-strip[data-overflow-start] { --yh-workspace-fade-start: var(--yh-workspace-edge); }
.yh-workspace-tabs-strip[data-overflow-end] { --yh-workspace-fade-end: var(--yh-workspace-edge); }
.yh-workspace-tabs-strip:is([data-overflow-start], [data-overflow-end]) {
  mask-image: linear-gradient(var(--yh-workspace-flow), transparent, black var(--yh-workspace-fade-start), black calc(100% - var(--yh-workspace-fade-end)), transparent);
}
.yh-workspace-tab {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  max-inline-size: 16rem;
  max-inline-size: min(16rem, calc(100% - 2 * var(--yh-workspace-edge)));
  min-height: var(--yh-control);
  border-radius: var(--control-radius);
  color: var(--color-text-secondary);
}
.yh-workspace-tab:hover { background: var(--color-fill-hover); }
.yh-workspace-tab[data-current] {
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
}
.yh-workspace-tab-link {
  display: flex;
  align-items: center;
  min-inline-size: 0;
  min-height: var(--yh-control);
  padding-inline: var(--space-3);
  border-radius: var(--control-radius);
  color: inherit;
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.yh-workspace-tab-link:hover { text-decoration: none; }
.yh-workspace-tab-link:focus-visible,
.yh-workspace-tab .yh-workspace-tab-close:focus-visible { outline-offset: -2px; }
.yh-workspace-tab-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yh-workspace-tab-close { flex: none; }

/*
 * @catalytic/app-kit design system, part 6: pickers, upload and steps. Combobox, MultiSelect, TreeSelect, DatePicker,
 * DateRangePicker, FileDropzone, Stepper. Tokens only; state is carried by data-* and aria-* attributes.
 */

/* ------------------------------------------------------------ the frame of a combobox (looks like .yh-input) */

/* Large entity sets belong in a paginated dialog, not a page-width popup. */
.yh-entity-picker {
  width: 100%;
  max-width: var(--form-width);
  min-width: 0;
}

.yh-entity-picker-trigger {
  width: 100%;
  min-width: 0;
  height: auto;
  justify-content: space-between;
  white-space: normal;
  text-align: start;
}

.yh-entity-picker-summary,
.yh-entity-picker-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: var(--gap-display-text);
}

.yh-entity-picker-summary,
.yh-entity-picker-option,
.yh-entity-picker-draft,
.yh-entity-picker-results .yh-check-text,
.yh-entity-picker-results .yh-check > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.yh-entity-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--gap-field);
}

.yh-entity-picker-dialog .yh-dialog-content {
  overflow: hidden;
}

.yh-entity-picker-body > :not(.yh-entity-picker-results) {
  flex: none;
}

.yh-entity-picker-results {
  flex: 1 1 auto;
  box-sizing: border-box;
  min-height: 0;
  max-height: var(--entity-picker-results-height);
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-1);
}

.yh-entity-picker-results .yh-radio-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap-choice);
}

.yh-entity-picker-option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}

.yh-entity-picker-draft {
  margin: 0;
  color: var(--color-text-secondary);
}

.yh-combobox {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  width: 100%;
  min-height: var(--yh-control);
  /* 12px on both sides: the chevron sits as far from the right edge as the text from the left, and level with the chevron of Select. */
  padding: 0 var(--space-3);
  /* One box (docs/design-system-css.md 一个控件一个框): the states below change --yh-frame-*; the parts draw none. */
  --yh-frame-edge: var(--color-control-border);
  --yh-frame-fill: var(--color-surface);
  --yh-frame-shadow: inset 0 0 0 0 transparent;
  border: 1px solid var(--yh-frame-edge);
  border-radius: var(--control-radius);
  background: var(--yh-frame-fill);
  box-shadow: var(--yh-frame-shadow);
  color: var(--color-text);
  cursor: text;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.yh-combobox[data-multiple] {
  flex-wrap: wrap;
  padding-block: var(--space-1);
}

/*
 * A date field ends in 28px buttons (clear, calendar), not a chevron: 8px keeps the calendar icon where the chevrons are.
 * It never wraps (the frame wraps only for the tags of a MultiSelect): when it is too narrow for the value and both
 * buttons, the clear button goes first (the text can still be deleted with the keyboard) and the calendar button
 * stays. A single date needs 12rem with both buttons, a range 19rem (at 16px text on a touch screen).
 */
.yh-combobox.yh-date {
  flex-wrap: nowrap;
  padding-right: var(--space-2);
  container-type: inline-size;
}

@container (max-width: 12rem) {
  .yh-date:not(.yh-date-range) .yh-combobox-clear {
    display: none;
  }
}

@container (max-width: 19rem) {
  .yh-date-range .yh-combobox-clear {
    display: none;
  }
}

.yh-combobox:hover {
  --yh-frame-edge: var(--color-text-muted);
}

.yh-combobox:focus-within,
.yh-combobox[data-open] {
  /* The 2px inner edge of a text field (controls.css); the transparent outline is the ring in forced-colours mode. */
  --yh-frame-edge: var(--color-focus);
  --yh-frame-shadow: inset 0 0 0 1px var(--yh-frame-edge);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* After the focus rule: an invalid field with the focus thickens its edge in red, so the focus never hides the error. */
.yh-combobox[data-invalid] {
  --yh-frame-edge: var(--color-danger);
}

.yh-combobox[data-disabled] {
  --yh-frame-fill: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.yh-combobox-input {
  flex: 1 1 4rem;
  min-width: 0;
  min-height: calc(var(--yh-control) - 2px);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: var(--leading-compact);
  outline: none;
  text-overflow: ellipsis;
}

/* Autofilled by the browser, the input is covered with the frame's fill (as the input of a group, controls.css). */
.yh-combobox-input:is(:autofill, :-webkit-autofill) {
  box-shadow: inset 0 0 0 100vmax var(--yh-frame-fill);
  -webkit-text-fill-color: var(--color-text);
  caret-color: var(--color-text);
}

/*
 * The field inside the frame draws no frame and no ring of its own: the frame around it is the field and shows the
 * focus (the halo of :focus-within above). It has to outweigh the page's focus rule in base.css (.yh-root *:focus-visible),
 * hence the container in front. Before this rule the input drew a second, inner ring that also covered the clear button
 * and the chevron of a MultiSelect.
 */
:is(.yh-root, .yh-shell, .yh-entry, .yh-popup) .yh-combobox-input:focus-visible,
.yh-combobox-input:focus-visible {
  outline: none;
  box-shadow: none;
}

/* The small buttons inside the frame (clear, open, remove a tag) keep a keyboard ring, drawn tight around them so it stays inside the frame. */
:is(.yh-root, .yh-shell, .yh-entry, .yh-popup) :is(.yh-combobox-clear, .yh-combobox-button, .yh-tag-remove):focus-visible {
  outline-offset: 0;
}

.yh-combobox-input::placeholder,
.yh-combobox-input[data-placeholder] {
  color: var(--color-text-muted);
}

.yh-combobox-input:disabled {
  cursor: not-allowed;
}

/* TreeSelect: the field is a button that shows the value. */
.yh-combobox-trigger {
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}

.yh-combobox-chevron {
  flex: none;
  margin-left: auto;
  color: var(--color-text-muted);
  pointer-events: none;
}

.yh-combobox-clear,
.yh-combobox-button,
.yh-tag-remove {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.yh-combobox-clear,
.yh-combobox-button {
  width: var(--yh-control-sm);
  height: var(--yh-control-sm);
}

/* A part of the field: the pointer shows in the colour, not in a fill of its own (one box). */
.yh-combobox-clear:hover,
.yh-combobox-button:hover,
.yh-tag-remove:hover {
  color: var(--color-text);
}

/* Tags of a MultiSelect. */
.yh-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-0-5);
  max-width: 100%;
  min-height: var(--control-height-sm);
  box-sizing: border-box;
  padding: 0 var(--space-1) 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-brand-subtle);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.yh-tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-tag-remove {
  width: var(--icon-size);
  height: var(--icon-size);
  min-width: var(--icon-size);
}

/*
 * Optical sizes inside a field. A cross fills its box corner to corner and looks bigger than a chevron of the same box,
 * so the clear cross is 14px beside the 16px chevron, and the cross of a tag is 12px with a 2px stroke, as heavy as the
 * 13px text beside it (a 16px cross outweighed the name).
 */
.yh-combobox-clear .yh-line-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.yh-tag-remove .yh-line-icon {
  width: 0.75rem;
  height: 0.75rem;
  stroke-width: 1.75;
}

@media (pointer: coarse) {
  .yh-tag-remove {
    width: var(--hit-target);
    height: var(--hit-target);
    margin-block: calc((var(--control-height-sm) - var(--hit-target)) / 2);
  }
}

/* ------------------------------------------------------------ the drop-down list */

.yh-combobox-popup {
  box-sizing: border-box;
  width: var(--radix-popover-trigger-width, 16rem);
  max-width: calc(100vw - var(--space-8));
  max-height: min(22rem, var(--radix-popover-content-available-height, 22rem));
  overflow: auto;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  z-index: var(--z-popover);
}

/* listWidth="content": at least the field, wider for longer options, at most 360px (or the field, when that is wider). */
.yh-combobox-popup[data-width='content'] {
  width: max-content;
  min-width: var(--radix-popover-trigger-width, 16rem);
  max-width: min(max(var(--radix-popover-trigger-width, 16rem), 22.5rem), calc(100vw - var(--space-8)));
}

.yh-combobox-list {
  display: flex;
  flex-direction: column;
}

.yh-combobox-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}

.yh-combobox-option[data-active] {
  background: var(--color-fill-hover);
}

.yh-combobox-option[aria-selected='true'] {
  color: var(--color-brand-text);
}

.yh-option-avatar {
  display: inline-flex;
  flex: none;
}

.yh-option-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.yh-option-label,
.yh-option-secondary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-option-secondary {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/*
 * Rows of popup lists (docs/design-system-css.md, 弹层列表的行): one height in a list; supporting information on the
 * right of the one line (the detail: a count, a code, a state), quieter and with tabular numerals; the label is cut
 * before the detail is. A list in which an option has a second line under its label is a two-line list: every row is
 * 48px, with or without that line.
 */
.yh-option-detail {
  flex: none;
  margin-left: auto;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yh-option-check {
  flex: none;
  margin-left: auto;
}

/* The tick has a column on every row (empty where the option is not chosen), so the details line up on the right. */
.yh-option-check[data-empty] {
  display: inline-block;
  width: var(--icon-size);
  height: var(--icon-size);
}

.yh-option-detail + .yh-option-check {
  margin-left: 0;
}

.yh-combobox-list[data-rows='two-line'] > .yh-combobox-option {
  min-height: 3rem;
}

/* Disabled and revoked rows keep the geometry of the others: same height, indent and columns, only the muted colour. */
:is(.yh-combobox-option, .yh-tree-item)[aria-disabled='true'] {
  opacity: 1;
  color: var(--color-text-muted);
  cursor: not-allowed;
}

:is(.yh-combobox-option, .yh-tree-item)[aria-disabled='true'] .yh-option-detail {
  color: var(--color-text-muted);
}

/* A disabled tree node mutes its icon and the words of its badge too (the dot keeps the colour of the state). */
.yh-tree-item[aria-disabled='true'] :is(.yh-tree-icon, .yh-badge[data-dot]:not([data-filled])) {
  color: var(--color-text-muted);
}

/* A picture or colour in the leading slot has no text colour to mute: it is faded instead. */
.yh-combobox-option[aria-disabled='true'] .yh-option-avatar {
  opacity: 0.5;
}

.yh-combobox-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3);
  color: var(--color-text-secondary);
}

.yh-combobox-note[data-tone='danger'] {
  color: var(--color-danger);
}

.yh-avatar[data-size='sm'] {
  width: 1.375rem;
  height: 1.375rem;
  font-size: var(--text-xs);
}

.yh-avatar > img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

/* ------------------------------------------------------------ tree */

.yh-tree-popup {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/*
 * The search field at the top of a tree list is a filled field, the way a search field sits inside a menu: no frame
 * of its own inside the frame of the list, a light fill, and the focus halo when it has the focus.
 */
.yh-tree-search {
  padding: var(--space-1);
}

.yh-tree-search .yh-input {
  --yh-field-edge: transparent;
  border-radius: var(--yh-inner-radius, var(--control-radius));
  --yh-field-fill: var(--color-fill-hover);
}

.yh-tree-search .yh-input:hover {
  --yh-field-edge: transparent;
  --yh-field-fill: var(--color-fill-pressed);
}

.yh-tree-search .yh-input:focus-visible {
  --yh-field-edge: var(--color-focus);
  --yh-field-fill: var(--color-surface);
}

.yh-tree {
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-tree-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-height: var(--yh-control);
  /* Each level of the tree is indented 20px more, 16px on a phone (the row sets --yh-tree-level: 0 at the top). */
  --yh-tree-level: 0;
  --yh-tree-indent: var(--space-5);
  /* 8px from the highlight edge on both sides at the top level (the indent adds to the left only). */
  padding-inline: calc(var(--space-2) + var(--yh-tree-level) * var(--yh-tree-indent)) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

/* On a phone a deep node keeps room for its name: 16px a level. */
@media (max-width: 480px) {
  .yh-tree-item {
    --yh-tree-indent: var(--space-4);
  }
}

.yh-tree-item:hover {
  background: var(--color-fill-hover);
}

.yh-tree-item:focus-visible {
  background: var(--color-fill-hover);
  outline: var(--focus-ring);
  outline-offset: -2px;
}

.yh-tree-item[aria-selected='true'] {
  color: var(--color-brand-text);
  font-weight: var(--weight-medium);
}

/*
 * The label of a tree row takes the room it needs after the fixed columns (arrow, checkbox, icon) and is cut first; the
 * badge follows it, and the detail, the tick and the "⋯" keep the right end (their auto margin takes the free room).
 * In a narrow tree (a deep node on a phone) the label still keeps 3em, so the name never disappears: then the detail
 * and the badge give way (the label shrinks a thousand times faster, so it is cut first down to those 3em).
 */
.yh-tree-item > .yh-option-label {
  flex: 0 1000 auto;
  min-width: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A group that cannot be chosen in a multiple tree keeps the column of the checkbox; a disabled node's box is greyed. */
.yh-tree-check[data-empty] {
  visibility: hidden;
}

.yh-tree-item[aria-disabled='true'] .yh-tree-check {
  border-color: var(--color-border);
  background: var(--color-surface-subtle);
}

.yh-tree-toggle {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--icon-size);
  height: var(--icon-size);
  color: var(--color-text-muted);
}

/* On touch the arrow of a node with children is a 44px target (the row is 44px high); a leaf's empty column is the row. */
@media (pointer: coarse) {
  .yh-tree-item[aria-expanded] > .yh-tree-toggle::after {
    content: '';
    position: absolute;
    inset: calc((var(--icon-size) - var(--hit-target)) / 2);
  }
}

/* The kind of the node (TreeNode icon): 16px, secondary like the icons of the sidebar. */
.yh-tree-icon {
  flex: none;
  color: var(--color-text-secondary);
}

.yh-tree-badge {
  display: inline-flex;
  flex: 0 10 auto;
  min-width: 0;
}

/*
 * When the row is too narrow, the words of a dot badge end in an ellipsis: the badge becomes a block (a block can cut its
 * text) and its dot sits in the badge's own start padding (6px dot + 4px), so the words still start 4px after it.
 */
.yh-tree-item .yh-tree-badge > .yh-badge[data-dot]:not([data-filled]) {
  position: relative;
  display: block;
  min-width: 0;
  padding-inline-start: calc(var(--space-2) + var(--space-0-5)); /* the 6px dot and the 4px after it */
  overflow: hidden;
  text-overflow: ellipsis;
}

.yh-tree-item .yh-tree-badge > .yh-badge[data-dot]:not([data-filled])::before {
  position: absolute;
  top: 50%;
  left: 0;
  translate: 0 -50%;
}

/* After the label's 3em the badge gives way, the detail last (the shrink factors 1000 : 10 : 1 set that order). */
.yh-tree-item > .yh-option-detail {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A node whose children could not be loaded: the note in the danger colour and "重试", on the right like a detail. */
.yh-tree-failed {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--gap-inline);
  margin-left: auto;
}

.yh-tree-failed > .yh-option-detail[data-tone='danger'] {
  color: var(--color-danger);
}

.yh-tree-failed + .yh-option-check {
  margin-left: 0;
}

.yh-tree-check {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.yh-tree-check[data-state='checked'],
.yh-tree-check[data-state='mixed'] {
  border-color: var(--color-brand);
  background: var(--color-brand);
}

.yh-tree-check[data-state='checked']::after {
  content: '';
  position: absolute;
  inset: 0.125rem 0.3125rem 0.25rem;
  border: solid var(--color-on-brand);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.yh-tree-check[data-state='mixed']::after {
  content: '';
  position: absolute;
  inset: 0.4375rem 0.1875rem;
  background: var(--color-on-brand);
}

/*
 * The tree on a page (Tree, docs/design-system-css.md 树): the rows of TreeSelect, 2px apart like the sidebar's items, with
 * the control radius (it is not inside a concentric container). The current node is drawn like the sidebar's current
 * item: the solid --color-selected fill, --color-on-selected text, medium weight; its icon, detail, "⋯" and badges follow.
 * The "⋯" of a row shows on hover, on the focused row and on the current row (always on touch); it keeps its column
 * while hidden, so the details of all rows line up.
 */
.yh-tree-view {
  --yh-inner-radius: var(--control-radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.yh-tree-view .yh-tree-item:focus-visible {
  outline-offset: -2px;
}

.yh-tree-chevron { transform: rotate(0deg); transform-origin: center; transition: transform var(--duration-spring-snappy) var(--ease-spring-snappy); }
.yh-tree-chevron[data-expanded] { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  .yh-tree-item, .yh-tree-chevron { transition: none; }
}

.yh-tree-view .yh-tree-item[aria-current],
.yh-tree-view .yh-tree-item[aria-current]:hover {
  background: var(--color-selected);
  color: var(--color-on-selected);
  font-weight: var(--weight-medium);
}

.yh-tree-view .yh-tree-item[aria-current] :is(.yh-tree-toggle, .yh-tree-icon, .yh-option-detail, .yh-tree-more) {
  color: inherit;
}

.yh-tree-view .yh-tree-item[aria-current] .yh-badge:not([data-filled]) {
  color: inherit;
}

.yh-tree-view .yh-tree-item[aria-current] .yh-badge[data-dot]:not([data-filled])::before {
  background: currentColor;
}

.yh-tree-more {
  flex: none;
  margin-left: auto;
}

:is(.yh-option-detail, .yh-tree-failed) + .yh-tree-more {
  margin-left: 0;
}

.yh-tree-view .yh-tree-more {
  width: var(--yh-control-sm);
  min-height: var(--yh-control-sm);
}

.yh-tree-more[data-empty] {
  display: block;
  width: var(--yh-control-sm);
  height: var(--yh-control-sm);
}

.yh-tree-view .yh-tree-more:not([data-empty]) {
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.yh-tree-view .yh-tree-item:is(:hover, :focus-within, [aria-current]) .yh-tree-more,
.yh-tree-view .yh-tree-more[data-state='open'] {
  opacity: 1;
}

@media (hover: none) {
  .yh-tree-view .yh-tree-more:not([data-empty]) {
    opacity: 1;
  }
}

/* ------------------------------------------------------------ date fields and calendar */

/* A date takes the room of its ten figures, not the whole row (the figures are tabular, so every date is as wide). */
.yh-date .yh-combobox-input {
  flex: 1 1 auto;
  font-variant-numeric: tabular-nums;
}

/*
 * A range is one phrase: "2026-11-04 – 2026-11-06", the dash 8px from each date, the pair at the start of the field and
 * the clear and calendar buttons at its end. Each half is as wide as a date (10ch) and as its placeholder ("开始日期").
 */
.yh-date-range .yh-combobox-input {
  flex: 0 1 auto;
  width: max(10.5ch, 4.5em);
  min-width: 0;
}

.yh-date-range .yh-combobox-input + .yh-date-sep + .yh-combobox-input {
  margin-inline-end: auto;
}

.yh-date-sep {
  flex: none;
  padding-inline: var(--space-2);
  color: var(--color-text-muted);
}

.yh-calendar-popup {
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--popup-radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  z-index: var(--z-popover);
}

/* The month bar, the grid and the quick choices, 8px apart (the grid's 2px row spacing adds to it at its edges). */
.yh-calendar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The month at the start (in line with the first day column), previous and next together at the end. */
.yh-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-inline-start: var(--space-2);
}

.yh-calendar-title {
  font-weight: var(--weight-semibold);
}

.yh-calendar-nav {
  display: inline-flex;
  gap: var(--space-1);
}

/* Rows 2px apart, so the bands of two weeks never merge into a block; columns touch, so a band runs on unbroken. */
.yh-calendar-grid {
  border-collapse: separate;
  border-spacing: 0 2px;
  table-layout: fixed;
}

.yh-calendar-grid th {
  padding: var(--space-1) 0;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  line-height: var(--line-xs);
  text-align: center;
}

.yh-calendar-grid td {
  position: relative;
  padding: 0;
  text-align: center;
}

/*
 * The range band (docs/design-system-css.md, "日期范围带"): drawn by the cells, not the day buttons, so it runs from the
 * centre of the first day to the centre of the last with no gap, as high as a day circle. The circles of the first and
 * the last day sit on its ends. Where the range goes on in the next week (or came from the previous one) the band ends
 * round at the edge of the row. While only the start is picked, the band to the day under the pointer is lighter.
 */
.yh-calendar-grid td[data-range]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-brand-subtle);
}

.yh-calendar-grid td[data-range][data-preview]::before {
  background: color-mix(in srgb, var(--color-brand-subtle) 55%, transparent);
}

.yh-calendar-grid td[data-range='start']::before {
  left: 50%;
}

.yh-calendar-grid td[data-range='end']::before {
  right: 50%;
}

.yh-calendar-grid td[data-range]:first-child::before {
  border-start-start-radius: var(--radius-full);
  border-end-start-radius: var(--radius-full);
}

.yh-calendar-grid td[data-range]:last-child::before {
  border-start-end-radius: var(--radius-full);
  border-end-end-radius: var(--radius-full);
}

/*
 * A day: a circle as high as a control (44px on touch). Hierarchy, strongest first: the picked day (filled brand
 * circle), the range band, the pointer (a grey circle), today (brand-coloured figures, no ring, so it never looks
 * picked), a day of the next or the previous month (muted), a day that cannot be picked (faint, not clickable).
 */
.yh-calendar-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--control-height);
  height: var(--control-height);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

@media (pointer: coarse) {
  .yh-calendar-day {
    width: var(--hit-target);
    height: var(--hit-target);
  }
}

/* Seven 44px day targets need 308px: remove side padding on the smallest touch viewport. */
@media (pointer: coarse) and (max-width: 360px) {
  .yh-calendar-popup { max-width: calc(100vw - var(--space-2)); padding-inline: 0; }
  .yh-calendar-head, .yh-calendar-foot { padding-inline: var(--space-2); }
}

.yh-calendar-day:hover {
  background: var(--color-fill-hover);
}

.yh-calendar-day[data-outside] {
  color: var(--color-text-muted);
}

.yh-calendar-day[data-today] {
  color: var(--color-brand-text);
  font-weight: var(--weight-semibold);
}

.yh-calendar-day[data-selected] {
  background: var(--color-brand);
  color: var(--color-on-brand);
}

.yh-calendar-day[aria-disabled='true'] {
  color: var(--color-text-muted);
  opacity: 0.45;
  cursor: not-allowed;
}

.yh-calendar-day[aria-disabled='true']:hover {
  background: transparent;
}

/* Quick choices ("今天", "一个月后", "未来 30 天"): tinted text buttons in one row under the grid, the first in line with the month. */
.yh-calendar-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  padding-inline-start: var(--space-2);
}

/* ------------------------------------------------------------ number and quantity fields */

/*
 * NumberField and QuantityField (docs/design-system-css.md "数字、单位与数量") are the input group of a form field
 * (.yh-input-group, controls.css: the same box as Input with a prefix or suffix) with .yh-number: the number, a text
 * affix (¥, %, mL, 积分) and, for a quantity, the unit menu as the control at the end behind a 1px divider. The group
 * takes the focus halo; the number draws no ring. Numerals are tabular; the number starts at the left like any text.
 */
.yh-number-value {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.yh-number-value > .yh-input,
.yh-number .yh-input-affix[data-text] {
  font-variant-numeric: tabular-nums;
}

/* The input keeps 1.2×10⁻³ as its text for screen readers; what the eye sees is the drawing over it. */
.yh-number-value > .yh-input[data-overlaid] {
  color: transparent;
}

/* Drawn where the input's text is: the input's padding, its line, centred like it. */
.yh-number-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 var(--yh-control-inset);
  overflow: hidden;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: var(--line-control);
  pointer-events: none;
}

/*
 * The exponent of 1.2×10⁻³, in the kit's font (HarmonyOS Sans has superscript digits but no superscript minus, so the
 * Unicode ⁻ would come from another font): smaller and raised, without making the line taller.
 */
.yh-number-exp {
  font-size: smaller;
  line-height: 0;
  vertical-align: super;
}

/* The menu is open: the field is in use, as a Select trigger is (the focus is in the list). */
.yh-input-group.yh-number[data-open] {
  --yh-frame-edge: var(--color-focus);
  --yh-frame-width: 2px;
}

.yh-input-group.yh-number[data-invalid][data-open] {
  --yh-frame-edge: var(--color-danger);
}

/*
 * The unit button fills the end of the group, its full height (44px on touch). It is a part of the field: no fill of its
 * own (one box), the pointer and the open menu show in the chevron. A transparent 1px border on the top, end and bottom
 * keeps the divider (::before) between the group's edge lines. 12px on both sides: the chevron sits 13px from the outer edge, where every drop-down's
 * chevron sits. The corners are the group's.
 */
.yh-number-unit {
  position: relative;
  display: inline-flex;
  align-self: stretch;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-left: 0;
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  line-height: var(--line-control);
  white-space: nowrap;
  cursor: pointer;
}

.yh-number-unit::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--color-control-border);
}

.yh-number-unit:is(:hover, [data-state='open']) .yh-select-icon {
  color: var(--color-text);
}

.yh-number-unit:disabled {
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

/* Every unit of the menu in one cell and only the current one visible: the button is as wide as the longest unit, so the number does not move when the unit changes. */
.yh-number-unit-text {
  display: grid;
}

.yh-number-unit-text > * {
  grid-area: 1 / 1;
}

.yh-number-unit-text > :not([data-current]) {
  visibility: hidden;
}

/* The list hangs from the unit button, aligned to the field's end, wide enough for the unit and its converted value. */
.yh-number-menu:not([data-sheet]) {
  min-width: max(var(--radix-select-trigger-width, 0px), 12rem);
}

/* Read-only: the value as text, not a greyed box (form patterns 4.4.9). */
.yh-number-text {
  display: block;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: var(--line-base);
}

/* ------------------------------------------------------------ file dropzone */

.yh-dropzone-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* The circle with the plus, then the text 12px below it; the prompt and the hint are 4px apart inside the text. */
.yh-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--color-control-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}

.yh-dropzone:hover,
.yh-dropzone[data-dragging] {
  border-color: var(--color-brand);
  background: var(--color-brand-subtle);
}

.yh-dropzone:focus-within {
  border-color: var(--color-focus);
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.yh-dropzone[data-disabled] {
  background: var(--color-surface-subtle);
  cursor: not-allowed;
}

/* The plus sits in a 40px brand-tinted circle: the zone reads as a target before its text is read. */
.yh-dropzone-icon {
  --yh-icon: 1.25rem;
  box-sizing: content-box;
  width: var(--yh-icon);
  height: var(--yh-icon);
  padding: calc((var(--launcher-icon) - var(--yh-icon)) / 2);
  border-radius: var(--radius-full);
  background: var(--color-brand-subtle);
  color: var(--color-brand);
}

.yh-dropzone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.yh-dropzone-prompt {
  font-weight: var(--weight-medium);
}

.yh-dropzone-hint {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.yh-dropzone-rejected {
  padding: var(--space-3);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--control-radius);
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

.yh-dropzone-rejected p {
  margin: 0;
}

.yh-dropzone-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-dropzone-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--control-radius);
  background: var(--color-surface);
}

.yh-dropzone-item[data-status='error'] {
  border-color: var(--color-danger-border);
}

.yh-dropzone-file {
  flex: none;
  color: var(--color-text-muted);
}

.yh-dropzone-name {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.yh-dropzone-item[data-status='error'] .yh-option-secondary {
  color: var(--color-danger);
}

.yh-progress {
  width: 100%;
  height: var(--space-1);
  border: 0;
  border-radius: var(--radius-full);
  appearance: none;
  background: var(--color-surface-subtle);
  accent-color: var(--color-brand);
}

.yh-progress::-webkit-progress-bar {
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
}

.yh-progress::-webkit-progress-value {
  border-radius: var(--radius-full);
  background: var(--color-brand);
}

.yh-progress::-moz-progress-bar {
  border-radius: var(--radius-full);
  background: var(--color-brand);
}

/* ------------------------------------------------------------ stepper */

/*
 * Geometry, written once: a 28px marker; the label line is as high as the marker, so the marker sits level with the
 * label whether or not a description follows; the connector is 2px thick in every state (colour alone tells done from
 * not yet) and runs at the marker's centre line from one marker to the next, with the same 12px gap at both ends.
 * Vertical: one continuous line per step, from under its marker to just above the next marker.
 */
.yh-stepper {
  --yh-step-marker: 1.75rem;
  --yh-step-line: 2px;
  --yh-step-gap: var(--space-3);
  /* The summary line of a narrow screen sits 8px under the steps. */
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Horizontal: the connector is the last part of a step; the step and the list put the same gap at both of its ends. */
.yh-stepper:not([data-orientation='vertical']) .yh-stepper-list {
  gap: var(--yh-step-gap);
}

.yh-stepper:not([data-orientation='vertical']) .yh-step {
  gap: var(--yh-step-gap);
}

.yh-stepper-list {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yh-step {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: flex-start;
  min-width: 0;
}

.yh-step-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  text-align: left;
}

/* A step that goes back is a button: at least as high as a control (44px on touch); the marker stays on the top line. */
button.yh-step-body {
  min-height: var(--yh-control);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

button.yh-step-body:hover .yh-step-label {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.yh-step-body:active .yh-step-marker {
  transform: scale(var(--motion-press-scale));
}

.yh-datetime-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}
.yh-datetime-actions > .yh-select-trigger { flex: 1; min-width: 0; }

.yh-step-marker {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--yh-step-marker);
  height: var(--yh-step-marker);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-instant) var(--ease-out);
}

/* The glyph of a done or failed step: 14px with a 2px stroke, the weight of the digits beside it. */
.yh-step-marker .yh-line-icon {
  width: 0.875rem;
  height: 0.875rem;
  stroke-width: 2;
}

.yh-step-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* As high as the marker: the label's line is the marker's centre line. */
.yh-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: var(--yh-step-marker);
}

/* 13 / 20 under the 28px label line, pulled up 4px: label and description read as one block (28 - 4 + 20 = 44px, whole pixels). */
.yh-step-description {
  margin-top: calc(var(--space-1) * -1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  line-height: var(--line-sm);
}

/* The connector to the next step: on the marker's centre line, the same gap at both ends. */
.yh-step:not(:last-child)::after {
  content: '';
  flex: 1 1 1rem;
  align-self: flex-start;
  min-width: var(--space-4);
  height: var(--yh-step-line);
  /* On the marker's centre line: moved down, not spaced (the step's gap sets the ends). */
  translate: 0 calc((var(--yh-step-marker) - var(--yh-step-line)) / 2);
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: background-color var(--duration-base) var(--ease-out);
}

.yh-step[data-status='complete']::after {
  background: var(--color-brand);
}

/* Done: the brand on its subtle fill, a check. Failed: the same construction in red, a cross. */
.yh-step[data-status='complete'] .yh-step-marker {
  border-color: transparent;
  background: var(--color-brand-subtle);
  color: var(--color-brand);
}

.yh-step[data-status='error'] .yh-step-marker {
  border-color: transparent;
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

.yh-step[data-status='error'] .yh-step-label {
  color: var(--color-danger);
}

/* Current: the one solid marker, with the focus halo around it, and the label in the text colour at medium weight. */
.yh-step[data-status='current'] .yh-step-marker {
  border-color: var(--color-brand);
  background: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-focus-halo);
  color: var(--color-on-brand);
}

.yh-step[data-status='current'] .yh-step-label {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

.yh-stepper-summary {
  display: none;
  margin: 0;
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

/* Vertical: steps one under the other, 16px apart; one unbroken line from below a marker to above the next one. */
.yh-stepper[data-orientation='vertical'] .yh-stepper-list {
  flex-direction: column;
}

.yh-stepper[data-orientation='vertical'] .yh-step {
  flex: none;
  padding-bottom: var(--space-4);
}

.yh-stepper[data-orientation='vertical'] .yh-step:last-child {
  padding-bottom: 0;
}

.yh-stepper[data-orientation='vertical'] .yh-step:not(:last-child)::after {
  position: absolute;
  top: calc(var(--yh-step-marker) + var(--space-1));
  left: calc((var(--yh-step-marker) - var(--yh-step-line)) / 2);
  width: var(--yh-step-line);
  min-width: 0;
  height: calc(100% - var(--yh-step-marker) - 2 * var(--space-1));
  translate: none;
}

/* A phone: markers only, with the current step named below. */
@media (max-width: 40rem) {
  .yh-stepper[data-orientation='horizontal'] .yh-step-text {
    display: none;
  }

  .yh-stepper[data-orientation='horizontal'] .yh-stepper-summary {
    display: block;
  }

  .yh-stepper[data-orientation='horizontal'] {
    --yh-step-gap: var(--space-2);
  }

  .yh-stepper[data-orientation='horizontal'] .yh-step:not(:last-child)::after {
    min-width: var(--space-2);
  }

  .yh-stepper[data-orientation='horizontal'] .yh-step {
    flex: 1 1 auto;
  }

  .yh-stepper[data-orientation='horizontal'] .yh-step:last-child {
    flex: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yh-combobox,
  .yh-dropzone {
    transition: none;
  }
}

/* Avatar edits are local; the parent owns spacing to adjacent fields. */
.yh-avatar-picker,
.yh-avatar-crop {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  min-width: 0;
}
.yh-avatar-picker-row,
.yh-avatar-picker-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--gap-inline);
}
.yh-avatar-picker-actions { align-items: end; }
.yh-avatar-picker-preview {
  display: grid;
  flex: none;
  width: 4rem;
  height: 4rem;
}
.yh-avatar-picker-preview > canvas,
.yh-avatar-picker-preview .yh-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.yh-avatar-crop > canvas {
  display: block;
  width: min(100%, 18rem);
  height: auto;
  aspect-ratio: 1;
  align-self: center;
  border-radius: 50%;
  background: var(--color-surface);
  touch-action: none;
  cursor: grab;
}
.yh-avatar-crop > canvas:active { cursor: grabbing; }
.yh-avatar-crop > canvas:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
}

/*
 * @catalytic/app-kit design system, part 7: the bulk-import page (ImportPage). Tokens only.
 */

/* The steps, the card of the stage and its actions are blocks of the page: 24px apart. */
.yh-import {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
}

.yh-import-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--color-text-secondary);
}

.yh-import-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.yh-import-actions > :first-child:not(:only-child) {
  margin-inline-end: auto;
}

.yh-import-cell {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.yh-import-cell[data-invalid] > :first-child {
  color: var(--color-danger);
  font-weight: var(--weight-medium);
}

.yh-import-cell[data-warning] > :first-child {
  color: var(--color-warning);
}

.yh-import-issue {
  color: var(--color-danger);
  font-size: var(--text-sm);
}

.yh-import-cell[data-warning] .yh-import-issue {
  color: var(--color-warning);
}

.yh-import-row-issues {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  color: var(--color-danger);
  font-size: var(--text-sm);
  list-style: none;
}

.yh-import-row-issues > [data-level='warning'] {
  color: var(--color-warning);
}

/*
 * Part 9: navigation. Keycaps, the command palette (Ctrl/⌘+K) and its header button, the `?` sheet of shortcuts.
 * Before materials.css: the palette is a floating layer and takes the glass from there.
 * Spec: docs/design-system-css.md, "命令面板与快捷键".
 */

/* ------------------------------------------------------------ keycaps */

/*
 * A shortcut is a row of keycaps 4px apart: 20px high (at least as wide), 12px text in the secondary colour, a light
 * fill and a hairline, 4px corners. One look everywhere: the palette, its footer and button, the ? sheet, hover tips.
 */
.yh-keys {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-1);
  font: inherit;
  vertical-align: middle;
}

.yh-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: var(--space-5);
  height: var(--space-5);
  padding: 0 var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  line-height: var(--line-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A hover tip with a shortcut: the text, then the keycaps 8px after it, on one centre line. */
.yh-tooltip[data-keys]:not([hidden]) {
  display: flex;
  align-items: center;
  gap: var(--gap-inline);
}

/* ------------------------------------------------------------ the header button */

/*
 * On a wide screen a search field you can press: the search icon, the palette's name in the secondary colour and the
 * shortcut at the right end, on the light fill of the controls on glass, control height and corners. From 800px down
 * it is an icon button (the name and the keys are in its hover tip and its accessible name).
 */
.yh-palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 13rem;
  height: var(--yh-control);
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 0;
  border-radius: var(--control-radius);
  background: var(--color-fill-hover);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-base);
  line-height: var(--line-control);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.yh-palette-trigger:hover,
.yh-palette-trigger[aria-expanded='true'] {
  background: var(--color-fill-pressed);
}

.yh-palette-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .yh-palette-trigger {
    justify-content: center;
    width: var(--yh-control);
    padding: 0;
    background: transparent;
    color: var(--color-text);
  }

  .yh-palette-trigger:hover,
  .yh-palette-trigger[aria-expanded='true'] {
    background: var(--color-fill-hover);
  }

  .yh-palette-trigger-label,
  .yh-palette-trigger-keys {
    display: none;
  }
}

/* ------------------------------------------------------------ the palette */

/*
 * A glass layer 40px under the header, 640px wide (the screen less 16px a side when narrower), at most 512px high,
 * with the popup's corners and padding (concentric rows). It grows from the top on the snappy spring and leaves in
 * 160ms; the field has the focus from the first frame, so typing never waits for the motion.
 */
.yh-palette {
  --yh-radius: var(--popup-radius);
  --yh-pad: var(--popup-padding);
  --yh-inner-radius: max(var(--concentric-min), calc(var(--yh-radius) - var(--yh-pad)));
  --yh-palette-width: min(40rem, calc(100% - 2 * var(--space-4)));
  --yh-palette-header-bottom: var(--header-height);
  --yh-palette-top: calc(var(--yh-palette-header-bottom) + var(--space-10));
  position: fixed;
  z-index: calc(var(--z-overlay) + 1);
  top: var(--yh-palette-top);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: var(--yh-palette-width);
  max-height: min(32rem, calc(100dvh - 2 * var(--yh-palette-top)));
  margin-inline: auto;
  overflow: hidden;
  border-radius: var(--yh-radius);
  transform-origin: top center;
  outline: none;
}

/* Whole pixels: centred by a rounded left edge, so an odd window width does not put the text on half a pixel. */
@supports (left: round(down, 1.5px, 1px)) {
  .yh-palette:not([data-sheet]) {
    right: auto;
    left: round(down, calc((100% - var(--yh-palette-width)) / 2), 1px);
    margin-inline: 0;
  }
}

.yh-palette[data-state='open'] {
  --yh-from-x: 0;
  --yh-from-y: calc(var(--motion-shift) / -2);
  animation:
    yh-pop-scale var(--duration-spring-snappy) var(--ease-spring-snappy),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-palette[data-state='closed'] {
  --yh-from-x: 0;
  --yh-from-y: 0;
  animation: yh-pop-out var(--duration-fast) var(--ease-in) forwards;
  pointer-events: none !important;
}

/* The field: 48px, the 16px text of a search field, 12px from the icon, a hairline under it. */
.yh-palette-field {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.yh-palette-field-icon {
  display: inline-flex;
  flex: none;
  color: var(--color-text-secondary);
}

.yh-palette-input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-md);
  line-height: var(--line-md);
}

/* The palette is where the keyboard is: the caret shows it, a ring around the field would frame the frame. */
.yh-palette .yh-palette-input:focus-visible {
  outline: none;
}

.yh-palette-input::placeholder {
  color: var(--color-text-muted);
}

.yh-palette-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 0;
  padding: var(--yh-pad);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: var(--yh-pad);
}

.yh-palette-group {
  display: flex;
  flex-direction: column;
}

/* Group headings are the sidebar's: 12px, semibold, muted, in line with the row text. */
.yh-palette-heading {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--line-xs);
}

/*
 * Rows of a popup list (docs "弹层列表的行"): 36px (44px on touch and on the sheet), icon column 16px always kept,
 * the label, the detail and the keys at the right. The active row (keyboard or pointer) is the fill of the menus.
 */
.yh-palette-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  min-height: var(--yh-control);
  padding: 0 var(--space-3);
  border-radius: var(--yh-inner-radius);
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  outline: none;
}

.yh-palette-item[data-active] {
  background: var(--color-fill-hover);
}

.yh-palette-item:active {
  background: var(--color-fill-pressed);
}

.yh-palette-icon {
  display: inline-flex;
  flex: none;
  width: var(--icon-size);
  color: var(--color-text-secondary);
}

.yh-palette-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yh-palette-detail {
  flex: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yh-palette-empty {
  margin: 0;
  padding: var(--space-6) var(--space-3);
  color: var(--color-text-secondary);
  text-align: center;
}

/* A source's mode (the answer of "问 莱娅") takes the list's place and scrolls on its own. */
.yh-palette-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--space-4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The keys that work now, along the bottom: 12px secondary, a hairline above. Not on touch screens. */
.yh-palette-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  line-height: var(--line-sm);
}

.yh-palette-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

@media (pointer: coarse) {
  .yh-palette-foot,
  .yh-palette-esc {
    display: none;
  }
}

/*
 * On a phone the palette is a sheet like the Select's: 8px from the screen edges, the dialog's corners, a grabber,
 * rows 44px. It sits on the on-screen keyboard (`--yh-keyboard`, measured from the visual viewport) instead of behind
 * it, rises on the smooth spring and leaves downward. The field keeps its 16px text, so the phone does not zoom.
 */
.yh-palette[data-sheet] {
  --yh-radius: var(--dialog-radius);
  --yh-sheet-shift: calc(100% * var(--motion-travel));
  top: auto;
  right: max(var(--space-2), env(safe-area-inset-right));
  bottom: calc(max(var(--space-2), env(safe-area-inset-bottom)) + var(--yh-keyboard, 0px));
  left: max(var(--space-2), env(safe-area-inset-left));
  width: auto;
  max-height: calc(100dvh - 2 * var(--space-2) - var(--yh-keyboard, 0px));
  margin: 0;
  transition: translate var(--duration-fast) var(--ease-out);
}

.yh-palette[data-sheet][data-state='open'] {
  animation:
    yh-sheet-rise var(--duration-spring-smooth) var(--ease-spring-smooth),
    yh-fade-in var(--duration-fast) var(--ease-out);
}

.yh-palette[data-sheet][data-state='closed'] {
  animation: yh-sheet-leave var(--duration-base) var(--ease-in) forwards;
}

.yh-palette[data-sheet] .yh-palette-field {
  padding-top: 0;
}

.yh-palette[data-sheet] .yh-palette-item {
  min-height: var(--hit-target);
}

.yh-palette[data-sheet] .yh-palette-foot {
  display: none;
}

/* ------------------------------------------------------------ the ? sheet */

/* Groups 16px apart; a group's heading 4px above its rows; rows 36px, the label left and the keys right. */
.yh-shortcut-sheet {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
}

.yh-shortcut-sheet:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

.yh-shortcut-group {
  display: flex;
  flex-direction: column;
  gap: var(--gap-label);
}

.yh-shortcut-heading {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--line-xs);
}

.yh-shortcut-list {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.yh-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--yh-control);
}

.yh-shortcut-row dt {
  min-width: 0;
}

.yh-shortcut-row dd {
  flex: none;
  margin: 0;
}

.yh-shortcut-settings { display: flex; flex-direction: column; gap: var(--gap-section); }
.yh-command-settings-list { list-style: none; padding: 0; margin: 0; }
.yh-command-settings-row { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 2fr) auto; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.yh-command-settings-name { display: flex; flex-direction: column; min-width: 0; gap: var(--gap-label); }
.yh-command-context, .yh-command-default { color: var(--color-text-muted); font-size: var(--text-xs); }
.yh-command-default { display: flex; align-items: center; flex-wrap: wrap; grid-column: 1 / -1; gap: var(--space-2); margin: 0; }
.yh-command-settings-bindings, .yh-command-settings-actions, .yh-command-key { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.yh-command-key { flex-wrap: nowrap; }
.yh-command-error { grid-column: 1 / -1; margin: 0; color: var(--color-danger); }
@media (max-width: 640px) {
  .yh-command-settings-row { grid-template-columns: minmax(0, 1fr); }
  .yh-command-settings-actions { justify-content: flex-start; }
}

/*
 * @catalytic/app-kit design system, part 8: materials. Liquid Glass for the navigation and control layer, concentric
 * corners, and the fallbacks. Last in styles.css on purpose: the glass wins over the solid backgrounds of every part
 * before it, and the fallbacks at the end win over the glass.
 *
 * Two layers (Apple, WWDC25 "Meet Liquid Glass"):
 *   content  - cards, tables, forms, text: solid surfaces, so they read clearly. Nothing here touches them.
 *   controls - bars, the sidebar and everything that floats over the content: glass.
 *
 * Glass on the web, approximated without refraction (only Chromium could bend light, so nobody does): a translucent
 * tint over a blurred and saturated backdrop, a 1px hairline around it, a 1px inner light along the top edge and a 1px
 * inner shade along the bottom edge, and a soft shadow. The tints are opaque enough that text keeps 4.5:1 over any
 * content (tokens/test checks it against pure black and pure white), so the blur adds depth, never doubt.
 *
 * At most four layers blur their backdrop at once (each costs a pass of the compositor):
 *   1 the header, which the page scrolls under;
 *   2 one floating layer: a menu, a popover, a select or combobox list, a date panel, a tooltip, the bulk-action bar
 *     or a dialog's scrim (the command palette is the layer over its own scrim: scrim and palette are 2 and 3);
 *   3 a layer opened from that one (a menu of the bulk-action bar, a list inside a dialog);
 *   4 the toasts.
 * The desktop sidebar is glass without a blur (there is only the page canvas behind it), dialogs and drawers are glass
 * without a blur of their own (their scrim has already blurred the page), and the chart tooltip is solid glass.
 */

/* ------------------------------------------------------------ concentric corners */

/*
 * A container says how round it is and how far its rows sit from its edge; the rows take the difference, so their
 * corners run parallel to the container's (Apple: "concentric shapes calculate their radius by subtracting padding from
 * the parent's"). The token pairs are chosen so the result is the control radius (tokens/test), and it never drops below
 * --concentric-min. The variable is computed on the container itself, where its two inputs are known.
 */
.yh-menu,
.yh-select-content,
.yh-combobox-popup,
.yh-launcher-panel {
  --yh-radius: var(--popup-radius);
  --yh-pad: var(--popup-padding);
  --yh-inner-radius: max(var(--concentric-min), calc(var(--yh-radius) - var(--yh-pad)));
  padding: var(--yh-pad);
  border-radius: var(--yh-radius);
}

.yh-sidebar {
  --yh-radius: var(--sidebar-radius);
  --yh-pad: var(--sidebar-padding);
  --yh-inner-radius: max(var(--concentric-min), calc(var(--yh-radius) - var(--yh-pad)));
}

.yh-toast {
  --yh-radius: var(--popup-radius);
  --yh-pad: var(--space-2);
  --yh-inner-radius: max(var(--concentric-min), calc(var(--yh-radius) - var(--yh-pad)));
}

.yh-bulk-bar,
.yh-form-bar {
  --yh-radius: var(--bar-radius);
  --yh-pad: var(--popup-padding);
  --yh-inner-radius: var(--bar-radius);
}

/* The Radix select list scrolls inside its viewport: the viewport takes the padding, the list keeps none. */
.yh-select-content {
  padding: 0;
}

.yh-select-viewport {
  padding: var(--yh-pad);
}

.yh-menu-item,
.yh-select-item,
.yh-combobox-option,
.yh-tree-item,
.yh-launcher-item,
.yh-sidebar .yh-nav-item,
.yh-toast-close,
.yh-toast-action {
  border-radius: var(--yh-inner-radius);
}

/* ------------------------------------------------------------ glass */

/*
 * The header's glass is drawn by a layer behind its content (::before), not by the header itself: an element with a
 * backdrop-filter becomes the backdrop root of everything inside it, so the launcher panel and the ./dom menus that hang
 * from the header would blur only the header's own pixels and let the page show through sharply. With the glass on a
 * pseudo-element, those panels blur the page as every other floating layer does.
 */
.yh-header {
  background: transparent;
}

.yh-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color-chrome-glass);
  -webkit-backdrop-filter: blur(var(--blur-chrome)) saturate(var(--material-saturate));
  backdrop-filter: blur(var(--blur-chrome)) saturate(var(--material-saturate));
  pointer-events: none;
}

/* Floating layers: the popup tint, the strong blur, the hairline, the light and shade of the edge, the soft shadow. */
.yh-menu,
.yh-popover,
.yh-select-content,
.yh-combobox-popup,
.yh-calendar-popup,
.yh-launcher-panel,
.yh-palette,
.yh-toast,
.yh-tooltip,
.yh-bulk-bar,
.yh-form-bar {
  border: 1px solid var(--color-glass-edge);
  background: var(--color-popup-glass);
  box-shadow:
    inset 0 1px 0 var(--color-glass-highlight),
    inset 0 -1px 0 var(--color-glass-shade),
    var(--shadow-glass);
  -webkit-backdrop-filter: blur(var(--blur-popup)) saturate(var(--material-saturate));
  backdrop-filter: blur(var(--blur-popup)) saturate(var(--material-saturate));
}

/* A tooltip is a small glass label in the text colour (it was an inverted black chip). */
.yh-tooltip {
  color: var(--color-text);
}

/* The bulk-action bar floats over the rows it acts on: a deeper shadow lifts it above them. */
.yh-bulk-bar,
.yh-form-bar {
  box-shadow:
    inset 0 1px 0 var(--color-glass-highlight),
    inset 0 -1px 0 var(--color-glass-shade),
    var(--shadow-float);
}

/*
 * The chart tooltip: the glass edge and highlight on an opaque surface. It moves with the pointer, so a blur would have
 * to follow it every frame, and without one the bars and labels behind it showed through its text.
 */
.yh-chart-tooltip {
  border-color: var(--color-glass-edge);
  background: var(--color-surface);
  box-shadow:
    inset 0 1px 0 var(--color-glass-highlight),
    var(--shadow-glass);
}

/*
 * Dialogs and drawers: glass over the scrim, which has already blurred the page; no second blur. They carry forms and
 * decisions, so their tint is the surface itself at 96%: over the dimmed page the popup tint would turn grey, this one
 * stays white (and dark in the dark theme) with only a breath of the page in it.
 */
.yh-dialog,
.yh-drawer {
  border: 1px solid var(--color-glass-edge);
  background: var(--color-surface);
  background: color-mix(in srgb, var(--color-surface) 96%, transparent);
  box-shadow:
    inset 0 1px 0 var(--color-glass-highlight),
    inset 0 -1px 0 var(--color-glass-shade),
    var(--shadow-dialog);
}

/* The bars of a drawer are part of its glass: no fill of their own. */
.yh-drawer-footer {
  background: transparent;
}

/* The scrims dim the page and soften it: the blur grows in with the scrim (overlay.css animates it). */
.yh-dialog-overlay,
.yh-sidebar-backdrop[data-open='true'],
dialog.yh-dialog::backdrop {
  -webkit-backdrop-filter: blur(var(--blur-overlay));
  backdrop-filter: blur(var(--blur-overlay));
}

/* The fade at the bottom of the launcher's scroll area fades into the glass, not into white. */
.yh-launcher-panel::after {
  background: linear-gradient(to bottom, transparent, var(--color-popup-glass));
}

/*
 * The desktop sidebar floats over the page canvas (layout.css places it): the glass tint, the hairline, the light along
 * its top edge and a soft shadow. Nothing moves behind it, so it does not blur; as a drawer on a phone it does (below).
 */
.yh-sidebar {
  border: 1px solid var(--color-glass-edge);
  background: var(--color-popup-glass);
  box-shadow:
    inset 0 1px 0 var(--color-glass-highlight),
    var(--shadow-card);
}

@media (max-width: 800px) {
  .yh-sidebar {
    box-shadow:
      inset 0 1px 0 var(--color-glass-highlight),
      var(--shadow-float);
    -webkit-backdrop-filter: blur(var(--blur-popup)) saturate(var(--material-saturate));
    backdrop-filter: blur(var(--blur-popup)) saturate(var(--material-saturate));
  }
}

/*
 * On glass, a hover or a selection is a fill that lets the glass through, not a white or grey block: the selected
 * segment and the menu row of the open page keep their own colours.
 */
:is(.yh-menu, .yh-popover, .yh-combobox-popup, .yh-calendar-popup, .yh-select-content, .yh-bulk-bar, .yh-form-bar) .yh-button:not([data-variant]) {
  --yh-button-fill: var(--color-fill-hover);
  --yh-button-edge: transparent;
  --yh-button-shadow: none;
}

:is(.yh-menu, .yh-popover, .yh-combobox-popup, .yh-calendar-popup, .yh-select-content, .yh-bulk-bar, .yh-form-bar) .yh-button:not([data-variant]):hover {
  --yh-button-fill: var(--color-fill-pressed);
}

/* ------------------------------------------------------------ fallbacks */

/*
 * No backdrop-filter (an old browser): the same layers, solid. The bars take the chrome colour, every floating layer the
 * surface, and the scrims the darker solid backdrop. Edges and shadows stay, so the layers still read as lifted.
 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .yh-header::before {
    background: var(--color-chrome);
  }

  .yh-menu,
  .yh-popover,
  .yh-select-content,
  .yh-combobox-popup,
  .yh-calendar-popup,
  .yh-launcher-panel,
  .yh-palette,
  .yh-toast,
  .yh-tooltip,
  .yh-bulk-bar,
  .yh-form-bar,
  .yh-chart-tooltip,
  .yh-dialog,
  .yh-drawer,
  .yh-sidebar {
    background: var(--color-surface);
  }

  .yh-launcher-panel::after {
    background: linear-gradient(to bottom, transparent, var(--color-surface));
  }

  .yh-dialog-overlay,
  .yh-sidebar-backdrop[data-open='true'],
  dialog.yh-dialog::backdrop {
    background: var(--color-backdrop-solid);
  }
}

/* Reduced transparency (the system setting): solid everywhere, no blur. */
@media (prefers-reduced-transparency: reduce) {
  .yh-header::before {
    background: var(--color-chrome);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .yh-menu,
  .yh-popover,
  .yh-select-content,
  .yh-combobox-popup,
  .yh-calendar-popup,
  .yh-launcher-panel,
  .yh-palette,
  .yh-toast,
  .yh-tooltip,
  .yh-bulk-bar,
  .yh-form-bar,
  .yh-chart-tooltip,
  .yh-dialog,
  .yh-drawer,
  .yh-sidebar {
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .yh-launcher-panel::after {
    background: linear-gradient(to bottom, transparent, var(--color-surface));
  }

  .yh-dialog-overlay,
  .yh-sidebar-backdrop[data-open='true'],
  dialog.yh-dialog::backdrop {
    background: var(--color-backdrop-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .yh-header::after {
    display: none;
  }
}

/*
 * More contrast (the system setting): every hairline is the control border (3:1), glass is solid, the header gets its
 * line back. The variables are set three classes deep so they win over dark.css and dark-auto.css whatever the order.
 */
@media (prefers-contrast: more) {
  :root:root:root,
  :root:root:root[data-theme] {
    --color-border: var(--color-control-border);
    --color-glass-edge: var(--color-control-border);
    --color-chrome-glass: var(--color-chrome);
    --color-popup-glass: var(--color-surface);
  }

  .yh-header {
    border-bottom: 1px solid var(--color-control-border);
  }

  .yh-header::after {
    display: none;
  }
}
