/* Disclosure Gate base v4: reset, type, and the component library every surface shares.
   Components read only the semantic tokens in tokens.css. The export section is also inlined into
   static exports by voice/render/export-html.mjs, so it holds only what a file opened from disk needs. */

/* @section export */
*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute always wins over a component's display rule. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--sticky-offset, 0px);
  scrollbar-color: var(--border-strong) transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-weight: var(--weight-regular);
  font-synthesis: none;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--accent);
}

::selection { background: var(--selection-bg); color: var(--fg); }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
h1, h2, h3, h4 { font-weight: var(--weight-semibold); text-wrap: balance; }
p { text-wrap: pretty; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
del, s { text-decoration-thickness: 1px; }
abbr[title] { text-decoration: underline dotted; }
hr { margin: 0; border: 0; border-top: 1px solid var(--border); }

.t-display { font-size: var(--text-display); line-height: 1.05; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); }
.t-h1 { font-size: var(--text-3xl); line-height: var(--leading-3xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tighter); }
.t-h2 { font-size: var(--text-lg); line-height: var(--leading-lg); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.t-h3 { font-size: var(--text-base); line-height: var(--leading-base); font-weight: var(--weight-semibold); }
.t-body { font-size: var(--text-base); line-height: var(--leading-base); }
.t-small { font-size: var(--text-sm); line-height: var(--leading-sm); }
.t-meta { font-size: var(--text-xs); line-height: var(--leading-xs); font-variant-numeric: var(--figures-data); }
.t-caps { font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.t-data, .num { font-variant-numeric: var(--figures-data); }
.t-mono, .t-hash { font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--leading-xs); font-variant-numeric: var(--figures-data); letter-spacing: 0; }
.t-hash { word-break: break-all; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.nowrap { white-space: nowrap; }

a { color: var(--accent-fg); text-decoration-line: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-offset); border-radius: var(--radius-xs); }
:is(h1, h2, h3, h4, p, section, main, div, article, ul, ol)[tabindex="-1"]:focus { outline: none; }

.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.icon { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; vertical-align: middle; }
.icon--12 { width: 12px; height: 12px; }
.icon--14 { width: 14px; height: 14px; }
.icon--16 { width: 16px; height: 16px; }
.icon--20 { width: 20px; height: 20px; }
.icon--24 { width: 24px; height: 24px; }
.icon--32 { width: 32px; height: 32px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Pills: status and state words. A pill always carries its word; the tone only reinforces it. */
.chip, .stamp, .badge {
  --pill-fg: var(--neutral-fg);
  --pill-bg: var(--neutral-bg);
  --pill-border: var(--neutral-border);
  --pill-mark: var(--neutral-mark);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-full);
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-medium);
  font-variant-numeric: var(--figures-data);
  white-space: nowrap;
  vertical-align: middle;
}
.chip .icon, .stamp .icon, .badge .icon { width: 12px; height: 12px; stroke-width: 1.75; }
.chip--live, .stamp--live, .badge--live { --pill-fg: var(--live-fg); --pill-bg: var(--live-bg); --pill-border: var(--live-border); --pill-mark: var(--live-mark); }
.chip--interrupted, .chip--attention, .badge--attention { --pill-fg: var(--attention-fg); --pill-bg: var(--attention-bg); --pill-border: var(--attention-border); --pill-mark: var(--attention-mark); }
.chip--paused, .chip--advisory, .badge--advisory { --pill-fg: var(--advisory-fg); --pill-bg: var(--advisory-bg); --pill-border: var(--advisory-border); --pill-mark: var(--advisory-mark); }
.chip--final, .chip--ok, .stamp--final, .stamp--checked, .badge--ok { --pill-fg: var(--ok-fg); --pill-bg: var(--ok-bg); --pill-border: var(--ok-border); --pill-mark: var(--ok-mark); }
.chip--updated, .badge--accent { --pill-fg: var(--accent-fg); --pill-bg: var(--accent-bg); --pill-border: var(--accent-border); --pill-mark: var(--accent); }
.chip--decision, .badge--decision { --pill-fg: var(--decision-fg); --pill-bg: var(--decision-bg); --pill-border: var(--decision-border); --pill-mark: var(--decision-mark); }
.chip--draft { --pill-bg: transparent; --pill-border: var(--border-strong); --pill-fg: var(--fg-muted); }
.chip--ended, .chip--neutral { --pill-fg: var(--neutral-fg); }
.stamp--withdrawn { --pill-fg: var(--fg-muted); text-decoration: line-through; }
.stamp--update { --pill-bg: transparent; --pill-border: var(--border-strong); --pill-fg: var(--fg-muted); }
.chip--kind { border-radius: var(--radius-sm); }
.pill-dot, .chip--live::before, .stamp--live::before {
  width: 6px; height: 6px; flex: none;
  border-radius: 50%;
  background: var(--pill-mark);
}
.chip--live::before, .stamp--live::before { content: ""; }
.chip--live > .icon, .stamp--live > .icon { display: none; }
/* @endsection */

/* ---------------------------------------------------------------- skip links (every page) */
.skip-links { position: absolute; top: 0; left: 0; z-index: 100; }
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--fill-strong);
  color: var(--on-fill-strong);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
  transform: translateY(-200%);
}
.skip-link:focus, .skip-link:focus-visible { transform: none; }

/* ---------------------------------------------------------------- layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-3)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-2)); }
.spacer { flex: 1 1 auto; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }
.rule--strong { border-top-color: var(--border-strong); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--bg-surface);
  --btn-fg: var(--fg);
  --btn-border: var(--border-strong);
  --btn-hover: var(--bg-hover);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  min-height: var(--target-control);
  padding: 0 var(--space-3);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--shadow-xs), var(--ring-highlight);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  font-weight: var(--weight-medium);
  letter-spacing: -0.003em;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(0.5px) scale(0.99); }
.btn:focus-visible { border-radius: var(--radius-md); }
.btn .icon { width: 16px; height: 16px; margin-inline-start: -2px; }
.btn--primary { --btn-bg: var(--fill-strong); --btn-fg: var(--on-fill-strong); --btn-border: var(--fill-strong); --btn-hover: var(--fill-strong-hover); box-shadow: var(--shadow-sm); }
.btn--accent { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-border: var(--accent); --btn-hover: var(--accent-hover); box-shadow: var(--shadow-sm); }
.btn--danger { --btn-bg: var(--attention-mark); --btn-fg: #ffffff; --btn-border: var(--attention-mark); --btn-hover: color-mix(in srgb, var(--attention-mark) 88%, #000000); box-shadow: var(--shadow-sm); }
.btn--danger-quiet { --btn-bg: transparent; --btn-fg: var(--attention-fg); --btn-border: transparent; --btn-hover: var(--attention-bg); box-shadow: none; }
.btn--record { --btn-bg: var(--live-mark); --btn-fg: #ffffff; --btn-border: var(--live-mark); --btn-hover: color-mix(in srgb, var(--live-mark) 88%, #000000); box-shadow: var(--shadow-sm); }
.btn--secondary { --btn-bg: var(--bg-surface); }
.btn--quiet { --btn-bg: transparent; --btn-border: transparent; box-shadow: none; padding-inline: var(--space-2); color: var(--fg-muted); }
.btn--quiet:hover { color: var(--fg); }
.btn--small { min-height: 28px; padding: 0 var(--space-2-5); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn--small.btn--quiet { padding-inline: var(--space-2); }
.btn--large { min-height: 40px; padding: 0 var(--space-4); font-size: var(--text-base); border-radius: var(--radius-md); }
.btn--xl { min-height: 48px; padding: 0 var(--space-5); font-size: var(--text-md); border-radius: var(--radius-lg); }
.btn--icon { padding: 0; width: var(--target-control); }
.btn--icon .icon { margin: 0; }
.btn--icon.btn--small { width: 28px; }
.btn--block { display: flex; width: 100%; }
.btn[aria-busy="true"] { cursor: progress; color: transparent; }
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  border-radius: 50%;
  animation: dg-spin 0.7s linear infinite;
}
.btn:disabled, .btn[aria-disabled="true"] {
  --btn-bg: var(--bg-sunk);
  --btn-fg: var(--fg-disabled);
  --btn-border: var(--border);
  --btn-hover: var(--bg-sunk);
  box-shadow: none;
  cursor: not-allowed;
}
.btn--quiet:disabled { --btn-bg: transparent; --btn-border: transparent; }
.btn .kbd { margin-inline-start: var(--space-1); }
.btn--primary .kbd { background: rgb(255 255 255 / 0.14); border-color: rgb(255 255 255 / 0.2); color: inherit; }

/* The claim button on the Hub: a primary action with a little more weight. */
.btn--claim { --btn-bg: var(--fill-strong); --btn-fg: var(--on-fill-strong); --btn-border: var(--fill-strong); --btn-hover: var(--fill-strong-hover); box-shadow: var(--shadow-sm); }
.btn--claim[aria-pressed="true"] { --btn-bg: var(--ok-mark); --btn-border: var(--ok-mark); --btn-fg: #ffffff; }

/* A toggle built by dom.mjs toggleButton(): a switch track with a knob, plus aria-pressed. */
.toggle { gap: var(--space-2); }
.toggle-box {
  position: relative;
  width: 28px; height: 16px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background-color var(--dur-base) var(--ease-standard);
}
.toggle-box .icon { display: none; }
.toggle-box::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform var(--dur-base) var(--ease-out);
}
.toggle[aria-pressed="true"] .toggle-box { background: var(--accent); }
.toggle[aria-pressed="true"] .toggle-box::after { transform: translateX(12px); }

/* ---------------------------------------------------------------- state pills (work tokens) */
.flap, .state-pill {
  --pill-fg: var(--neutral-fg);
  --pill-bg: var(--neutral-bg);
  --pill-border: var(--neutral-border);
  --pill-mark: var(--neutral-mark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 8px 0 7px;
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-full);
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  vertical-align: middle;
}
.flap::before, .state-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pill-mark); flex: none; }
.flap:empty { display: none; }
.flap--ok, .state-pill--ok { --pill-fg: var(--ok-fg); --pill-bg: var(--ok-bg); --pill-border: var(--ok-border); --pill-mark: var(--ok-mark); }
.flap--attention, .state-pill--attention { --pill-fg: var(--attention-fg); --pill-bg: var(--attention-bg); --pill-border: var(--attention-border); --pill-mark: var(--attention-mark); }
.flap--advisory, .state-pill--advisory { --pill-fg: var(--advisory-fg); --pill-bg: var(--advisory-bg); --pill-border: var(--advisory-border); --pill-mark: var(--advisory-mark); }
.flap--accent, .state-pill--accent { --pill-fg: var(--accent-fg); --pill-bg: var(--accent-bg); --pill-border: var(--accent-border); --pill-mark: var(--accent); }
.flap--large { min-height: 26px; padding-inline: 10px 11px; font-size: var(--text-sm); }
/* Work states by key: open is an outline, waiting and claimed are amber, assigned and yours are blue,
   done is green, blocked is red, carried and withdrawn stay grey. */
.flap[data-key="open"], .flap[data-key="released"] { --pill-bg: transparent; --pill-border: var(--border-strong); --pill-fg: var(--fg-muted); --pill-mark: transparent; }
.flap[data-key="open"]::before, .flap[data-key="released"]::before { box-shadow: inset 0 0 0 1.5px var(--neutral-mark); }
.flap[data-key="waiting"], .flap[data-key="claimed"] { --pill-fg: var(--advisory-fg); --pill-bg: var(--advisory-bg); --pill-border: var(--advisory-border); --pill-mark: var(--advisory-mark); }
.flap[data-key="assigned"], .flap[data-key="yours"] { --pill-fg: var(--accent-fg); --pill-bg: var(--accent-bg); --pill-border: var(--accent-border); --pill-mark: var(--accent); }
.flap[data-key="done"] { --pill-fg: var(--ok-fg); --pill-bg: var(--ok-bg); --pill-border: var(--ok-border); --pill-mark: var(--ok-mark); }
.flap[data-key="blocked"] { --pill-fg: var(--attention-fg); --pill-bg: var(--attention-bg); --pill-border: var(--attention-border); --pill-mark: var(--attention-mark); }
.flap[data-key="withdrawn"], .flap[data-key="carried"], .flap[data-key="void"] { --pill-fg: var(--fg-subtle); --pill-bg: transparent; --pill-border: var(--border); }

/* The Update counter: a label and a number that turns (motion.css). */
.flip-counter { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); line-height: var(--leading-sm); color: var(--fg-muted); white-space: nowrap; }
.flip-counter__label { color: var(--fg-muted); }
.flip-counter__digit {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--fg);
  font-weight: var(--weight-semibold);
  font-variant-numeric: var(--figures-data);
  overflow: hidden;
}

/* ---------------------------------------------------------------- banners and callouts */
.banner {
  --banner-bg: var(--bg-surface);
  --banner-fg: var(--fg);
  --banner-border: var(--border);
  --banner-mark: var(--fg-muted);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--banner-border);
  border-radius: var(--radius-lg);
  background: var(--banner-bg);
  color: var(--fg);
  box-shadow: var(--shadow-xs);
}
.banner__icon { color: var(--banner-mark); width: 18px; height: 18px; align-self: start; margin-top: 1px; }
.banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.banner__title { font-weight: var(--weight-semibold); color: var(--fg); }
.banner__text, .banner__body > p:not(.banner__title) { color: var(--fg-muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.banner__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: flex-end; }
.banner--attention { --banner-bg: var(--attention-bg); --banner-border: var(--attention-border); --banner-mark: var(--attention-mark); }
.banner--live { --banner-bg: var(--live-bg); --banner-border: var(--live-border); --banner-mark: var(--live-mark); }
.banner--advisory { --banner-bg: var(--advisory-bg); --banner-border: var(--advisory-border); --banner-mark: var(--advisory-mark); }
.banner--ok { --banner-bg: var(--ok-bg); --banner-border: var(--ok-border); --banner-mark: var(--ok-mark); }
.banner--neutral { --banner-bg: var(--bg-surface); --banner-border: var(--border); --banner-mark: var(--fg-muted); }
/* Private: checked words that are still only on this computer (waiting for release). */
.banner--private { --banner-bg: var(--private-bg); --banner-border: var(--border-strong); --banner-mark: var(--private-mark); }
.banner-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.banner-stack:empty { display: none; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.table { position: relative; width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); line-height: var(--leading-sm); }
.table caption { text-align: left; font-weight: var(--weight-semibold); padding: var(--space-3) var(--space-4); }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table thead th { position: sticky; top: 0; z-index: 1; padding-block: var(--space-2-5); background: var(--bg-sunk); color: var(--fg-muted); font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); }
.table thead th:last-child { border-top-right-radius: calc(var(--radius-lg) - 1px); }
.table tbody th { font-weight: var(--weight-medium); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: var(--figures-data); }
.table tbody tr { transition: background-color var(--dur-fast) var(--ease-standard); }
.table tbody tr:hover { background: var(--bg-hover); }
.table--ledger tbody th { font-weight: var(--weight-medium); }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-divided { list-style: none; margin: 0; padding: 0; }
.list-divided > li { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.list-divided > li:first-child { border-top: 0; }
.list-inline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: var(--space-1-5); min-width: 0; }
.field__label { font-size: var(--text-sm); line-height: var(--leading-sm); font-weight: var(--weight-medium); color: var(--fg); }
.field__hint { color: var(--fg-muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.field__error { display: flex; gap: var(--space-1); align-items: flex-start; color: var(--attention-fg); font-size: var(--text-sm); line-height: var(--leading-sm); }
.field__error .icon { margin-top: 1px; }
.field-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
fieldset, .fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); margin-bottom: var(--space-2); }

.input, .select, .textarea, .select-inline {
  width: 100%;
  min-height: var(--target-control);
  padding: 0 var(--space-2-5);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--fg);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.input:hover, .select:hover, .textarea:hover, .select-inline:hover { border-color: var(--fg-subtle); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible, .select-inline:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.textarea { min-height: 76px; padding-block: var(--space-2); resize: vertical; line-height: var(--leading-base); }
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); opacity: 1; }
.input[type="search"] {
  padding-inline-start: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238b8b95' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='5.25'/%3E%3Cpath d='M13 13l3.5 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 9px center;
  background-size: 16px 16px;
}
.select, .select-inline {
  appearance: none;
  padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238b8b95' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 8.25L10 11.75l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
  cursor: pointer;
}
.select-inline { width: auto; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--attention-mark); }
.input:disabled, .select:disabled, .textarea:disabled { background-color: var(--bg-sunk); color: var(--fg-disabled); box-shadow: none; cursor: not-allowed; }
.input[readonly] { background-color: var(--bg-sunk); }

/* Check rows: a checkbox or radio with its label. */
.check { display: inline-flex; align-items: flex-start; gap: var(--space-2); min-height: var(--target-min); max-width: 100%; cursor: pointer; }
.check-hint { display: block; color: var(--fg-muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.check input[type="checkbox"], .check input[type="radio"] {
  appearance: none;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  margin: 2px 0 0;
  border: 1px solid var(--border-control);
  border-radius: 4px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--fill-strong); border-color: var(--fill-strong); }
.check input[type="checkbox"]:checked::after {
  content: "";
  width: 10px; height: 10px;
  background: var(--on-fill-strong);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
}
.check input[type="radio"]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--on-fill-strong); }
.check input:disabled { background: var(--bg-sunk); border-color: var(--border); cursor: not-allowed; }
.check input:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 2px; }

/* A switch: a checkbox that turns something on or off (label it with what is on). */
.check.switch input[type="checkbox"] { position: relative; width: 30px; height: 18px; margin-top: 1px; border-radius: var(--radius-full); background: var(--border-strong); border-color: transparent; box-shadow: none; }
.check.switch input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); clip-path: none; transition: transform var(--dur-base) var(--ease-out); }
.check.switch input[type="checkbox"]:checked { background: var(--ok-mark); border-color: transparent; }
.check.switch input[type="checkbox"]:checked::after { transform: translateX(12px); width: 14px; height: 14px; background: #ffffff; clip-path: none; }

/* Segmented control: a row of buttons for a small set of views or filters. */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--bg-sunk); border: 1px solid var(--border); }
.segmented > button, .segmented > a {
  display: inline-flex; align-items: center; gap: var(--space-1-5);
  min-height: 26px; padding: 0 var(--space-2-5);
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-muted);
  font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap;
}
.segmented > button:hover, .segmented > a:hover { color: var(--fg); }
.segmented > [aria-pressed="true"], .segmented > [aria-selected="true"], .segmented > [aria-current="true"], .segmented > [aria-current="page"] { background: var(--bg-surface); color: var(--fg); box-shadow: var(--shadow-sm); }
.segmented .count { color: var(--fg-subtle); font-variant-numeric: var(--figures-data); }

/* ---------------------------------------------------------------- level meters */
meter.level {
  display: block;
  width: 64px;
  height: 6px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--bg-active);
}
meter.level::-webkit-meter-bar { height: 6px; border: 0; border-radius: var(--radius-full); background: var(--bg-active); }
meter.level::-webkit-meter-optimum-value { border-radius: var(--radius-full); background: var(--ok-mark); transition: inline-size 90ms linear; }
meter.level::-webkit-meter-suboptimum-value { border-radius: var(--radius-full); background: var(--advisory-mark); }
meter.level::-webkit-meter-even-less-good-value { border-radius: var(--radius-full); background: var(--attention-mark); }
meter.level::-moz-meter-bar { border-radius: var(--radius-full); background: var(--ok-mark); }
.level-bar { position: relative; height: 6px; border-radius: var(--radius-full); background: var(--bg-active); overflow: hidden; }
.level-bar > span { position: absolute; inset: 0 auto 0 0; width: calc(var(--level, 0) * 100%); border-radius: inherit; background: var(--ok-mark); transition: width 90ms linear; }

/* ---------------------------------------------------------------- containers */
.panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs), var(--ring-highlight); }
.card--interactive { transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard); }
.card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.well { background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius-md); }
.sheet { background: var(--bg-surface); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.side-panel { width: 100%; max-width: 280px; display: flex; flex-direction: column; gap: var(--space-3); }
.side-panel .btn { width: 100%; }

/* Custody label: says where the words live. Private is the dark mark with the lock; shared is the
   green mark with the eye. The context sets the tone when the label does not. */
.custody-label {
  --cl-fg: var(--fg-muted);
  --cl-bg: var(--bg-sunk);
  --cl-border: var(--border);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 8px 0 6px;
  border: 1px solid var(--cl-border);
  border-radius: var(--radius-full);
  background: var(--cl-bg);
  color: var(--cl-fg);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.custody-label .icon { width: 12px; height: 12px; stroke-width: 1.75; }
[data-custody="private"] .custody-label { --cl-fg: var(--private-mark-fg); --cl-bg: var(--private-mark); --cl-border: var(--private-mark); }
[data-custody="shared"] .custody-label { --cl-fg: var(--ok-fg); --cl-bg: var(--ok-bg); --cl-border: var(--ok-border); }
/* An explicit tone beats the context: a private note inside the shared pane stays private. */
.custody-label.custody-label--private { --cl-fg: var(--private-mark-fg); --cl-bg: var(--private-mark); --cl-border: var(--private-mark); }
.custody-label.custody-label--shared { --cl-fg: var(--ok-fg); --cl-bg: var(--ok-bg); --cl-border: var(--ok-border); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  min-height: 36px;
  padding: 0 1px;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  text-decoration: none;
}
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color var(--dur-base) var(--ease-standard); }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--fg); }
.tab[aria-selected="true"]::after, .tab[aria-current="page"]::after { background: var(--fg); }
.tab .num, .tab .count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  color: var(--fg-muted);
  font-size: var(--text-xs); line-height: 1; font-weight: var(--weight-semibold);
}
.tab[aria-selected="true"] .num, .tab[aria-selected="true"] .count { background: var(--fill-strong); color: var(--on-fill-strong); }
.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------- dialogs */
dialog.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 64px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-raised);
  color: var(--fg);
  box-shadow: var(--shadow-xl);
  overflow: auto;
}
dialog.dialog[open] { animation: dg-dialog-in var(--dur-slow) var(--ease-out); }
dialog.dialog::backdrop { background: var(--bg-scrim); backdrop-filter: blur(2px); animation: dg-fade-in var(--dur-base) var(--ease-standard); }
.dialog-inner { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); }
.dialog-title { font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.dialog-body { display: flex; flex-direction: column; gap: var(--space-2); color: var(--fg-muted); }
.dialog-note { color: var(--fg-muted); font-size: var(--text-sm); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-2); }

/* ---------------------------------------------------------------- small parts */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  color: var(--fg-muted);
  font-family: var(--font-ui);
  font-size: var(--text-xs); line-height: 1; font-weight: var(--weight-medium);
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-mark); flex: none; }
.dot--live { background: var(--live-mark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live-mark) 22%, transparent); }
.dot--ok { background: var(--ok-mark); }
.dot--advisory { background: var(--advisory-mark); }
.dot--attention { background: var(--attention-mark); }
.dot--pulse { animation: dg-pulse 1.6s var(--ease-standard) infinite; }

.avatar {
  --avatar-hue: 220;
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  flex: none;
  border-radius: 50%;
  background: light-dark(hsl(var(--avatar-hue) 70% 94%), hsl(var(--avatar-hue) 40% 22%));
  color: light-dark(hsl(var(--avatar-hue) 55% 30%), hsl(var(--avatar-hue) 80% 84%));
  /* Initials are decoration beside the name (the avatar is aria-hidden): the one place under the 12 px floor. */
  font-size: 10px; line-height: 1; font-weight: var(--weight-semibold); letter-spacing: 0;
  box-shadow: inset 0 0 0 1px light-dark(hsl(var(--avatar-hue) 50% 86%), hsl(var(--avatar-hue) 40% 30%));
  user-select: none;
}
.avatar--lg { width: 32px; height: 32px; font-size: 12px; }
.avatar--h0 { --avatar-hue: 220; } .avatar--h1 { --avatar-hue: 262; } .avatar--h2 { --avatar-hue: 330; } .avatar--h3 { --avatar-hue: 16; }
.avatar--h4 { --avatar-hue: 38; } .avatar--h5 { --avatar-hue: 152; } .avatar--h6 { --avatar-hue: 188; } .avatar--h7 { --avatar-hue: 290; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--fg-muted); border-radius: 50%; animation: dg-spin 0.8s linear infinite; flex: none; }
.skeleton { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-active); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, light-dark(rgb(255 255 255 / 0.6), rgb(255 255 255 / 0.05)), transparent); animation: dg-shimmer 1.4s var(--ease-standard) infinite; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}
.empty-state > .icon, .empty-state__icon {
  width: 40px; height: 40px; padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-sunk);
  color: var(--fg-muted);
  box-shadow: inset 0 0 0 1px var(--border);
  margin-bottom: var(--space-2);
}
.empty-state h2, .empty-state h3 { font-size: var(--text-base); line-height: var(--leading-base); font-weight: var(--weight-semibold); }
.empty-state p { max-width: 46ch; color: var(--fg-muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.empty-state .btn { margin-top: var(--space-3); }
.empty-state .cluster { justify-content: center; margin-top: var(--space-3); }
.empty-state .cluster .btn { margin-top: 0; }
.empty-line, .loading-line { color: var(--fg-muted); font-size: var(--text-sm); }

/* Plain statements: the fixed privacy and notice sentences, set quietly beside what they govern. */
.statement, .statement-block {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
}
.statement-block { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-sunk); flex-direction: column; gap: var(--space-1); }
/* Statements carry long paths (%LOCALAPPDATA%...): they wrap anywhere rather than widen the page. */
.statement, .statement-block { overflow-wrap: anywhere; }
.statement-title { color: var(--fg); font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.statement .icon { margin-top: 1px; color: var(--fg-subtle); }

/* Toasts: a visual echo of the live-region announcements, bottom right, stacked. */
.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  inset: auto var(--space-4) var(--space-4) auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  padding: var(--space-2-5) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-inverse);
  color: var(--fg-inverse);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  pointer-events: auto;
  animation: dg-toast-in var(--dur-slow) var(--ease-out);
}
.toast .icon { color: inherit; opacity: 0.8; }
.toast--attention { background: var(--attention-mark); color: #ffffff; }
.toast.is-leaving { animation: dg-toast-out var(--dur-base) var(--ease-in) forwards; }

/* Reduced motion: changes are instant and every state still reads statically. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .btn:active:not(:disabled) { transform: none; }
  .skeleton::after { display: none; }
}

/* Windows contrast themes: pills, banners and panels keep a visible border and their words. */
@media (forced-colors: active) {
  .chip, .stamp, .badge, .flap, .state-pill, .banner, .card, .panel, .well, .sheet, .custody-label, .segmented, .table-wrap, .kbd { border-color: CanvasText; }
  .flap::before, .state-pill::before, .pill-dot, .dot, .chip--live::before, .stamp--live::before { forced-color-adjust: none; background: CanvasText; }
  .tab::after { background: Canvas; }
  .tab[aria-selected="true"]::after, .tab[aria-current="page"]::after { background: Highlight; height: 3px; }
  .btn { border-color: ButtonText; }
  .btn:disabled { color: GrayText; border-color: GrayText; }
  .btn--claim[aria-pressed="true"] { background: Highlight; color: HighlightText; }
  .toggle-box { forced-color-adjust: none; background: GrayText; }
  .toggle[aria-pressed="true"] .toggle-box { background: Highlight; }
  .level-bar > span { background: Highlight; }
  .check input { forced-color-adjust: auto; appearance: auto; }
  .check input::after { display: none; }
  .icon { forced-color-adjust: auto; }
  .avatar { forced-color-adjust: none; background: Canvas; color: CanvasText; box-shadow: inset 0 0 0 1px CanvasText; }
  /* The custody labels keep their words in the user's colours: the lock or the eye says which side. */
  .custody-label, .custody-label.custody-label--private, .custody-label.custody-label--shared { forced-color-adjust: none; background: Canvas; color: CanvasText; border-color: CanvasText; }
  .toast { border: 1px solid CanvasText; }
}
