/* Ezra v10 canonical components: the one place buttons, inputs, menus, chips, cards,
 * toasts, sheets and loading / empty / error states are styled. Every value is a token
 * (ezra-tokens.css); light and dark come from the tokens alone.
 *
 * New UI uses these classes. Do not add per-feature button / input / menu styles: add a
 * variant here instead (ARCHITECTURE.md §6 "Components").
 *
 * Load order: ezra-tokens.css -> ezra-ui.css -> ezra.css -> css/*. Feature files load
 * later, so a scoped override there wins ties. Kept in ezra.css (host isolation, top):
 * the one focus ring (`.ezra-root :focus-visible`, 2px --ring, 2px offset), the button
 * disabled rule and the native <select> look. Kept in css/ezra-interact.css: .ez-tip
 * (lib/tooltip.js) and the small-control touch rule (32px hit box). Primary and large buttons are 44px on phones
 * and touch screens here, so every page that loads the kit gets them.
 *
 * One-off button classes are guarded (tests/test_assets.py): outside this file a rule on a
 * `*-btn` class sets layout only (margin, width, order), never its own background + border +
 * padding. Need a new look? Add an `is-*` variant here.
 *
 * Breakpoints: one scale for every @media width, 720 (phone), 1100 (side pane), 1600 (wide).
 * A card or bar that reacts to its own width uses @container instead. JS keeps its pairs in
 * step (components/ezra-chat.js, lib/chart-frame.js); tests/test_assets.py guards the scale. */

/* ── Shared states ─────────────────────────────────────────────────────────── */
/* disabled: opacity .5 + not-allowed (ezra.css covers <button>; this covers <a>, <input>, <select>) */
:is(.ez-btn, .ez-iconbtn, .ez-toggle, .ez-chip, .ez-mi, .ez-input, .ez-select, .ez-seg button):is(:disabled, [aria-disabled="true"]) {
  opacity: .5; cursor: not-allowed;
}
/* press: the same subtle scale as the shared rule in ezra.css */
@media (prefers-reduced-motion: no-preference) {
  .ezra-root :is(.ez-btn, .ez-iconbtn, .ez-seg button, .ez-toggle):not(:disabled, [aria-disabled="true"]):active { transform: scale(.97); }
}
/* link-styled controls: the host-isolation link rule reads --ez-a, so set it, and never underline */
.ezra-root a:is(.ez-btn, .ez-mi, .ez-chip), .ezra-root a:is(.ez-btn, .ez-mi, .ez-chip):hover { text-decoration: none; }

/* ── Button ────────────────────────────────────────────────────────────────── */
.ez-btn {
  --ez-a: var(--text); --ez-a-hover: var(--bright);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0;
  height: var(--ctl-h); padding: 0 var(--sp-3); border-radius: var(--r-sm);
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text);
  font: 600 var(--fs-13)/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-btn.is-sm { height: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-12); }
.ez-btn.is-lg { height: var(--ctl-h-lg); padding: 0 var(--sp-4); font-size: var(--fs-14); }
.ez-btn:hover:not(:disabled, [aria-disabled="true"]) { background: var(--bg4); color: var(--bright); }
.ez-btn.is-primary { --ez-a: var(--on-p); --ez-a-hover: var(--on-p); background: var(--p); border-color: var(--p); color: var(--on-p); }
.ez-btn.is-primary:hover:not(:disabled, [aria-disabled="true"]) { background: var(--p-h); border-color: var(--p-h); color: var(--on-p); }
.ez-btn.is-ghost { --ez-a: var(--muted); background: transparent; border-color: transparent; color: var(--muted); }
.ez-btn.is-dashed { --ez-a: var(--muted); background: transparent; border-style: dashed; border-radius: var(--r-full); color: var(--muted); }
.ez-btn.is-danger { --ez-a: var(--bear-text); --ez-a-hover: var(--bear-text); color: var(--bear-text); }
.ez-btn.is-danger:hover:not(:disabled, [aria-disabled="true"]) { color: var(--bear-text); }
/* tinted: a soft brand suggestion (the "you ask this often" chip, "Ask EZRA" on a news row) */
.ez-btn.is-tinted { --ez-a: var(--p-text); --ez-a-hover: var(--p-text); background: var(--p1); border-color: var(--p3); color: var(--p-text); }
.ez-btn.is-tinted:hover:not(:disabled, [aria-disabled="true"]) { background: var(--p2); color: var(--p-text); }
/* wrap: a sentence-long label that grows to more lines instead of overflowing */
.ez-btn.is-wrap { justify-content: flex-start; height: auto; min-height: var(--ctl-h); padding-block: 6px; line-height: var(--lh-snug); text-align: left; white-space: normal; }
/* text-only action: no box, sized by the sentence or row it sits in */
.ez-btn.is-link { --ez-a: var(--p-text); --ez-a-hover: var(--p-text); height: auto; padding: 0; border: 0; background: none; color: var(--p-text); font-size: inherit; line-height: inherit; }
.ez-btn.is-link:hover:not(:disabled, [aria-disabled="true"]), .ezra-root a.ez-btn.is-link:hover { background: none; color: var(--p-text); text-decoration: underline; }
/* touch: the main action is at least 44px tall (Apple HIG, WCAG 2.5.5) */
@media (max-width: 720px), (pointer: coarse) {
  .ez-btn:is(.is-primary, .is-lg) { min-height: 44px; }
}

/* ── Icon button ───────────────────────────────────────────────────────────── */
.ez-iconbtn {
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--ctl-h); height: var(--ctl-h); padding: 0; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-iconbtn.is-sm { width: var(--ctl-h-sm); height: var(--ctl-h-sm); border-radius: var(--r-xs); }
/* time zone switch in the top bar: the zone label ("ET" / "IST") instead of an icon */
.ez-iconbtn.ez-tzbtn { width: auto; min-width: var(--ctl-h); padding: 0 var(--sp-2); font: 600 var(--fs-12)/1 var(--sans); letter-spacing: .02em; }
.ez-iconbtn > span { display: grid; }
.ez-iconbtn:hover:not(:disabled, [aria-disabled="true"]) { background: var(--bg4); color: var(--bright); }
.ez-iconbtn:is([aria-pressed="true"], [aria-expanded="true"], .is-active) { background: var(--p1); color: var(--p-text); }
.ez-iconbtn:is([aria-pressed="true"], [aria-expanded="true"], .is-active):hover { background: var(--p2); color: var(--p-text); }

/* ── Segmented control ─────────────────────────────────────────────────────── */
/* Container stays --bg3: --bg2 equals --card in both themes, so a --card selection would vanish. */
.ez-seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  border-radius: var(--r-sm); background: var(--bg3); border: 1px solid var(--border);
}
.ez-seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1);
  height: var(--ctl-h-sm); padding: 0 10px; border: 0; border-radius: var(--r-xs); background: transparent;
  font-size: var(--fs-12); font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-seg button:hover:not(:disabled, [aria-disabled="true"], [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], .is-active) {
  background: var(--bg4); color: var(--text);
}
.ez-seg button:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], .is-active) {
  background: var(--card); color: var(--bright); box-shadow: var(--shadow-2);
}

/* ── Toggle pill ───────────────────────────────────────────────────────────── */
.ez-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h-sm); padding: 0 10px; border-radius: var(--r-full);
  border: 1px solid var(--border2); background: transparent; color: var(--faint);
  font: 600 var(--fs-12)/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-toggle:hover:not(:disabled, [aria-disabled="true"]) { background: var(--bg4); color: var(--text); }
.ez-toggle:is([aria-pressed="true"], .is-active) { background: var(--p1); border-color: var(--p3); color: var(--p-text); }
.ez-toggle:is([aria-pressed="true"], .is-active):hover:not(:disabled, [aria-disabled="true"]) { background: var(--p2); color: var(--p-text); }
/* optional legend key (price chart overlays) */
.ez-toggle .ez-key { width: 10px; height: 2px; border-radius: 1px; background: currentColor; }
.ez-toggle[aria-pressed="false"] .ez-key { opacity: .35; }

/* ── Chip + count badge ────────────────────────────────────────────────────── */
.ez-chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); height: 24px; padding: 0 var(--sp-2); border-radius: var(--r-full);
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
}
.ez-chip.is-ticker { font-family: var(--mono); color: var(--bright); }
.ez-chip.is-bull { background: var(--bull-wash); border-color: transparent; color: var(--bull-text); }
.ez-chip.is-bear { background: var(--bear-wash); border-color: transparent; color: var(--bear-text); }
.ez-chip.is-amber { background: var(--amber-wash); border-color: transparent; color: var(--amber-text); }
.ez-chip.is-neutral { color: var(--muted); }
.ez-chip.is-caps { text-transform: uppercase; letter-spacing: var(--track-caps); }
/* compact: inside a meta line or a table row */
.ez-chip.is-sm { height: 20px; padding: 0 6px; font-size: var(--fs-11); }
/* a chip that is a button or link: hover lifts the border, open / current / pressed tints it.
 * :where() holds these at one class, so a feature's own chip state (ezra.css .ez-outline-item) still wins. */
:where(button, a).ez-chip { cursor: pointer; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
:where(button, a).ez-chip:where(:hover:not(:disabled, [aria-disabled="true"])) { border-color: var(--border2); background: var(--bg4); }
:where(button, a).ez-chip:where([aria-expanded="true"], [aria-pressed="true"], [aria-current]:not([aria-current="false"])) { border-color: var(--p3); background: var(--p1); }
.ez-count-badge {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 var(--sp-1); border-radius: var(--r-full);
  background: var(--p2); color: var(--p-text); font: 600 var(--fs-11)/1 var(--sans); font-variant-numeric: tabular-nums;
}

/* ── Text input + select ───────────────────────────────────────────────────── */
.ez-input, .ez-select {
  height: var(--ctl-h); min-width: 0; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border2); background-color: var(--bg2); color: var(--text);
  font: 400 var(--fs-13)/var(--lh-snug) var(--sans);
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ez-input::placeholder { color: var(--faint); opacity: 1; }
.ez-input:hover:not(:disabled, :focus), .ez-select:hover:not(:disabled, :focus) { background-color: var(--bg3); }
.ezra-root :is(.ez-input, .ez-select):focus-visible { outline: none; border-color: var(--ring); box-shadow: var(--focus-halo); }
/* invalid: set aria-invalid="true" with the error sentence linked by aria-describedby */
.ez-input[aria-invalid="true"], .ez-select[aria-invalid="true"] { border-color: var(--bear-text); }
.ezra-root :is(.ez-input, .ez-select)[aria-invalid="true"]:focus-visible { border-color: var(--bear-text); box-shadow: 0 0 0 3px var(--bear-wash); }
.ez-input.is-multiline {
  display: block; height: auto; min-height: 72px; padding: var(--sp-2) 10px; resize: vertical; field-sizing: content;
}
.ez-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none; padding-right: 28px; cursor: pointer;
  background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right var(--sp-2) center; background-size: 12px 12px;
}
/* <select class="ez-select">: outrank ezra.css's native-select rule so the field matches .ez-input */
.ezra-root select.ez-select:not([multiple]):not([size]) { background-color: var(--bg2); padding-right: 28px; }
.ezra-root select.ez-select:not([multiple]):not([size]):hover:not(:disabled, :focus) { background-color: var(--bg3); }
/* 16px on phones: iOS Safari zooms into anything smaller */
@media (max-width: 720px), (pointer: coarse) {
  .ez-input, .ez-select { font-size: 16px; }
}

/* ── Menu ──────────────────────────────────────────────────────────────────── */
/* <div class="ez-menu-anchor"> trigger + <div class="ez-menu" role="menu"> of .ez-mi items.
 * The caller places the panel (top / bottom / left / right). */
.ez-menu-anchor { position: relative; display: inline-block; }
.ez-menu {
  position: absolute; z-index: var(--z-menu); min-width: 200px; padding: var(--sp-1);
  background: var(--card-2); border: 1px solid var(--border2); border-radius: var(--r); box-shadow: var(--shadow-pop);
  font-size: var(--fs-13); color: var(--text);
}
.ez-mi {
  --ez-a: var(--text); --ez-a-hover: var(--bright);
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--ctl-h); padding: 6px 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text);
  font-size: var(--fs-13); text-align: left; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-mi svg { flex-shrink: 0; }
.ez-mi:is(:hover, .is-active):not(:disabled, [aria-disabled="true"]) { background: var(--bg4); color: var(--bright); }
.ez-mi.is-danger, .ez-mi.is-danger:hover { --ez-a: var(--bear-text); --ez-a-hover: var(--bear-text); color: var(--bear-text); }
.ez-menu-group {
  padding: var(--sp-2) 10px var(--sp-1); font-size: var(--fs-11); font-weight: 600;
  letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--faint);
}
.ez-menu-sep { height: 1px; margin: var(--sp-1) calc(-1 * var(--sp-1)); border: 0; background: var(--border); }

/* ── Popover (lib/popover.js) ──────────────────────────────────────────────── */
.ez-pop {
  position: fixed; z-index: var(--z-popover); max-width: min(340px, calc(100vw - 16px)); padding: var(--sp-3) 14px;
  background: var(--card-2); border: 1px solid var(--border2); border-radius: var(--r); box-shadow: var(--shadow-pop);
  font-size: var(--fs-13); color: var(--text); animation: ez-pop var(--dur-fast) var(--ease);
}
@keyframes ez-pop { from { opacity: 0; transform: translateY(-3px); } }
/* the one rise-in for content that appears (playbook cards, inline sheets, the "you ask this often" chip) */
@keyframes ez-rise { from { opacity: 0; transform: translateY(4px); } }
.ez-pop h4 { margin: 0 0 var(--sp-1); font-size: var(--fs-13); font-weight: 600; --ez-h: var(--bright); }
.ez-pop p { margin: 0 0 6px; color: var(--muted); line-height: var(--lh-snug); }
.ez-pop dl { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3); margin: 6px 0 0; font-size: var(--fs-12); }
.ez-pop dt { color: var(--faint); }
.ez-pop dd { margin: 0; color: var(--text); }
.ez-pop-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ── Toast (lib/dom.js toast()) ────────────────────────────────────────────── */
.ez-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: var(--z-toast); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: var(--sp-3); max-width: min(480px, calc(100vw - 32px)); overflow: hidden;
  padding: var(--sp-2) 14px; border-radius: var(--r-sm); background: var(--bright); color: var(--bg);
  font-size: var(--fs-13); font-weight: 600;
  transition: opacity var(--dur), transform var(--dur) var(--ease);
}
.ez-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
/* optional action (Undo, View) */
.ez-toast-action {
  flex-shrink: 0; height: 24px; margin-right: -6px; padding: 0 var(--sp-2); border-radius: var(--r-xs);
  border: 1px solid color-mix(in srgb, var(--bg) 35%, transparent); background: transparent; color: inherit;
  font: inherit; cursor: pointer; pointer-events: none;
}
.ez-toast.is-on .ez-toast-action { pointer-events: auto; }
.ez-toast-action:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
/* optional auto-dismiss bar: set --ez-count-ms to the timeout; .is-held pauses it */
.ez-toast-count {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; opacity: .5;
  transform-origin: left; animation: ez-count var(--ez-count-ms, 6s) linear forwards;
}
.ez-toast:is(.is-held, :focus-within) .ez-toast-count { animation-play-state: paused; }
@keyframes ez-count { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* phones: the save card is a bottom sheet; while it is open the generic toast sits above it.
 * --ez-savetoast-h can be set by the sheet; the fallback clears its usual height. */
@media (max-width: 720px) {
  .ez-toast { bottom: max(28px, calc(16px + env(safe-area-inset-bottom))); }
  .ezra-root:has(> .ez-savetoast.is-on) > .ez-toast, .ez-savetoast.is-on ~ .ez-toast {
    bottom: calc(var(--ez-savetoast-h, 200px) + 12px + env(safe-area-inset-bottom));
  }
}

/* ── Card shell ────────────────────────────────────────────────────────────── */
.ez-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.ez-card.is-flat { box-shadow: none; }
.ez-card-head { display: flex; align-items: flex-start; gap: 10px; padding: var(--sp-3) 14px 0; min-height: 40px; }
.ez-card-titles { flex: 1; min-width: 0; }
.ez-card-title { margin: 0; font-size: var(--fs-title); font-weight: 600; --ez-h: var(--bright); line-height: var(--lh-snug); }
.ez-card-sub { margin: 2px 0 0; font-size: var(--fs-13); color: var(--muted); line-height: var(--lh-snug); }
.ez-card-tools { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin: -4px -6px 0 0; }
.ez-card-ctrl { display: flex; align-items: center; gap: 6px; padding: 10px 14px 0; flex-wrap: wrap; }
.ez-card-body { position: relative; padding: var(--sp-2) 14px var(--sp-3); }
.ez-card-foot { display: flex; align-items: center; gap: 10px; padding: 0 14px var(--sp-3); font-size: var(--fs-11); color: var(--faint); flex-wrap: wrap; }
.ez-card-foot a { --ez-a: var(--faint); }
.ez-card-foot a:hover { --ez-a-hover: var(--muted); }
@media (max-width: 720px) {
  .ez-card-head { padding: 10px var(--sp-3) 0; }
  .ez-card-body { padding: var(--sp-2) 10px 10px; }
  .ez-card-ctrl { padding: var(--sp-2) var(--sp-3) 0; }
  .ez-card-foot { padding: 0 var(--sp-3) 10px; }
}

/* ── Sheet / dialog ────────────────────────────────────────────────────────── */
/* <dialog class="ez-sheet"> (showModal) or a fixed panel: centred on desktop, bottom sheet on phones. */
.ez-sheet {
  display: flex; flex-direction: column; z-index: var(--z-modal); padding: 0; overflow: hidden;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--card); color: var(--text); border: 1px solid var(--border2); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
}
dialog.ez-sheet { width: min(560px, calc(100vw - 32px)); margin: auto; }
dialog.ez-sheet:not([open]) { display: none; }
.ez-sheet::backdrop { background: var(--overlay); }
.ez-sheet-grab { display: none; flex-shrink: 0; width: 36px; height: 4px; margin: var(--sp-2) auto 0; border-radius: var(--r-full); background: var(--border2); }
@media (max-width: 720px) {
  .ez-sheet { border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.ez-sheet { width: 100%; max-width: none; margin: auto 0 0; max-height: 92vh; max-height: 92dvh; }
  .ez-sheet-grab { display: block; }
}

/* ── Empty, error, loading ─────────────────────────────────────────────────── */
.ez-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--muted); font-size: var(--fs-13); line-height: var(--lh-snug);
}
.ez-empty-state > svg { width: 24px; height: 24px; color: var(--faint); }
.ez-empty-state > p { margin: 0; max-width: 44ch; }
/* optional title line: <p><b>Title</b> sentence</p> */
.ez-empty-state > p > b { display: block; margin-bottom: 2px; font-weight: 600; color: var(--text); }
.ez-empty-state > .ez-btn { margin-top: var(--sp-2); }
/* error: icon + message (+ optional <button class="ez-btn is-sm">Try again</button>) */
.ez-error {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px var(--sp-3); border-radius: var(--r-sm);
  background: var(--bear-wash); border: 1px solid color-mix(in srgb, var(--bear) 25%, transparent); color: var(--bear-text); font-size: var(--fs-13);
}
.ez-error svg { flex-shrink: 0; margin-top: 2px; }
.ez-error > .ez-btn { margin-left: auto; align-self: center; }
/* errorState({actions}): the actions row sits under the sentence, lined up with it (icon 16px + 10px gap) */
.ez-error.has-acts { flex-wrap: wrap; }
.ez-error.has-acts > span + span { flex: 1 1 0; min-width: 0; }   /* the sentence keeps the icon's line */
.ez-error-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); flex-basis: 100%; padding-left: 26px; color: var(--text); }
/* the one inline error line (lib/states.js inlineError); old classes add layout only */
.ez-inline-err { margin: 0; font-size: var(--fs-13); line-height: var(--lh-snug); color: var(--bear-text); }
/* skeleton: block (height from --h) or text lines; one sweep keyframe */
.ez-skel {
  position: relative; overflow: hidden; border-radius: var(--r-sm); background: var(--skeleton); height: var(--h, 300px);
}
.ez-skel-lines { display: flex; flex-direction: column; gap: var(--sp-2); }
.ez-skel-line { position: relative; overflow: hidden; height: 12px; border-radius: var(--r-xs); background: var(--skeleton); }
.ez-skel-line.is-short { width: 60%; }
.ez-skel::after, .ez-skel-line::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent); animation: ez-sweep 1.4s infinite;
}
@keyframes ez-sweep { to { transform: translateX(100%); } }
/* spinner: one keyframe; under reduced motion it holds still as a three-quarter ring */
.ez-spinner {
  display: inline-block; flex-shrink: 0; width: 14px; height: 14px; border-radius: var(--r-full);
  border: 1.5px solid var(--p); border-top-color: transparent; animation: ez-spin .8s linear infinite;
}
@keyframes ez-spin { to { transform: rotate(360deg); } }
/* busy (lib/states.js busy()): still readable and the same size. The ring sits in the button's end padding,
 * after a text link, and in place of an icon. */
:is(.ez-btn, .ez-iconbtn)[aria-busy="true"], :is(.ez-btn, .ez-iconbtn)[aria-busy="true"]:disabled { opacity: 1; cursor: progress; }
:is(.ez-btn, .ez-iconbtn)[aria-busy="true"]::after {
  content: ''; position: absolute; top: 50%; right: 2px; box-sizing: border-box; width: 8px; height: 8px; margin-top: -4px; border-radius: var(--r-full);
  border: 1.5px solid currentColor; border-top-color: transparent; animation: ez-spin .8s linear infinite;
}
.ez-btn.is-link[aria-busy="true"]::after { right: auto; left: 100%; margin-left: var(--sp-1); }
.ez-iconbtn[aria-busy="true"]::after { right: auto; left: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.ez-iconbtn[aria-busy="true"] > * { opacity: 0; }

/* ── Small text pieces ─────────────────────────────────────────────────────── */
.ez-eyebrow {
  display: block; margin: 0; font-size: var(--fs-11); font-weight: 600; line-height: var(--lh-snug);
  letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--faint); --ez-h: var(--faint);
}
.ez-kbd {
  display: inline-block; min-width: 16px; padding: 1px var(--sp-1); border-radius: var(--r-xs);
  border: 1px solid var(--border2); background: var(--bg3); color: var(--muted);
  font: 500 var(--fs-11)/1.4 var(--mono); text-align: center; white-space: nowrap;
}

/* ── Live dot ──────────────────────────────────────────────────────────────── */
.ez-dot { display: inline-block; width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; flex-shrink: 0; }
.ez-dot[data-state="live"] { background: var(--live); box-shadow: 0 0 0 0 var(--bull-wash); animation: ez-pulse 2s infinite; }
.ez-dot[data-state="stale"] { background: var(--stale); }
.ez-dot[data-state="closed"], .ez-dot[data-state="asof"] { background: var(--closed); }
@keyframes ez-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bull) 55%, transparent); } 70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bull) 0%, transparent); } 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bull) 0%, transparent); } }

/* ── High contrast (Windows forced colours) ────────────────────────────────── */
/* Backgrounds and shadows are dropped, so selected / pressed / open states draw a system-colour edge instead. */
@media (forced-colors: active) {
  .ez-seg button:is([aria-pressed="true"], [aria-selected="true"], [aria-checked="true"], .is-active),
  :is(.ez-iconbtn, .ez-toggle):is([aria-pressed="true"], [aria-expanded="true"], .is-active),
  :is(button, a).ez-chip:is([aria-expanded="true"], [aria-pressed="true"], [aria-current]:not([aria-current="false"])),
  .ez-mi.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
  .ez-mi:hover:not(:disabled, [aria-disabled="true"]) { outline: 1px solid Highlight; outline-offset: -1px; }
  .ez-btn.is-primary { border-color: ButtonText; }
  .ez-toast { border: 1px solid CanvasText; }
  .ez-skel, .ez-skel-line { border: 1px solid GrayText; }
  .ez-dot { forced-color-adjust: none; }
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ez-btn, .ez-iconbtn, .ez-seg button, .ez-toggle, :where(button, a).ez-chip, .ez-input, .ez-select, .ez-mi, .ez-toast { transition: none !important; }
  .ez-toast, .ez-toast.is-on { transform: translateX(-50%); }
  .ez-pop, .ez-skel::after, .ez-skel-line::after, .ez-spinner, .ez-dot[data-state="live"], :is(.ez-btn, .ez-iconbtn)[aria-busy="true"]::after { animation: none !important; }
  .ez-toast-count { display: none; }
}
