/* ============================================================================
   Career Leap atoms: the smallest parts every screen is assembled from.
   Owner: atoms builder. Load order: tokens, base, ATOMS, molecules, ...
   Every value is a var(--cl-*) token (never a --cl-ref-* colour). All rules live in @layer cl.atoms (order declared in tokens.css).
   Atoms never define --cl-* custom properties: component-private values are --_name, and the only inputs are tokens.

   STATE CONTRACT (M1 control feedback), same on every atom:
     rest · hover (pointer only) · focus-visible · pressed (:active) · selected · disabled · loading/error
   - Real use:     :hover only under @media (hover:hover) and (pointer:fine); :focus-visible; :active.
   - Specimens:    the [data-state="hover|focus|pressed"] mirrors that let a documentation page show states side by side
                   live in css/docs-specimens.css (layer cl.docs, loaded by system/* only). Product code never sets data-state.
   - State layers: M3 8 / 10 / 10 / 16 % of the content colour, painted by a ::before layer through
                   --_layer (a colour-mix, never `opacity` on text).
   - Disabled:     solid colour tokens, no opacity on text (WCAG 1.4.3 exempts inactive components).
   - Focus ring:   two-tone. 2px focus-ring outline, 2px offset, filled by a 2px halo of the page surface
                   (box-shadow) so it holds on canvas, gold, paper and photos. Never clipped.
   ============================================================================ */

@layer cl.atoms {

/* ---- Layout primitives ----------------------------------------------------
   gap props map to spacing tokens: data-gap="0|2|4|8|12|16|20|24|32|40|48|64|80|96".
   .cl-container, .cl-grid, .cl-section-* live in base.css and are documented on the atoms page. */
[data-gap="0"], [data-cl-gap="0"] { --_gap: var(--cl-space-0); }
[data-gap="2"], [data-cl-gap="2"] { --_gap: var(--cl-space-2); }
[data-gap="4"], [data-cl-gap="4"] { --_gap: var(--cl-space-4); }
[data-gap="8"], [data-cl-gap="8"] { --_gap: var(--cl-space-8); }
[data-gap="12"], [data-cl-gap="12"] { --_gap: var(--cl-space-12); }
[data-gap="16"], [data-cl-gap="16"] { --_gap: var(--cl-space-16); }
[data-gap="20"], [data-cl-gap="20"] { --_gap: var(--cl-space-20); }
[data-gap="24"], [data-cl-gap="24"] { --_gap: var(--cl-space-24); }
[data-gap="32"], [data-cl-gap="32"] { --_gap: var(--cl-space-32); }
[data-gap="40"], [data-cl-gap="40"] { --_gap: var(--cl-space-40); }
[data-gap="48"], [data-cl-gap="48"] { --_gap: var(--cl-space-48); }
[data-gap="64"], [data-cl-gap="64"] { --_gap: var(--cl-space-64); }
[data-gap="80"], [data-cl-gap="80"] { --_gap: var(--cl-space-80); }
[data-gap="96"], [data-cl-gap="96"] { --_gap: var(--cl-space-96); }

.cl-stack { display: flex; flex-direction: column; gap: var(--_gap, var(--cl-stack-md)); }
.cl-stack--start { align-items: flex-start; }
.cl-stack--center { align-items: center; }
.cl-cluster:is([data-gap], [data-cl-gap]) { gap: var(--_gap); }
.cl-cluster--start { justify-content: flex-start; }
.cl-cluster--end { justify-content: flex-end; }
.cl-cluster--nowrap { flex-wrap: nowrap; }
.cl-grid:is([data-gap], [data-cl-gap]) { column-gap: var(--_gap); row-gap: var(--_gap); }
.cl-spacer { display: block; flex: none; width: 100%; height: var(--_gap, var(--cl-space-16)); }
.cl-spacer--grow { flex: 1 1 auto; height: auto; }

/* ---- Icon ------------------------------------------------------------------
   Inline SVG from the sprite: <svg class="cl-icon" aria-hidden="true"><use href="#i-search"/></svg>
   Lucide-style: 24 viewBox, round caps and joins, 1.75 stroke at 24. Stroke is optically
   compensated at 20 and 16 so the line weight on screen stays about 1.5 to 1.7px. */
.cl-icon {
  width: var(--cl-size-icon-24);
  height: var(--cl-size-icon-24);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cl-icon--20 { width: var(--cl-size-icon-20); height: var(--cl-size-icon-20); stroke-width: 2; }
.cl-icon--16 { width: var(--cl-size-icon-16); height: var(--cl-size-icon-16); stroke-width: 2.25; }
.cl-icon--inline { display: inline-block; vertical-align: -0.2em; }
.cl-icon--solid-dot { fill: currentColor; }

/* ---- Text atoms: label, helper, link -------------------------------------- */
.cl-label {
  display: block;
  font-size: var(--cl-type-label-size);
  line-height: var(--cl-type-label-line-height);
  font-weight: var(--cl-type-label-weight);
  letter-spacing: var(--cl-type-label-tracking);
  color: var(--cl-color-on-surface);
}
.cl-helper {
  display: flex; gap: var(--cl-space-8); align-items: center;
  font-size: var(--cl-type-body-small-size);
  line-height: var(--cl-type-body-small-line-height);
  color: var(--cl-color-on-surface-muted);
}
.cl-helper .cl-icon { margin-block-start: var(--cl-space-2); }
.cl-helper--error { color: var(--cl-color-on-error-container); }   /* solid role; paired with an icon, never colour alone */

.cl-link {
  color: var(--cl-color-primary-text);
  text-decoration: underline;
  text-decoration-thickness: var(--cl-border-width-1);
  text-underline-offset: var(--cl-space-4);
  border-radius: var(--cl-radius-4);
}
@media (hover: hover) and (pointer: fine) {
  .cl-link:hover { text-decoration-thickness: var(--cl-border-width-2); }
}

.cl-link:active { color: var(--cl-color-on-primary-container); text-decoration-thickness: var(--cl-border-width-2); }
.cl-link--standalone {
  display: inline-flex; align-items: center; gap: var(--cl-space-8);
  min-height: var(--cl-size-target-min); min-inline-size: var(--cl-size-target-min);   /* a short word is still a 48 x 48 target (round G9) */
  font-size: var(--cl-font-size-16);
  line-height: var(--cl-type-body-line-height);
  font-weight: var(--cl-font-weight-semibold);
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .cl-link--standalone:hover { text-decoration: underline; text-decoration-thickness: var(--cl-border-width-2); text-underline-offset: var(--cl-space-4); }
}
.cl-link--standalone:focus-visible,
.cl-link--standalone:active { text-decoration: underline; text-decoration-thickness: var(--cl-border-width-2); text-underline-offset: var(--cl-space-4); }
.cl-link[aria-disabled="true"] { color: var(--cl-color-on-surface-disabled); pointer-events: none; cursor: not-allowed; }

/* ---- Button ------------------------------------------------------------------
   Emphasis: filled (default) · secondary (white / glass, 1px outline, dark-blue label; --tonal is a DEPRECATED alias, remove after round G) · outlined · text · destructive.   Size: sm 36 · md 44 · lg 52 (every size keeps a 48 hit area).
   Label 16/24 600 at 48 and 56, 14/20 600 at 40 (round A1 ruling 4). min-height never height. */
.cl-button {
  --_h: var(--cl-button-height-md);
  --_px: var(--cl-button-padding-inline-md);
  --_r: var(--cl-button-radius-md);
  --_icon: var(--cl-size-icon-20);
  --_bg: var(--cl-color-primary);
  --_fg: var(--cl-color-on-primary);
  --_bd: transparent;
  --_sl: var(--cl-color-state-layer-on-filled);
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  --_layer: transparent;
  --_layer-hover: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-hover) * 100%), transparent);
  --_layer-press: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-pressed) * 100%), transparent);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--cl-space-8);
  min-height: var(--_h);
  min-width: var(--cl-button-min-width);
  padding-block: 0; padding-inline: var(--_px);
  border: var(--cl-border-width-1) solid var(--_bd);
  border-radius: var(--_r);
  background: var(--_bg); color: var(--_fg);
  font-family: var(--cl-font-family-sans);
  font-size: var(--cl-font-size-16);
  line-height: var(--cl-type-body-line-height);
  font-weight: var(--cl-font-weight-semibold);
  letter-spacing: var(--cl-type-label-tracking);
  text-align: center; text-decoration: none; white-space: normal;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: border-radius var(--cl-duration-100) var(--cl-easing-standard);
}
.cl-button::before {                       /* M3 state layer, between container and content */
  content: ""; position: absolute; inset: calc(var(--cl-border-width-1) * -1);
  border-radius: inherit; background: var(--_layer); pointer-events: none; z-index: -1;
}
.cl-button .cl-icon { width: var(--_icon); height: var(--_icon); }
.cl-button--sm { --_h: var(--cl-button-height-sm); --_px: var(--cl-button-padding-inline-sm); --_r: var(--cl-button-radius-sm); font-size: var(--cl-type-label-size); line-height: var(--cl-type-label-line-height); }
.cl-button--lg { --_h: var(--cl-button-height-lg); --_px: var(--cl-button-padding-inline-lg); --_r: var(--cl-button-radius-lg); --_icon: var(--cl-size-icon-24); }
.cl-button::after {                       /* HIT AREA, always >= 48 x 48, centred on the visible control (round C1 ruling 13).
   An absolutely positioned pseudo is inset from the PADDING box, so the border width is added to the offset (a plain
   (48 - h) / -2 computed 46). min() so a taller control at 200% text is never shrunk. Verified by getBoundingClientRect. */
  content: ""; position: absolute;
  inset: min(0px, calc((var(--cl-size-target-min) - var(--_h)) / -2 - var(--cl-border-width-1))) calc(var(--cl-border-width-1) * -1);
}
.cl-button--secondary, .cl-button--tonal { --_bg: var(--cl-color-secondary-container); --_fg: var(--cl-color-on-secondary-container); --_bd: var(--cl-color-secondary-outline); --_sl: var(--cl-color-state-layer-on-secondary); }   /* quiet paper, never tinted plastic (round G ask 10) */
.cl-button--outlined { --_bg: transparent; --_fg: var(--cl-color-primary-text); --_bd: var(--cl-color-border-strong); --_sl: var(--cl-color-state-layer-on-surface); }
.cl-button--text { --_bg: transparent; --_fg: var(--cl-color-primary-text); --_sl: var(--cl-color-state-layer-on-surface); --_px: var(--cl-space-12); }
.cl-button--destructive { --_bg: var(--cl-color-error); --_fg: var(--cl-color-on-error); }   /* never the primary role (Apple HIG) */
.cl-button--block { display: flex; width: 100%; }
@media (min-width: 840px) {              /* laptop: a compact button does not stretch to 546px (round C1 finding 16); --fill opts back in */
  .cl-button--block:not(.cl-button--fill) { width: auto; min-width: var(--cl-grid-min-track); }
}
.cl-button--icon-start { padding-inline-start: calc(var(--_px) - var(--cl-space-4)); }
.cl-button--icon-end { padding-inline-end: calc(var(--_px) - var(--cl-space-4)); }

@media (hover: hover) and (pointer: fine) {
  .cl-button:hover { --_layer: var(--_layer-hover); }
}

.cl-button:active { --_layer: var(--_layer-press); border-radius: var(--cl-button-radius-pressed); }

/* LOADING IN PLACE (round C1 ruling 12). Markup contract:
     <button class="cl-button" aria-busy="true" aria-disabled="true"><span class="cl-button__label">Save</span><span class="cl-spinner cl-button__spinner" aria-hidden="true"></span></button>
   The SAME label stays in the DOM (so the width is kept and the accessible name does not change) and is hidden with opacity 0, which
   forced-colors cannot override; the spinner overlays it, centred. aria-disabled blocks a second activation (the button keeps focus, unlike
   disabled). aria-busy on a button is NOT announced by VoiceOver or TalkBack, so the page owns one polite live region
   (<p role="status" class="cl-visually-hidden">) that says "Saving..." then "Saved". */
.cl-button[aria-busy="true"] { color: transparent; pointer-events: none; }   /* color: a bare text node (no label span) still hides outside forced colours */
.cl-button[aria-busy="true"] > :not(.cl-button__spinner) { opacity: 0; }
.cl-button .cl-button__spinner { position: absolute; inset: 0; margin: auto; --_arc: var(--_fg); --_s: var(--_icon); }
.cl-button[aria-busy="true"]:active { border-radius: var(--_r); --_layer: transparent; }

.cl-button:disabled, .cl-button[aria-disabled="true"]:not([aria-busy="true"]) {
  --_bg: var(--_dis-bg); --_fg: var(--_dis-fg); --_layer: transparent; --_bd: transparent;
  cursor: not-allowed; border-radius: var(--_r);
}
/* A disabled FILLED button is the action still to come: white with a 1px border-strong boundary (3:1) and a muted label, never grey on grey (round H). */
.cl-button:not(.cl-button--outlined):not(.cl-button--text):not(.cl-button--secondary):not(.cl-button--tonal):not(.cl-button--destructive):disabled,
.cl-button:not(.cl-button--outlined):not(.cl-button--text):not(.cl-button--secondary):not(.cl-button--tonal):not(.cl-button--destructive)[aria-disabled="true"]:not([aria-busy="true"]) { --_bg: var(--cl-color-surface-raised); --_fg: var(--cl-color-on-surface-muted); --_bd: var(--cl-color-border-strong); }
.cl-button--outlined:disabled, .cl-button--outlined[aria-disabled="true"]:not([aria-busy="true"]) { --_bg: transparent; --_bd: var(--_dis-fg); }
.cl-button--text:disabled, .cl-button--text[aria-disabled="true"]:not([aria-busy="true"]) { --_bg: transparent; }

/* ---- Icon button: visible 40, target 48 ------------------------------------- */
.cl-icon-button {
  --_bg: transparent; --_fg: var(--cl-color-on-surface); --_bd: transparent;
  --_sl: var(--cl-color-state-layer-on-surface);
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  --_layer: transparent;
  --_layer-hover: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-hover) * 100%), transparent);
  --_layer-press: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-pressed) * 100%), transparent);
  position: relative; isolation: isolate;
  display: inline-grid; place-items: center; flex: none;
  --_size: var(--_ibs, var(--cl-icon-button-size));   /* a bar sets --_ibs (private) to enlarge its icon buttons; nobody redefines the token */
  width: var(--_size); height: var(--_size);
  border: var(--cl-border-width-1) solid var(--_bd);
  border-radius: var(--cl-radius-999);
  background: var(--_bg); color: var(--_fg);
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.cl-icon-button::before { content: ""; position: absolute; inset: calc(var(--cl-border-width-1) * -1); border-radius: inherit; background: var(--_layer); pointer-events: none; z-index: -1; }
.cl-icon-button::after {                  /* hit area >= 48 x 48 (padding-box inset: add the border, see .cl-button::after) */
  content: ""; position: absolute;
  inset: calc((var(--cl-icon-button-target) - var(--_size)) / -2 - var(--cl-border-width-1));
}
.cl-icon-button .cl-icon { width: var(--cl-icon-button-icon); height: var(--cl-icon-button-icon); }
.cl-icon-button--filled { --_bg: var(--cl-color-primary); --_fg: var(--cl-color-on-primary); --_sl: var(--cl-color-state-layer-on-filled); }
.cl-icon-button--secondary, .cl-icon-button--tonal { --_bg: var(--cl-color-secondary-container); --_fg: var(--cl-color-on-secondary-container); --_bd: var(--cl-color-secondary-outline); --_sl: var(--cl-color-state-layer-on-secondary); }
.cl-icon-button--outlined { --_bd: var(--cl-color-border-strong); }
.cl-icon-button--toggle[aria-pressed="true"] {        /* pressed is a tint AND a 2px inner ring (WCAG 1.4.1), and a glyph swap where the host provides one */
  --_bg: var(--cl-color-selected-container); --_fg: var(--cl-color-on-selected-container); --_bd: var(--cl-color-selected-border); --_sl: var(--cl-color-state-layer-on-secondary);
  --_inset: inset 0 0 0 var(--cl-border-width-1) var(--cl-color-selected-border); box-shadow: var(--_inset);
}
@media (hover: hover) and (pointer: fine) {
  .cl-icon-button:hover { --_layer: var(--_layer-hover); }
}

.cl-icon-button:active { --_layer: var(--_layer-press); }
.cl-icon-button[aria-busy="true"] { pointer-events: none; }
.cl-icon-button:disabled, .cl-icon-button[aria-disabled="true"] { --_bg: transparent; --_fg: var(--_dis-fg); --_layer: transparent; cursor: not-allowed; }
.cl-icon-button--filled:disabled,
.cl-icon-button--filled[aria-disabled="true"],
.cl-icon-button--secondary:disabled, .cl-icon-button--secondary[aria-disabled="true"],
.cl-icon-button--tonal:disabled,
.cl-icon-button--tonal[aria-disabled="true"] { --_bg: var(--_dis-bg); }
.cl-icon-button--outlined:disabled, .cl-icon-button--outlined[aria-disabled="true"] { --_bd: var(--_dis-fg); }

/* ---- Text field atoms: input, textarea ----------------------------------------
   16px minimum so iOS Safari never zooms on focus (font-size: max(16px, 1rem) via the token). */
.cl-input, .cl-textarea {
  --_bd: var(--cl-color-border-strong);
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  display: block; width: 100%;
  min-height: var(--cl-text-field-min-height);
  padding: var(--cl-space-12) var(--cl-text-field-padding-inline);
  border: var(--cl-text-field-border-width) solid var(--_bd);
  border-radius: var(--cl-text-field-radius);
  background: var(--cl-color-surface-raised); color: var(--cl-color-on-surface);
  font-family: var(--cl-font-family-sans);
  font-size: var(--cl-text-field-font-size);
  line-height: var(--cl-type-body-line-height);
  appearance: none; -webkit-appearance: none;
  text-decoration: none;   /* a field never inherits link underline from its context (round E1 ruling 17) */
}
.cl-input::placeholder, .cl-textarea::placeholder { color: var(--cl-color-on-surface-muted); text-decoration: none; }
.cl-input--dense { min-height: var(--cl-size-control-48); padding-block: var(--cl-space-8); }
.cl-textarea { min-height: calc(var(--cl-text-field-min-height) * 2); resize: vertical; }
@media (hover: hover) and (pointer: fine) {
  .cl-input:hover:not(:disabled):not(:focus-visible), .cl-textarea:hover:not(:disabled):not(:focus-visible) { --_bd: var(--cl-color-on-surface); }
}

.cl-input:focus-visible, .cl-textarea:focus-visible { --_bd: var(--cl-color-primary-text); }
.cl-input[aria-invalid="true"], .cl-textarea[aria-invalid="true"] { --_bd: var(--cl-color-error); --_inset: inset 0 0 0 var(--cl-border-width-1) var(--cl-color-error); box-shadow: var(--_inset); }
.cl-input:disabled, .cl-textarea:disabled, .cl-input[aria-disabled="true"] { background: var(--_dis-bg); color: var(--_dis-fg); border-color: transparent; cursor: not-allowed; }
.cl-input:disabled::placeholder { color: var(--_dis-fg); }
.cl-input[readonly], .cl-textarea[readonly] { background: var(--cl-color-surface); border-style: dashed; }
.cl-input[type="number"] { -moz-appearance: textfield; }

/* ---- Selection controls: checkbox, radio, switch ------------------------------
   The whole row is the target (min 48 high). The native input is kept (real semantics, keyboard,
   form value) and visually replaced by a 20px box inside a 40px state layer (M3 40 / 48). */
.cl-check, .cl-radio, .cl-switch {
  --_sl: var(--cl-color-state-layer-on-surface);
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  --_layer: transparent;
  --_layer-hover: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-hover) * 100%), transparent);
  --_layer-press: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-pressed) * 100%), transparent);
  position: relative;
  display: inline-flex; align-items: center; gap: var(--cl-space-4);
  min-height: var(--cl-size-target-min);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  font-size: var(--cl-font-size-16); line-height: var(--cl-type-body-line-height);
}
.cl-check__input, .cl-radio__input, .cl-switch__input {   /* real control: transparent, covers the row for taps */
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; z-index: 1;
}
.cl-check__control, .cl-radio__control, .cl-switch__control {
  position: relative; isolation: isolate; flex: none;
  display: grid; place-items: center;
  width: var(--cl-size-control-40); height: var(--cl-size-control-40);
  border-radius: var(--cl-radius-999);
  margin-inline-start: calc((var(--cl-size-icon-20) - var(--cl-size-control-40)) / 2);
}
.cl-check__control::before, .cl-radio__control::before, .cl-switch__control::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--_layer); z-index: -1;
}
.cl-check__label, .cl-radio__label, .cl-switch__label { padding-block: var(--cl-space-12); }
.cl-switch__control { width: auto; border-radius: var(--cl-radius-999); margin-inline-start: 0; }
.cl-switch__control::before { inset: calc((var(--cl-size-control-40) - var(--cl-space-32)) / -2) calc(var(--cl-space-4) * -1); } /* 40 layer round a 32 track */

.cl-check__box, .cl-radio__box {
  position: relative; display: block;
  width: var(--cl-size-icon-20); height: var(--cl-size-icon-20);
  border: var(--cl-border-width-2) solid var(--cl-color-border-strong);
  background: var(--cl-color-surface-raised);
}
.cl-check__box { border-radius: var(--cl-radius-4); }
.cl-radio__box { border-radius: var(--cl-radius-999); }
.cl-check__box::after {                                   /* check glyph: a mask, coloured by the role */
  content: ""; position: absolute; inset: calc(var(--cl-border-width-2) * -1);
  background: var(--cl-color-on-primary);
  -webkit-mask: var(--_glyph) center / 100% 100% no-repeat; mask: var(--_glyph) center / 100% 100% no-repeat;
  transform: scale(0);
  transition: transform var(--cl-duration-100) var(--cl-easing-emphasized-decelerate);
  --_glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.8'/%3E%3C/svg%3E");
}
.cl-check__input:indeterminate ~ .cl-check__control .cl-check__box::after {
  --_glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5.5 10h9'/%3E%3C/svg%3E");
}
.cl-check__input:checked ~ .cl-check__control .cl-check__box,
.cl-check__input:indeterminate ~ .cl-check__control .cl-check__box { background: var(--cl-color-primary); border-color: var(--cl-color-primary); }
.cl-check__input:checked ~ .cl-check__control .cl-check__box::after,
.cl-check__input:indeterminate ~ .cl-check__control .cl-check__box::after { transform: scale(1); }

.cl-radio__box::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: calc(var(--cl-size-icon-20) / 2); height: calc(var(--cl-size-icon-20) / 2);
  border-radius: var(--cl-radius-999); background: var(--cl-color-primary);
  transform: scale(0); transition: transform var(--cl-duration-100) var(--cl-easing-emphasized-decelerate);
}
.cl-radio__input:checked ~ .cl-radio__control .cl-radio__box { border-color: var(--cl-color-primary); }
.cl-radio__input:checked ~ .cl-radio__control .cl-radio__box::after { transform: scale(1); }

.cl-switch { gap: var(--cl-space-16); }                       /* track to label 16 (Apple 16pt, M3 16dp); the 6px focus ring never touches the label */
.cl-switch--trailing { flex-direction: row-reverse; justify-content: space-between; width: 100%; }   /* settings rows: label leading, switch trailing */

/* Switch: track 52 x 32, handle 24 (scaled to 16 when off, 28 when pressed) = M3 and Apple (51 x 31). */
.cl-switch__track {
  position: relative; display: block;
  width: calc(var(--cl-space-48) + var(--cl-space-4)); height: var(--cl-space-32);
  border: var(--cl-border-width-2) solid var(--cl-color-border-strong);
  border-radius: var(--cl-radius-999);
  background: var(--cl-color-surface);
}
.cl-switch__thumb {
  position: absolute; inset-block: 0; margin-block: auto; inset-inline-start: calc(var(--cl-space-4) - var(--cl-border-width-2));
  width: var(--cl-space-24); height: var(--cl-space-24);
  display: grid; place-items: center;
  border-radius: var(--cl-radius-999);
  background: var(--cl-color-border-strong); color: var(--cl-color-on-primary);
  transform: translateX(0) scale(0.6667);
  transition: transform var(--cl-duration-200) var(--cl-easing-emphasized);
}
.cl-switch__thumb .cl-icon { width: var(--cl-size-icon-16); height: var(--cl-size-icon-16); stroke-width: 2.5; transform: scale(0); transition: transform var(--cl-duration-100) var(--cl-easing-emphasized-decelerate); }
.cl-switch__input:checked ~ .cl-switch__control .cl-switch__track { background: var(--cl-color-primary); border-color: var(--cl-color-primary); }
.cl-switch__input:checked ~ .cl-switch__control .cl-switch__thumb { background: var(--cl-color-on-primary); color: var(--cl-color-primary); transform: translateX(var(--cl-space-20)) scale(1); }
.cl-switch__input:checked ~ .cl-switch__control .cl-switch__thumb .cl-icon { transform: scale(1); }

/* selection-control state layers + pressed + focus */
@media (hover: hover) and (pointer: fine) {
  .cl-check:hover, .cl-radio:hover, .cl-switch:hover { --_layer: var(--_layer-hover); }
}

.cl-check:active,
.cl-radio:active,
.cl-switch:active { --_layer: var(--_layer-press); }
.cl-switch:active .cl-switch__thumb { transform: translateX(0) scale(1.1667); }
.cl-switch__input:checked:active ~ .cl-switch__control .cl-switch__thumb { transform: translateX(var(--cl-space-20)) scale(1.1667); }

/* error (checkbox / radio group invalid) */
.cl-check__input[aria-invalid="true"] ~ .cl-check__control .cl-check__box,
.cl-radio__input[aria-invalid="true"] ~ .cl-radio__control .cl-radio__box { border-color: var(--cl-color-error); }

/* disabled: solid tokens */
.cl-check__input:disabled ~ *, .cl-radio__input:disabled ~ *, .cl-switch__input:disabled ~ * { color: var(--_dis-fg); }
.cl-check:has(input:disabled), .cl-radio:has(input:disabled), .cl-switch:has(input:disabled) { cursor: not-allowed; --_layer: transparent; }
.cl-check__input:disabled ~ .cl-check__control .cl-check__box,
.cl-radio__input:disabled ~ .cl-radio__control .cl-radio__box { border-color: var(--_dis-fg); background: transparent; }
.cl-check__input:disabled:checked ~ .cl-check__control .cl-check__box { background: var(--_dis-fg); border-color: var(--_dis-fg); }
.cl-check__input:disabled:checked ~ .cl-check__control .cl-check__box::after { background: var(--_dis-bg); }
.cl-radio__input:disabled ~ .cl-radio__control .cl-radio__box::after { background: var(--_dis-fg); }
.cl-switch__input:disabled ~ .cl-switch__control .cl-switch__track { background: var(--_dis-bg); border-color: var(--_dis-fg); }
.cl-switch__input:disabled ~ .cl-switch__control .cl-switch__thumb { background: var(--_dis-fg); color: var(--_dis-bg); }
.cl-switch__input:disabled:checked ~ .cl-switch__control .cl-switch__track { background: var(--_dis-bg); }
.cl-switch__input:disabled:checked ~ .cl-switch__control .cl-switch__thumb { background: var(--_dis-fg); color: var(--_dis-bg); }

/* ---- Slider (single) and range (two thumbs) -------------------------------------
   Native <input type="range">: keyboard (arrows, Home, End, PgUp/PgDn), screen-reader value, form value.
   Row is 48 high so the track is an easy target; thumb 24 + 8 state ring = the 40 M3 layer.
   --_pct is written by the page script so the filled part follows the thumb (no-JS: plain track). */
.cl-slider {
  --_pct: 50%;
  --_track: var(--cl-space-4);
  --_thumb: var(--cl-space-24);
  --_ring: 0 0 0 0 transparent;
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  display: block; width: 100%; margin: 0;
  min-height: var(--cl-size-target-min);
  background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  touch-action: pan-y;
}
.cl-slider::-webkit-slider-runnable-track {
  height: var(--_track); border-radius: var(--cl-radius-999);
  background: linear-gradient(to right, var(--cl-color-primary) var(--_pct), var(--cl-color-border-strong) var(--_pct));
}
.cl-slider::-moz-range-track { height: var(--_track); border-radius: var(--cl-radius-999); background: var(--cl-color-border-strong); }
.cl-slider::-moz-range-progress { height: var(--_track); border-radius: var(--cl-radius-999); background: var(--cl-color-primary); }
.cl-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--_thumb); height: var(--_thumb);
  margin-top: calc((var(--_track) - var(--_thumb)) / 2);
  border-radius: var(--cl-radius-999);
  border: var(--cl-border-width-2) solid var(--cl-color-background);
  background: var(--cl-color-primary);
  box-shadow: var(--_ring);
  transition: box-shadow var(--cl-duration-100) var(--cl-easing-standard);
}
.cl-slider::-moz-range-thumb {
  box-sizing: border-box; width: var(--_thumb); height: var(--_thumb);
  border-radius: var(--cl-radius-999); border: var(--cl-border-width-2) solid var(--cl-color-background);
  background: var(--cl-color-primary); box-shadow: var(--_ring);
}
@media (hover: hover) and (pointer: fine) {
  .cl-slider:hover { --_ring: 0 0 0 var(--cl-space-8) color-mix(in srgb, var(--cl-color-state-layer-on-surface) calc(var(--cl-opacity-state-hover) * 100%), transparent); }
}

.cl-slider:active { --_ring: 0 0 0 var(--cl-space-8) color-mix(in srgb, var(--cl-color-state-layer-on-surface) calc(var(--cl-opacity-state-pressed) * 100%), transparent); }
.cl-slider:focus-visible {
  outline: none;
  --_ring: 0 0 0 var(--cl-border-width-2) var(--cl-color-background), 0 0 0 calc(var(--cl-border-width-2) * 2) var(--cl-color-focus-ring), 0 0 0 calc(var(--cl-border-width-2) * 3) var(--cl-color-background);
}
.cl-slider:disabled { cursor: not-allowed; }
.cl-slider:disabled::-webkit-slider-runnable-track { background: var(--_dis-bg); }
.cl-slider:disabled::-moz-range-track { background: var(--_dis-bg); }
.cl-slider:disabled::-moz-range-progress { background: var(--_dis-fg); }
.cl-slider:disabled::-webkit-slider-thumb { background: var(--_dis-fg); }
.cl-slider:disabled::-moz-range-thumb { background: var(--_dis-fg); }

.cl-range { --lo: 25%; --hi: 75%; position: relative; min-height: var(--cl-size-target-min); }
.cl-range__track {
  position: absolute; inset-inline: 0; top: 50%; height: var(--cl-space-4); margin-top: calc(var(--cl-space-2) * -1);
  border-radius: var(--cl-radius-999);
  background: linear-gradient(to right, var(--cl-color-border-strong) var(--lo), var(--cl-color-primary) var(--lo), var(--cl-color-primary) var(--hi), var(--cl-color-border-strong) var(--hi));
}
.cl-range .cl-slider { position: absolute; inset: 0; pointer-events: none; }
.cl-range .cl-slider::-webkit-slider-runnable-track { background: transparent; }
.cl-range .cl-slider::-moz-range-track, .cl-range .cl-slider::-moz-range-progress { background: transparent; }
.cl-range .cl-slider::-webkit-slider-thumb { pointer-events: auto; }
.cl-range .cl-slider::-moz-range-thumb { pointer-events: auto; }
.cl-range .cl-slider.is-top { z-index: 1; }
.cl-range-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--cl-space-12); }

/* ---- Chip: assist, filter (selected), input (removable) -------------------------
   32 visible, 48 target (M3). Label 14/20 600. Selected adds a check glyph: never colour alone. */
.cl-chip {
  --_bg: transparent; --_fg: var(--cl-color-on-surface); --_bd: var(--cl-color-border-strong);
  --_sl: var(--cl-color-state-layer-on-surface);
  --_dis-bg: var(--cl-color-surface-disabled);
  --_dis-fg: var(--cl-color-on-surface-disabled);
  --_layer: transparent;
  --_layer-hover: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-hover) * 100%), transparent);
  --_layer-press: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-pressed) * 100%), transparent);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: var(--cl-space-8);
  min-height: var(--cl-chip-height);
  padding-inline: var(--cl-chip-padding-inline);
  border: var(--cl-border-width-1) solid var(--_bd);
  border-radius: var(--cl-chip-radius);
  background: var(--_bg); color: var(--_fg);
  font-family: var(--cl-font-family-sans);
  font-size: var(--cl-type-label-size); line-height: var(--cl-type-label-line-height);
  font-weight: var(--cl-type-label-weight); letter-spacing: var(--cl-type-label-tracking);
  max-width: 100%; padding-block: var(--cl-space-4); text-align: start;   /* wraps at 200% text instead of overflowing (round C1 finding 11) */
  text-decoration: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.cl-chip::before { content: ""; position: absolute; inset: calc(var(--cl-border-width-1) * -1); border-radius: inherit; background: var(--_layer); pointer-events: none; z-index: -1; }
.cl-chip::after {                         /* hit area >= 48 x 48; chip ROWS use gap 16 so two 32px chips sit at a 48 pitch with no overlap */
  content: ""; position: absolute;
  inset: min(0px, calc((var(--cl-chip-target) - var(--cl-chip-height)) / -2 - var(--cl-border-width-1))) calc(var(--cl-border-width-1) * -1);
}
.cl-chip--icon-start { padding-inline-start: var(--cl-space-8); }
.cl-chip[aria-pressed="true"], .cl-chip[aria-selected="true"], .cl-chip[aria-current="true"] {
  --_bg: var(--cl-color-selected-container); --_fg: var(--cl-color-on-selected-container); --_bd: var(--cl-color-selected-border);   /* selected = white, 2px dark-blue border (1 border + 1 inset) and a check */
  --_sl: var(--cl-color-state-layer-on-secondary); box-shadow: inset 0 0 0 var(--cl-border-width-1) var(--cl-color-selected-border); padding-inline-start: var(--cl-space-8);
}
.cl-chip:not([aria-pressed="true"]):not([aria-selected="true"]):not([aria-current="true"]) .cl-chip__check { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cl-chip:hover { --_layer: var(--_layer-hover); }
}

.cl-chip:active { --_layer: var(--_layer-press); }
.cl-chip:disabled, .cl-chip[aria-disabled="true"] { --_bg: transparent; --_fg: var(--_dis-fg); --_bd: var(--_dis-fg); --_layer: transparent; cursor: not-allowed; }
.cl-chip--input { padding-inline-end: var(--cl-space-4); cursor: default; }
.cl-chip__remove {
  position: relative; display: grid; place-items: center; flex: none;
  width: var(--cl-space-24); height: var(--cl-space-24); border-radius: var(--cl-radius-999);
  color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.cl-chip__remove::after { content: ""; position: absolute; inset: calc((var(--cl-size-target-min) - var(--cl-space-24)) / -2); }   /* 24 glyph, 48 x 48 target */
@media (hover: hover) and (pointer: fine) {
  .cl-chip__remove:hover { background: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-hover) * 100%), transparent); }
}

.cl-chip__remove:active { background: color-mix(in srgb, var(--_sl) calc(var(--cl-opacity-state-pressed) * 100%), transparent); }

/* ---- Badge: dot and count --------------------------------------------------------
   Always paired with a visually hidden sentence: the number alone is not an announcement. */
.cl-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: var(--cl-space-16); min-height: var(--cl-space-16);
  padding-inline: var(--cl-space-4);
  border-radius: var(--cl-radius-999);
  background: var(--cl-color-primary); color: var(--cl-color-on-primary);
  font-size: var(--cl-type-caption-size); line-height: var(--cl-type-caption-line-height);
  font-weight: var(--cl-font-weight-semibold); font-variant-numeric: tabular-nums;
}
.cl-badge--dot { min-width: var(--cl-space-8); min-height: var(--cl-space-8); width: var(--cl-space-8); height: var(--cl-space-8); padding: 0; }
.cl-badge-anchor { position: relative; display: inline-flex; }
.cl-badge-anchor > .cl-badge {
  position: absolute; inset-block-start: calc(var(--cl-space-4) * -1); inset-inline-end: calc(var(--cl-space-4) * -1);
  box-shadow: 0 0 0 var(--cl-border-width-2) var(--cl-focus-halo, var(--cl-color-focus-halo));
}
.cl-badge-anchor > .cl-badge--dot { inset-block-start: var(--cl-space-2); inset-inline-end: var(--cl-space-2); }

/* ---- Tag: provenance and status. Always text, never SVG. 12/16 600, >= 12px. -------- */
.cl-tag {
  --_bg: var(--cl-color-surface); --_fg: var(--cl-color-on-surface); --_bd: var(--cl-color-border-strong);
  display: inline-flex; align-items: center; flex: 0 1 auto; min-inline-size: 0; max-inline-size: 100%;   /* a long tag wraps inside its row instead of widening the page at 200% text (round E1 ruling 20) */
  min-height: var(--cl-size-icon-20);
  padding: var(--cl-space-2) var(--cl-space-8);
  border: var(--cl-border-width-1) solid var(--_bd);
  border-radius: var(--cl-radius-4);
  background: var(--_bg); color: var(--_fg);
  font-size: var(--cl-type-caption-size); line-height: var(--cl-type-caption-line-height);
  font-weight: var(--cl-font-weight-semibold);
  letter-spacing: var(--cl-type-eyebrow-tracking); text-transform: var(--cl-type-eyebrow-transform);
  white-space: normal; overflow-wrap: normal; word-break: keep-all; min-inline-size: min-content; text-align: start;   /* a tag breaks between words only and never narrower than its longest word (no letter-by-letter wrap, round H) */
}
.cl-tag--automatic { --_bg: var(--cl-color-surface-raised); --_fg: var(--cl-color-primary-text); --_bd: var(--cl-color-border-strong); white-space: nowrap; }   /* white with a hairline, never a blue fill; one line (round G9) */
.cl-tag--approve { --_bg: var(--cl-color-highlight); --_fg: var(--cl-color-on-highlight); --_bd: transparent; }
.cl-tag--human { --_bg: var(--cl-color-primary); --_fg: var(--cl-color-on-primary); --_bd: transparent; }
.cl-tag--simulated, .cl-tag--illustrative { --_bg: var(--cl-color-surface-raised); --_fg: var(--cl-color-on-surface); border-style: dashed; }
.cl-tag--illustrative { --_bg: var(--cl-color-surface); }   /* a step quieter than Simulated: invented example vs invented person */
.cl-tag--success { --_bg: var(--cl-color-success-container); --_fg: var(--cl-color-on-success-container); --_bd: transparent; }
.cl-tag--warning { --_bg: var(--cl-color-warning-container); --_fg: var(--cl-color-on-warning-container); --_bd: transparent; }
.cl-tag--error { --_bg: var(--cl-color-error-container); --_fg: var(--cl-color-on-error-container); --_bd: transparent; }
.cl-tag--info { --_bg: var(--cl-color-info-container); --_fg: var(--cl-color-on-info-container); --_bd: transparent; }
.cl-tag--dot::before {                      /* provenance tags only (automatic, human, simulated, illustrative): a gold mark, never text */
  content: ""; flex: none; width: var(--cl-space-8); height: var(--cl-space-8); margin-inline-end: var(--cl-space-8);
  border-radius: var(--cl-radius-999); background: var(--cl-color-highlight);
}
.cl-tag--overlay {                          /* over an image or illustration corner */
  position: absolute; inset-block-start: var(--cl-space-8); inset-inline-start: var(--cl-space-8); z-index: 1;
  --_bg: var(--cl-color-surface-raised); box-shadow: var(--cl-elevation-1);
}

/* ---- Avatar: image, initials, placeholder. 24 / 32 / 40 / 56 ------------------------ */
.cl-avatar {
  --_s: var(--cl-size-control-40); --_fs: var(--cl-font-size-14);
  position: relative; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: var(--_s); height: var(--_s);
  border-radius: var(--cl-radius-999);
  background: var(--cl-color-secondary-container); color: var(--cl-color-on-secondary-container);
  font-size: var(--_fs); line-height: 1; font-weight: var(--cl-font-weight-semibold);
  box-shadow: inset 0 0 0 var(--cl-border-width-1) var(--cl-color-border);
}
.cl-avatar--24 { --_s: var(--cl-size-icon-24); --_fs: var(--cl-font-size-12); }
.cl-avatar--32 { --_s: var(--cl-space-32); --_fs: var(--cl-font-size-14); }
.cl-avatar--40 { --_s: var(--cl-size-control-40); --_fs: var(--cl-font-size-14); }
.cl-avatar--56 { --_s: var(--cl-size-control-56); --_fs: var(--cl-font-size-20); }
.cl-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cl-avatar--placeholder { background: var(--cl-color-divider); color: var(--cl-color-on-surface-muted); }
.cl-avatar--placeholder .cl-icon { width: 60%; height: 60%; }

/* ---- Divider ------------------------------------------------------------------------------ */
.cl-divider { display: block; width: 100%; height: var(--cl-border-width-1); margin: 0; border: 0; background: var(--cl-color-divider); }
.cl-divider--inset { width: auto; margin-inline: var(--cl-space-16); }
.cl-divider--strong { background: var(--cl-color-border); }
.cl-divider--vertical { width: var(--cl-border-width-1); height: auto; align-self: stretch; min-height: var(--cl-space-16); }
.cl-divider-label { display: flex; align-items: center; gap: var(--cl-space-12); color: var(--cl-color-on-surface-muted); font-size: var(--cl-type-body-small-size); line-height: var(--cl-type-body-small-line-height); }
.cl-divider-label::before, .cl-divider-label::after { content: ""; flex: 1; height: var(--cl-border-width-1); background: var(--cl-color-divider); }

/* ---- Spinner (circular, 16 / 20 / 24 / 40) --------------------------------------------------
   Pair with text ("Loading your plan") or an aria-live region: motion alone is not information. */
.cl-spinner {
  --_s: var(--cl-size-icon-24); --_w: var(--cl-border-width-2); --_arc: var(--cl-color-primary-text);
  display: inline-block; flex: none;
  width: var(--_s); height: var(--_s);
  border: var(--_w) solid color-mix(in srgb, var(--_arc) 20%, transparent);
  border-top-color: var(--_arc);
  border-radius: var(--cl-radius-999);
  animation: cl-spin var(--cl-motion-spin) linear infinite;
}
.cl-spinner--16 { --_s: var(--cl-size-icon-16); }
.cl-spinner--20 { --_s: var(--cl-size-icon-20); }
.cl-spinner--24 { --_s: var(--cl-size-icon-24); }
.cl-spinner--40 { --_s: var(--cl-size-control-40); --_w: var(--cl-space-4); }
@keyframes cl-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .cl-spinner { animation: none; border-right-color: var(--_arc); }   /* static three-quarter arc */
}

/* ---- Dashes: position in a short sequence (round G ask 11). Replaces "3 / 8" counters.
   Dash 16 x 4, active 28 in primary, done in border-strong, upcoming in the light border, 6 gap, width animates 200 ms.
   INDICATOR:  <div class="cl-dashes" aria-hidden="true"><span class="cl-dashes__dash" data-status="done"></span>...<span class="cl-dashes__dash" data-status="current"></span>...</div>
               + <span class="cl-visually-hidden" role="status" aria-live="polite">3 of 8</span>
   CONTROL:    <div class="cl-dashes cl-dashes--control" role="group" aria-label="Cards"><button type="button" class="cl-dashes__dash" data-status="done" aria-label="Go to card 1 of 8"></button>...
               <button ... data-status="current" aria-current="true" aria-label="Go to card 3 of 8"></button> ...</div>
   Hit area of a control dash is 24 x 48 (pseudo-element), so a dash is never a 4 px target. js/dashes.js keeps the statuses and the live text in step with a scroll-snap track. ---- */
.cl-dashes { --_gap: var(--cl-dashes-gap, calc(var(--cl-space-4) + var(--cl-space-2)));   /* --cl-dashes-gap is the component token (6px, plan item 11); the fallback is the same sum until tokens.json carries it */ display: inline-flex; align-items: center; gap: var(--_gap); min-block-size: var(--cl-space-4); }
.cl-dashes__dash { position: relative; display: block; flex: none; inline-size: var(--cl-space-16); block-size: var(--cl-space-4); padding: 0; border: 0; border-radius: var(--cl-radius-999); background: var(--cl-color-border); transition: inline-size var(--cl-duration-200) var(--cl-easing-standard), background-color var(--cl-duration-200) linear; }
.cl-dashes__dash[data-status="done"] { background: var(--cl-color-border-strong); }
.cl-dashes__dash[data-status="current"], .cl-dashes__dash[aria-current="true"] { inline-size: calc(var(--cl-space-24) + var(--cl-space-4)); background: var(--cl-color-primary); }
button.cl-dashes__dash { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button.cl-dashes__dash::after { content: ""; position: absolute; inset-block: calc((var(--cl-size-target-min) - var(--cl-space-4)) / -2); inset-inline: calc(var(--cl-space-4) * -1); }   /* 24 x 48 hit area, centred on the dash */
button.cl-dashes__dash:focus-visible { outline: var(--cl-border-width-2) solid var(--cl-color-focus-ring); outline-offset: var(--cl-space-4); box-shadow: 0 0 0 calc(var(--cl-border-width-2) * 3) var(--cl-focus-halo, var(--cl-color-background)); }
@media (forced-colors: active) { .cl-dashes__dash { forced-color-adjust: none; background: GrayText; } .cl-dashes__dash[data-status="current"], .cl-dashes__dash[aria-current="true"] { background: Highlight; } }

/* ---- Linear progress: determinate and indeterminate -------------------------------------------
   Determinate: set --v (0 to 1) and aria-valuenow. Indeterminate: no value, and the text beside it says what is happening. */
.cl-progress {
  --_h: var(--cl-space-4); --v: 0;
  position: relative; display: block; width: 100%; height: var(--_h); overflow: hidden;
  border-radius: var(--cl-radius-999);
  background: var(--cl-color-primary-container);
  box-shadow: inset 0 0 0 var(--cl-border-width-1) var(--cl-color-border);
}
.cl-progress--thick { --_h: var(--cl-space-8); }
.cl-progress__bar {
  position: absolute; inset: 0; border-radius: inherit; background: var(--cl-color-primary);
  transform-origin: left center; transform: scaleX(var(--v));
  transition: transform var(--cl-duration-300) var(--cl-easing-standard);
}
.cl-progress--indeterminate .cl-progress__bar {
  width: 40%; transform: translateX(-100%); transform-origin: left center;
  animation: cl-indeterminate calc(var(--cl-duration-600) * 3) var(--cl-easing-standard) infinite;
}
@keyframes cl-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .cl-progress--indeterminate .cl-progress__bar {                  /* static stripes: still not a determinate bar */
    animation: none; width: 100%; transform: none;
    background: repeating-linear-gradient(90deg, var(--cl-color-primary) 0 var(--cl-space-8), transparent var(--cl-space-8) var(--cl-space-16));
  }
}
[dir="rtl"] .cl-progress__bar { transform-origin: right center; }

/* ---- Skeleton: shimmer is motion, so it is static under reduced motion --------------------------- */
.cl-skeleton {
  position: relative; display: block; overflow: hidden;
  min-height: var(--cl-space-16);
  border-radius: var(--cl-radius-4);
  background: var(--cl-color-divider);
}
.cl-skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--cl-color-surface-raised) 60%, transparent), transparent);
  animation: cl-shimmer calc(var(--cl-duration-600) * 3) var(--cl-easing-standard) infinite;
}
.cl-skeleton--text { min-height: 1em; }
.cl-skeleton--title { min-height: var(--cl-space-24); width: 60%; }
.cl-skeleton--circle { border-radius: var(--cl-radius-999); width: var(--cl-size-control-40); min-height: var(--cl-size-control-40); }
.cl-skeleton--block { min-height: var(--cl-space-96); border-radius: var(--cl-radius-12); }
@keyframes cl-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .cl-skeleton::after { animation: none; display: none; } }

/* ---- Focus ring (atom) ------------------------------------------------------------------------------
   Two-tone: 2px focus-ring outline, 2px offset, with a 2px halo of the page surface on both sides of the ring (box-shadow under the outline).
   Surfaces that are not the canvas can set --cl-focus-halo on themselves (e.g. a raised card).
   Meets WCAG 2.4.7, 2.4.11 (not obscured: see html scroll-padding) and 2.4.13. */
.cl-focus-ring:focus-visible,
.cl-button:focus-visible,
.cl-icon-button:focus-visible,
.cl-chip:focus-visible,
.cl-chip__remove:focus-visible,
.cl-link:focus-visible,
.cl-input:focus-visible,
.cl-textarea:focus-visible,
.cl-skip-link:focus-visible,
.cl-check__input:focus-visible ~ .cl-check__control .cl-check__box,
.cl-radio__input:focus-visible ~ .cl-radio__control .cl-radio__box,
.cl-switch__input:focus-visible ~ .cl-switch__control .cl-switch__track {
  outline: var(--cl-border-width-2) solid var(--cl-color-focus-ring);
  outline-offset: var(--cl-border-width-2);
  /* halo on BOTH sides of the ring: 6px of surface painted under the 2px..4px outline leaves 2px inside and 2px outside */
  box-shadow: var(--_inset, 0 0 0 0 transparent), 0 0 0 calc(var(--cl-border-width-2) * 3) var(--cl-focus-halo, var(--cl-color-focus-halo));
}
.cl-check__input:focus-visible, .cl-radio__input:focus-visible, .cl-switch__input:focus-visible { outline: none; }
.cl-focus-ring { border-radius: var(--cl-radius-8); }

@media (forced-colors: active) {
  .cl-button, .cl-icon-button--filled, .cl-chip { border-color: ButtonText; }
  .cl-button:disabled, .cl-button[aria-disabled="true"], .cl-chip:disabled { border-color: GrayText; color: GrayText; }
  .cl-focus-ring:focus-visible,
.cl-button:focus-visible,
.cl-icon-button:focus-visible,
.cl-chip:focus-visible,
.cl-input:focus-visible,
.cl-textarea:focus-visible,
.cl-link:focus-visible,
.cl-check__input:focus-visible ~ .cl-check__control .cl-check__box,
.cl-radio__input:focus-visible ~ .cl-radio__control .cl-radio__box,
.cl-switch__input:focus-visible ~ .cl-switch__control .cl-switch__track { outline-color: Highlight; box-shadow: none; }
  .cl-slider:focus-visible { outline: var(--cl-border-width-2) solid Highlight; }
  .cl-check__box, .cl-radio__box, .cl-switch__track { forced-color-adjust: none; border-color: ButtonText; background: Canvas; }
  .cl-check__input:checked ~ .cl-check__control .cl-check__box { background: Highlight; border-color: Highlight; }
  .cl-check__box::after { background: HighlightText; }
  .cl-radio__box::after { background: Highlight; }
  .cl-switch__input:checked ~ .cl-switch__control .cl-switch__track { background: Highlight; border-color: Highlight; }
  .cl-switch__thumb { background: ButtonText; color: Canvas; }
  .cl-switch__input:checked ~ .cl-switch__control .cl-switch__thumb { background: HighlightText; color: Highlight; }
  .cl-progress__bar { background: Highlight; forced-color-adjust: none; }
  .cl-badge, .cl-tag { border: var(--cl-border-width-1) solid CanvasText; }
  .cl-icon-button--toggle[aria-pressed="true"] { border: var(--cl-border-width-2) solid Highlight; }
  .cl-chip[aria-pressed="true"], .cl-chip[aria-selected="true"], .cl-chip[aria-current="true"] { forced-color-adjust: none; border: var(--cl-border-width-2) solid Highlight; background: Canvas; color: CanvasText; box-shadow: none; }   /* selected chip keeps a border in forced colours (round G9) */
  .cl-button[aria-busy="true"] { color: ButtonText; }
  .cl-spinner { border-color: GrayText; border-top-color: Highlight; }
  .cl-skeleton { background: GrayText; }
}

} /* @layer cl.atoms */
