/* Waffle themes. Dark is the :root block in style.css; these blocks override its
   tokens per data-theme on <html> (set by theme.js before first paint). Token
   values here match AtriumTheme.PRESETS; tests/theme.cjs checks they agree.
   Load after every other stylesheet. */
/* Light */
:root[data-theme=light] {color-scheme:light;
  --app:#e6e6e6;--chrome:#efefef;--panel:#f8f8f8;--panel-head:#ececec;--raised:#dadada;--hover:#e8e8e8;--field:#ffffff;
  --ink:#1f1f1f;--muted:#505050;--faint:#606060;--line:#d6d6d6;--line-strong:#b5b5b5;--soft:#eeeeee;--accent:#1559a7;
  --accent-text:var(--accent);--accent-strong:var(--accent);
  --selection:#cce0f7;--selection-ink:#0b0b0b;--focus:#0a6ed1;--primary:#0f6cbd;--divider:#d9d9d9;--menu-bg:#ffffff;--tab-bg:#dddddd;
  --tab-hover:#d3d3d3;--canvas-bg:#1e1e1e;--bar-bg:#fafafaf5;--bar-line:#c4c4c4;--pressed:#d8dde4;--layer-on:#ffffff;--ls-bg:#e2e2e2;
  --ls-ink:#b3261e;--button:#f3f3f3;--button-line:#797979;--button-hover:#e4e4e4;--input-line:#787878;--rule:#dcdcdc;--primary-line:#0d5ea6;
  --sheet:#fffcf8;--ink-bright:#000000;--ink-strong:#111111;--head-ink:#1a1a1a;--tab-hover-ink:#1f1f1f;--coords-ink:#1f1f1f;--chrome-ink:#2b2b2b;
  --tool-ink:#333333;--soft-ink:#3b3b3b;--icon-ink:#424242;--dim-ink:#454545;--caption-ink:#4a4a4a;--tab-ink:#4d4d4d;--split-ink:#555555;
  --on-accent:#ffffff;--on-accent-2:#ffffff;--on-primary:#ffffff;--accent-btn-ink:#ffffff;--icon-folder:#4e6074;--icon-sch:#2f5f99;--icon-pcb:#2e8540;
  --error-ink:#b42318;--diff-changed:#1f5fa8;--diff-added:#1a7f37;--diff-removed:#b0461d;--ok-ink:#17772f;--ok-line:#8cc79a;--warn-line:#d9a75a;
  --bad-ink:#b0461d;--bad-line:#e2a58a;--err-mark:#c4281c;--warn-mark:#b07a12;--ok-mark:#2e8540;--warn-ink:#8a5a00;--sel-sub-ink:#2b3a4d;
  --badge-line:#0b0b0b66;--conflict-line:#b8731d;--km-warn:#9a5b00;--shadow-sm:#00000024;--shadow-md:#00000030;--shadow-lg:#00000040;--backdrop:#00000040;
  --shadow-drawer:#00000030;--swatch-edge:#00000059;--preview-edge:#00000033;--shadow-side:#00000022;--shadow-vc:#0000002e;--swatch-line:#0000004d;--danger:#c4281c;
  --warning:#8a5a00;--info:#0b62b0;--danger-fill:#c4281c;--on-danger:#ffffff;--insight:#6a4fd8;--insight-ink:#5a3fc4;}
:root[data-theme=light] :is(.msg-panel,.erc-options) {--msg-fatal:#b3261e;--msg-error:#c4281c;--erc-none:#d3ead3;--erc-warning:#f6e2b3;--erc-error:#f6d0ba;--erc-fatal:#f4c4c4}
/* High Contrast Dark */
:root[data-theme=hc] {color-scheme:dark;
  --app:#000000;--chrome:#000000;--panel:#000000;--panel-head:#121212;--raised:#2a2a2a;--hover:#1e1e1e;--field:#000000;
  --ink:#ffffff;--muted:#dedede;--faint:#bcbcbc;--line:#8a8a8a;--line-strong:#6fc3df;--soft:#161616;--accent:#85bfff;
  --accent-text:var(--accent);--accent-strong:#6591c2;
  --selection:#0f4c81;--selection-ink:#ffffff;--focus:#85bfff;--primary:#0e5fa8;--divider:#6fc3df;--menu-bg:#000000;--tab-bg:#000000;
  --tab-hover:#1e1e1e;--canvas-bg:#000000;--bar-bg:#000000f5;--bar-line:#6fc3df;--pressed:#2a2a2a;--layer-on:#2a2a2a;--ls-bg:#000000;
  --ls-ink:#ff7b70;--button:#000000;--button-line:#6fc3df;--button-hover:#1e1e1e;--input-line:#8a8a8a;--rule:#6f6f6f;--primary-line:#6fc3df;
  --sheet:#ffffff;--ink-bright:#ffffff;--ink-strong:#ffffff;--head-ink:#ffffff;--tab-hover-ink:#ffffff;--coords-ink:#ffffff;--chrome-ink:#ffffff;
  --tool-ink:#ffffff;--soft-ink:#f2f2f2;--icon-ink:#ffffff;--dim-ink:#ebebeb;--caption-ink:#ebebeb;--tab-ink:#ebebeb;--split-ink:#ebebeb;
  --on-accent:#000000;--on-accent-2:#000000;--on-primary:#ffffff;--accent-btn-ink:#000000;--icon-folder:#c0d0e0;--icon-sch:#a9cfff;--icon-pcb:#7ee787;
  --error-ink:#ff9e8f;--diff-changed:#9ecbff;--diff-added:#7ee787;--diff-removed:#ffab91;--ok-ink:#7ee787;--ok-line:#7ee787;--warn-line:#ffb340;
  --bad-ink:#ffab91;--bad-line:#ffab91;--err-mark:#ff7b70;--warn-mark:#ffcc4d;--ok-mark:#7ee787;--warn-ink:#ffd75e;--sel-sub-ink:#e6eefc;
  --badge-line:#ffffff99;--conflict-line:#ffb340;--km-warn:#ffcc4d;--shadow-sm:#000000cc;--shadow-md:#000000cc;--shadow-lg:#000000cc;--backdrop:#000000b3;
  --shadow-drawer:#000000cc;--swatch-edge:#ffffff80;--preview-edge:#ffffff80;--shadow-side:#000000cc;--shadow-vc:#000000cc;--swatch-line:#ffffff99;--danger:#ff6b5e;
  --warning:#ffb340;--info:#75beff;--danger-fill:#b3261e;--on-danger:#ffffff;--insight:#c8b6ff;--insight-ink:#d9ccff;}
:root[data-theme=hc] :is(.msg-panel,.erc-options) {--msg-fatal:#ff6b5e;--msg-error:#ff8a80;--erc-none:#1f4d1f;--erc-warning:#6b5210;--erc-error:#7a3a12;--erc-fatal:#7a1f1f}
/* Classic Grey */
:root[data-theme=classic] {color-scheme:light;
  --app:#c8c8c8;--chrome:#dadada;--panel:#e9e9e9;--panel-head:#c5cbd3;--raised:#c3c9d1;--hover:#d8dee6;--field:#ffffff;
  --ink:#000000;--muted:#363636;--faint:#4f4f4f;--line:#b2b2b2;--line-strong:#8c8c8c;--soft:#dddddd;--accent:#104f95;
  --accent-text:var(--accent);--accent-strong:var(--accent);
  --selection:#3c78b4;--selection-ink:#ffffff;--focus:#1f4f99;--primary:#2b5ea7;--divider:#a9a9a9;--menu-bg:#f2f2f2;--tab-bg:#cdcdcd;
  --tab-hover:#dcdcdc;--canvas-bg:#000000;--bar-bg:#ecececf2;--bar-line:#9a9a9a;--pressed:#c3c9d1;--layer-on:#f4f4f4;--ls-bg:#d0d0d0;
  --ls-ink:#9e1f17;--button:#e4e4e4;--button-line:#6b6b6b;--button-hover:#d6dce4;--input-line:#6a6a6a;--rule:#b4b4b4;--primary-line:#1f4f99;
  --sheet:#fffcf8;--ink-bright:#000000;--ink-strong:#000000;--head-ink:#111111;--tab-hover-ink:#111111;--coords-ink:#111111;--chrome-ink:#1a1a1a;
  --tool-ink:#222222;--soft-ink:#262626;--icon-ink:#2b2b2b;--dim-ink:#2e2e2e;--caption-ink:#333333;--tab-ink:#2e2e2e;--split-ink:#3a3a3a;
  --on-accent:#ffffff;--on-accent-2:#ffffff;--on-primary:#ffffff;--accent-btn-ink:#ffffff;--icon-folder:#475566;--icon-sch:#28558c;--icon-pcb:#1f7a33;
  --error-ink:#a1260d;--diff-changed:#1d4f91;--diff-added:#1a6b2f;--diff-removed:#a13d12;--ok-ink:#185e28;--ok-line:#6fae7f;--warn-line:#c48a2c;
  --bad-ink:#a13d12;--bad-line:#d08a6a;--err-mark:#b3261e;--warn-mark:#9a6a10;--ok-mark:#1f7a33;--warn-ink:#704900;--sel-sub-ink:#ffffff;
  --badge-line:#ffffff99;--conflict-line:#a8691a;--km-warn:#8a5200;--shadow-sm:#00000033;--shadow-md:#00000040;--shadow-lg:#00000052;--backdrop:#00000047;
  --shadow-drawer:#00000040;--swatch-edge:#00000066;--preview-edge:#00000040;--shadow-side:#00000030;--shadow-vc:#00000040;--swatch-line:#00000059;--danger:#b3261e;
  --warning:#7a4f00;--info:#1d4f91;--danger-fill:#b3261e;--on-danger:#ffffff;--insight:#5b3fc0;--insight-ink:#4b33a6;}
:root[data-theme=classic] :is(.msg-panel,.erc-options) {--msg-fatal:#a1160d;--msg-error:#b3261e;--erc-none:#cfe5cf;--erc-warning:#f0dca8;--erc-error:#f1c8b0;--erc-fatal:#efbcbc}

/* UI density: row and bar height offsets (default is 0px in style.css). */
:root[data-density=compact] {--density-row:-3px;--density-bar:-2px}
:root[data-density=comfortable] {--density-row:4px;--density-bar:4px}

/* UI font size: 11–14 px. Sizes scale from the 12 px design; rows grow with the text. */
:root[data-ui-font="11"] {--fs-scale:0.916667;--font-row:-1px;--font-bar:-1px}
:root[data-ui-font="13"] {--fs-scale:1.083333;--font-row:2px;--font-bar:2px}
:root[data-ui-font="14"] {--fs-scale:1.166667;--font-row:3px;--font-bar:3px}

/* Motion levels: style.css (data-motion full / reduce = fades only / off; absent follows the system). */

/* Menu radio items and the status-bar theme button (added by theme.js). */
.menu-items [role=menuitemradio][aria-checked=true]::before {content:"✓";position:absolute;left:7px;font-size:var(--fs-11);color:currentColor}

/* Preferences → Appearance. Builds on .work-dialog (workflows.css). */
.thp-head {flex:none;display:flex;align-items:center;height:calc(34px + var(--d-bar));padding:0 16px;background:var(--panel-head);border-bottom:1px solid var(--line)}
.thp-page {flex:1;min-width:0;overflow:auto;padding:4px 18px 12px}
.thp-group,.thp-card {display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin:0}
.thp-group ~ .thp-group {border-block-start:1px solid var(--line);margin-block-start:16px;padding-block-start:24px}
.thp-group > .thp-heading {margin:0;font-weight:600;font-size:var(--fs-13)}
.thp-check {display:flex;align-items:center;gap:8px;min-block-size:var(--ctl-h);font-size:var(--fs-12)}
.thp-check input {margin:0}
.thp-follow {display:grid;gap:8px}
.thp-follow[hidden] {display:none}
.thp-inline select {inline-size:100%}
.thp-swatches {display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.thp-swatch {position:relative;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;cursor:default}
.thp-chip {width:20px;height:20px;border-radius:50%;box-shadow:inset 0 0 0 1px var(--swatch-edge)}
.thp-chip-default {background:conic-gradient(var(--accent) 0 50%,var(--panel-head) 0)}
.thp-swatch:has(input:checked) {box-shadow:0 0 0 2px var(--ink)}
/* The swatch is the radio's face; the native circle stays in the accessibility tree only. */
.thp-swatch > input[type=radio] {position:absolute;inset:0;margin:0;opacity:0;cursor:default}
.thp-swatch:has(> input:focus-visible) {outline:var(--focus-w) solid var(--focus);outline-offset:var(--s-2)}
.work-dialog input.thp-custom {width:34px;height:var(--ctl-h-lg);padding:1px 2px;margin-left:6px;cursor:default}
.thp-custom.is-current {outline:2px solid var(--ink);outline-offset:1px}
.thp-derived {display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
.thp-sample {display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:var(--r-sm);font-size:var(--fs-11)}
.thp-field {display:grid;grid-template-columns:minmax(0,1fr) 240px;align-items:center;gap:4px 16px}
.thp-label {color:var(--muted);font-size:var(--fs-12)}
.thp-field .thp-hint {grid-column:2}
.work-dialog .thp-hint {color:var(--muted);font-size:var(--fs-11)}
.thp-segment {flex-wrap:wrap;justify-self:start}
.thp-color {display:flex;align-items:center;gap:6px}
.thp-status {margin:0;padding:4px 18px 0}
.thp-status.is-error {color:var(--error-ink)}
@media(max-width:620px) {.thp-field {grid-template-columns:1fr} .thp-field .thp-hint {grid-column:1}}
@media(pointer:coarse) {.thp-check {min-block-size:var(--ctl-h-touch)}}
/* A same-row caption is centred on its field by its cap height (ui/controls.css, docs/design-system.md › Field text alignment).
   Below 621 px a theme field stacks its caption above the control, where it keeps its line; in Preferences the
   window's own width decides (editor/prefs.css). */
@supports (text-box: trim-both cap alphabetic) {
  @media (min-width:621px) {:where(:is(.ui-dialog,.work-dialog,.lib-dialog,.lib-editor-surface,.message-dialog,.ui-popover) label.thp-field:not(.prf-appearance *) > span:first-child:not([aria-hidden=true],.icon):has(+ :is(input:not([type=checkbox],[type=radio],[type=color],[type=range],[type=file]),select:not([multiple],[size]:not([size="1"])),.ui-field-measure))) {text-box:trim-both cap alphabetic;padding-block:calc((1lh - 1cap) / 2)}}
}
