/* ==========================================================================
   Reusable components
   One block per component in assets/js/components/. Class names are the
   contract between the JS component and this file — keep them in step.
   ========================================================================== */

/* ------------------------------------------------------------------- Logo */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--primary-bright), var(--primary-strong));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 10px -4px rgba(var(--primary-rgb), 0.6);
  color: var(--white);
  flex: 0 0 auto;
}
.logo__mark svg { width: 15px; height: 15px; }

.logo__word {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-main);
  white-space: nowrap;
}
.logo--lg .logo__mark { width: 32px; height: 32px; border-radius: var(--radius-md); }
.logo--lg .logo__mark svg { width: 18px; height: 18px; }
.logo--lg .logo__word { font-size: 16px; }

.logo--on-brand .logo__mark { background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.logo--on-brand .logo__word { color: var(--white); }

/* ------------------------------------------------------------- IconButton */
.iconbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  flex: 0 0 auto;
}
.iconbtn:hover { background: var(--hover-bg); color: var(--text-main); text-decoration: none; }
.iconbtn svg { width: 16px; height: 16px; }

.iconbtn--ghost { width: 28px; height: 28px; color: var(--text-light); }

.iconbtn--corner {
  width: 28px;
  height: 28px;
  background: var(--brand-050);
  color: var(--brand-700);
}
.iconbtn--corner:hover { background: var(--brand-100); color: var(--brand-700); }
.iconbtn--corner svg { width: 14px; height: 14px; }

.iconbtn__dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--alert-dot);
  box-shadow: 0 0 0 2px var(--appbar-bg);
}

/* ----------------------------------------------------------------- Avatar */
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar--xs { width: 24px; height: 24px; font-size: 9.5px; }
.avatar--sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar--md { width: 34px; height: 34px; font-size: 12px; }
.avatar--lg { width: 42px; height: 42px; font-size: 14px; }

.avatar--ring { box-shadow: 0 0 0 2px var(--surface); }

/* deterministic tints so a given driver always looks the same */
.avatar[data-tint="0"] { background: rgba(var(--tint-0), var(--tint-alpha)); color: var(--tint-0-fg); }
.avatar[data-tint="1"] { background: rgba(var(--tint-1), var(--tint-alpha)); color: var(--tint-1-fg); }
.avatar[data-tint="2"] { background: rgba(var(--tint-2), var(--tint-alpha)); color: var(--tint-2-fg); }
.avatar[data-tint="3"] { background: rgba(var(--tint-3), var(--tint-alpha)); color: var(--tint-3-fg); }
.avatar[data-tint="4"] { background: rgba(var(--tint-4), var(--tint-alpha)); color: var(--tint-4-fg); }
.avatar[data-tint="5"] { background: rgba(var(--tint-5), var(--tint-alpha)); color: var(--tint-5-fg); }

/* ------------------------------------------------------------ AvatarStack */
.avstack { display: flex; align-items: center; }
.avstack .avatar { margin-right: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avstack .avatar:last-of-type { margin-right: 0; }
.avstack__more {
  margin-left: 14px;
}

/* ------------------------------------------------------------------ Badge
   A flat tinted chip: a ~13%-alpha fill under the tone's own label. No
   border, no dot. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge svg { width: 10px; height: 10px; flex: 0 0 auto; }
.badge--good { background: var(--good-bg); color: var(--good-fg); }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge--serious { background: var(--serious-bg); color: var(--serious-fg); }
.badge--info { background: var(--info-bg); color: var(--info-fg); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ----------------------------------------------------------------- Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.btn--block { width: 100%; }
.btn--lg { padding: 9px 18px; font-size: 14px; }
.btn--sm { padding: 4px 10px; font-size: 12px; }

/* The one solid: the brand green, lit along its top edge, with a soft glow of
   its own colour under it. */
.btn--primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--white);
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(0, 0, 0, 0.25),
    0 6px 14px -6px rgba(var(--primary-rgb), 0.6);
}
.btn--primary:hover {
  background: linear-gradient(180deg, #10A874 0%, #0C9265 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(0, 0, 0, 0.25),
    0 8px 18px -6px rgba(var(--primary-rgb), 0.75);
}

.btn--dark { background: var(--inverse-bg); color: var(--inverse-fg); font-weight: 600; }

.btn--soft { background: var(--brand-050); color: var(--brand-700); }
.btn--soft:hover { background: var(--brand-100); }

.btn--outline {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: var(--sh-sm);
}
.btn--outline:hover { border-color: var(--ink-300); }

.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--hover-bg); color: var(--text-main); }

.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn__spinner {
  width: 14px;
  height: 14px;
  border-radius: var(--r-pill);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- Card */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-5);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-md), var(--sh-inset-card);
}
.card--flush { padding: 0; gap: 0; }
.card--tight { padding: var(--s-4); gap: var(--s-3); }
.card--glass { background: var(--surface); }

.card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 30px;
}
.card__head .u-spacer { flex: 1 1 auto; }
.card__title { font-size: var(--t-card-title-size); font-weight: var(--t-card-title-weight);
  letter-spacing: var(--t-card-title-track); color: var(--ink-900); }
.card__sub { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }
.card__body { display: flex; flex-direction: column; gap: var(--s-3); }
.card__divider { height: 1px; background: var(--ink-150); margin: var(--s-1) 0; }

/* --------------------------------------------------------------- StatTile
   A KPI card: the plain card surface, a dot in the accent of the tile before
   the label, and a faint wash of the same colour falling into one corner. */
.stattile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(190px 110px at 100% 0%, color-mix(in srgb, var(--tile-accent, transparent) 16%, transparent), transparent 72%),
    var(--surface);
  box-shadow: var(--sh-md), var(--sh-inset-card);
  min-width: 0;
  transition: box-shadow var(--dur) var(--ease);
}
.stattile:hover { box-shadow: var(--sh-md), inset 0 0 0 1px var(--border-strong); }
.stattile__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stattile__label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--tile-accent, var(--ink-300));
  vertical-align: 1px;
}
.stattile__value {
  font-size: var(--t-stat-size);
  font-weight: var(--t-stat-weight);
  letter-spacing: var(--t-stat-track);
  color: var(--ink-900);
  line-height: 1.2;
}
.stattile__value small { font-size: 0.58em; font-weight: 500; letter-spacing: 0; color: var(--text-light); }
.stattile__foot { display: flex; align-items: center; gap: 5px; font-size: var(--t-label-size);
  font-weight: 400; color: var(--text-light); }
.stattile__foot svg { width: 11px; height: 11px; }

.stattile--mint { --tile-accent: var(--tile-mint); }
.stattile--sage { --tile-accent: var(--tile-sage); }
.stattile--teal { --tile-accent: var(--tile-teal); }
.stattile--peach { --tile-accent: var(--tile-peach); }
.stattile--lime { --tile-accent: var(--tile-lime); }

/* ------------------------------------------------------- Chip / Dropdown */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--border-color);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}
.chip svg { width: 13px; height: 13px; color: var(--text-light); flex: 0 0 auto; }
.chip:hover { box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-main); }
.chip[aria-pressed="true"],
.chip--active {
  background: var(--brand-050);
  color: var(--brand-700);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.35);
}
.chip[aria-pressed="true"] svg,
.chip--active svg { color: currentColor; }
.chip--sunken { background: var(--surface-sunken); }

.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 152px;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--surface-raised);
  box-shadow: var(--sh-lg);
  display: none;
}
.dropdown[data-open="true"] .dropdown__menu { display: block; }
.dropdown__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: var(--t-cell-size);
  font-weight: 400;
  color: var(--ink-600);
  text-align: left;
}
.dropdown__option:hover { background: var(--hover-bg); color: var(--ink-900); }
.dropdown__option[aria-selected="true"] { background: var(--brand-050); color: var(--brand-700); font-weight: 600; }
.dropdown__check { width: 14px; height: 14px; opacity: 0; }
.dropdown__option[aria-selected="true"] .dropdown__check { opacity: 1; }

/* An ACTION menu, not a value picker: nothing is ever "selected", so the
   leading glyph names the action instead of standing in for a tick, and it is
   always visible. Two lines per row — the label is the action, the hint is
   what it will actually cover, which changes as the page is filtered. */
.dropdown__menu--actions { min-width: 268px; padding: 7px; }
.dropdown__menu--actions .dropdown__option { align-items: flex-start; padding: 9px 10px; }
.dropdown__menu--actions .dropdown__check {
  opacity: 1;
  margin-top: 2px;
  color: var(--brand-600);
  flex: 0 0 auto;
}
.dropdown__menu--actions .dropdown__option:hover .dropdown__check { color: var(--brand-700); }
.exportmenu__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.exportmenu__label { font-weight: 600; color: var(--ink-800); }
.dropdown__option:hover .exportmenu__label { color: var(--ink-900); }
.exportmenu__hint {
  font-size: var(--t-label-size);
  font-weight: 400;
  color: var(--ink-400);
}
.exportmenu__hint:empty { display: none; }

/* ------------------------------------------------------------------ Field */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-size: var(--t-cell-size);
  font-weight: 600;
  color: var(--ink-700);
  letter-spacing: -0.005em;
}
.field__wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--ink-150);
  transition: box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.field__wrap:focus-within {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--brand-600), var(--ring-brand);
}
.field__icon { color: var(--ink-400); flex: 0 0 auto; }
.field__icon svg { width: 17px; height: 17px; }
.field__wrap:focus-within .field__icon { color: var(--brand-600); }
.field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-900);
}
.field__input::placeholder { color: var(--ink-300); font-weight: 400; }
.field__action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  color: var(--ink-400);
  flex: 0 0 auto;
}
.field__action:hover { color: var(--brand-600); background: var(--brand-050); }
.field__action svg { width: 16px; height: 16px; }
.field__hint { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }
.field__error { font-size: var(--t-label-size); font-weight: 600; color: var(--serious-fg); display: none; }
.field[data-invalid="true"] .field__wrap { box-shadow: inset 0 0 0 1.5px var(--alert-dot); }
.field[data-invalid="true"] .field__error { display: block; }
.field[data-invalid="true"] .field__hint { display: none; }

/* checkbox */
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox__box {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--ink-200);
  color: transparent;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  flex: 0 0 auto;
}
.checkbox__box svg { width: 11px; height: 11px; }
.checkbox input:checked + .checkbox__box {
  background: var(--brand-600);
  box-shadow: none;
  color: var(--white);
}
.checkbox input:focus-visible + .checkbox__box { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.checkbox__text { font-size: var(--t-cell-size); font-weight: 400; color: var(--ink-600); }

/* ------------------------------------------------------------- WalletCard */
.wallet {
  position: relative;
  border-radius: var(--r-lg);
  padding: 16px 18px 14px;
  color: var(--white);
  background: linear-gradient(135deg, #12A874 0%, var(--primary-strong) 58%, #06452D 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 14px 30px -16px rgba(var(--primary-rgb), 0.7);
  overflow: hidden;
  isolation: isolate;
  min-height: 132px;
  display: flex;
  flex-direction: column;
}
.wallet::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 190px;
  height: 190px;
  border-radius: var(--r-pill);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 68%);
  z-index: -1;
}
.wallet__blob {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.55);
  filter: blur(0.4px);
}
.wallet__top { display: flex; align-items: flex-start; justify-content: flex-end; }
.wallet__balance { text-align: right; }
.wallet__amount { font-size: 25px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.wallet__amount small { font-size: 0.55em; font-weight: 600; letter-spacing: 0; opacity: 0.85; }
.wallet__caption { font-size: var(--t-label-size); font-weight: 400; color: rgba(255, 255, 255, 0.82); }
.wallet__meta { margin-top: auto; }
.wallet__name { font-size: var(--t-cell-size); font-weight: 600; color: rgba(255, 255, 255, 0.95); }
.wallet__sub { font-size: var(--t-label-size); font-weight: 400; color: rgba(255, 255, 255, 0.72); }
.wallet__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.wallet__foot svg { width: 17px; height: 17px; color: rgba(255, 255, 255, 0.85); }

/* the lilac shelf peeking from behind the card, as in the reference */
.wallet-stack { position: relative; padding-bottom: 12px; }
.wallet-stack__shelf {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 26px;
  border-radius: var(--r-lg);
  background: var(--brand-200);
  box-shadow: none;
}

/* switch */
.switch {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  transition: background var(--dur) var(--ease);
  flex: 0 0 auto;
}
.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: var(--r-pill);
  background: var(--white);
  transition: transform var(--dur) var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch[aria-checked="true"] { background: var(--white); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(17px); background: var(--brand-600); }

/* ------------------------------------------------------------------ Meter */
.meter { display: flex; flex-direction: column; gap: 10px; }
.meter__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.meter__value { font-size: var(--t-figure-size); font-weight: 600; letter-spacing: -0.03em; color: var(--ink-900); }
.meter__track {
  position: relative;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--ink-150);
  overflow: visible;
}
.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--primary-strong), var(--primary-bright));
}
.meter__knob {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  transform: translateY(-50%);
  border-radius: var(--r-pill);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--brand-600), var(--sh-xs);
}
.meter__foot { display: flex; align-items: center; justify-content: space-between;
  font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }

/* ------------------------------------------------------------- StatStrip */
.statstrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.statstrip__cell {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--ink-100);
  min-width: 0;
}
.statstrip__label {
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--ink-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statstrip__value {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------- MiniFigure */
.minifig { display: flex; flex-direction: column; gap: 2px; }
.minifig__label { font-size: var(--t-label-size); font-weight: 600; color: var(--ink-400); }
.minifig__value { font-size: var(--t-figure-size); font-weight: 400; letter-spacing: -0.03em; color: var(--ink-900); }
.minifig__value small { font-size: 0.5em; font-weight: 600; letter-spacing: 0; color: var(--ink-400); }

/* ------------------------------------------------------------ Chart shell */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__legend {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--ink-500); /* text token, never the series colour */
}
.chart__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.chart__legend-value { color: var(--ink-900); font-weight: 600; }

.chart__tip {
  position: absolute;
  z-index: 20;
  transform: translate(-50%, -100%);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--sh-lg);
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.chart__tip[data-show="true"] { opacity: 1; }
.chart__tip b { color: var(--ink-900); font-weight: 600; }
.chart__tip .sep { display: inline-block; width: 10px; }

.chart__bar-hit { fill: transparent; cursor: pointer; }
.chart__bar-hit:hover + .chart__bar-group,
.chart__bar-group[data-hover="true"] { opacity: 1; }

/* ------------------------------------------------------------- DataTable */
.table-wrap { border-radius: var(--radius-md); }
.dtable { font-size: var(--t-cell-size); min-width: 780px; }
.dtable thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.dtable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr { transition: background var(--dur-fast) var(--ease); }
.dtable tbody tr:hover td { background: var(--row-hover); }
.dtable__num { font-weight: 600; color: var(--ink-900); }
.dtable__check { width: 34px; padding-left: 4px !important; }
.dtable__check input { width: 15px; height: 15px; accent-color: var(--brand-600); cursor: pointer; }
.dtable__entity { display: flex; align-items: center; gap: 10px; }
.dtable__entity-name { font-weight: 600; color: var(--ink-900); }
.dtable__entity-sub { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }
.dtable__glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}
.dtable__stack { display: flex; flex-direction: column; line-height: 1.35; }

.tablefoot {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 13px var(--s-5);
  font-size: var(--t-label-size);
  font-weight: 400;
  color: var(--ink-400);
}

/* ------------------------------------------------------------ QuickAction */
.quick { display: flex; flex-direction: column; gap: 12px; }
.quick__row { display: flex; align-items: center; gap: var(--s-2); }
.quick__next {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink-150);
  color: var(--ink-600);
  flex: 0 0 auto;
}
.quick__next:hover { background: var(--hover-bg); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--border-strong); }
.quick__next svg { width: 14px; height: 14px; }

/* -------------------------------------------------------------- Flag chip */
.flagchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 6px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--border-color);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}
.flagchip__flag {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(22, 21, 26, 0.08);
}
.flagchip__flag svg { width: 100%; height: 100%; }
.flagchip--on-brand {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}

/* ------------------------------------------------------------------ Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--inverse-bg);
  color: var(--inverse-fg);
  font-size: var(--t-cell-size);
  font-weight: 600;
  box-shadow: var(--sh-lg);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.toast[data-show="true"] { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 15px; height: 15px; color: var(--primary); }

/* -------------------------------------------------------------- Segmented */
.segmented {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--ink-100);
  isolation: isolate;
}
.segmented__thumb {
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--ink-150);
  transition: transform var(--dur) var(--ease);
}
.segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--t-cell-size);
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}
.segmented__option:hover { color: var(--ink-800); }
.segmented__option[aria-checked="true"] { color: var(--brand-700); }
.segmented__option svg { flex: 0 0 auto; }

/* ------------------------------------------------------------- PageHead */
.pagehead { display: flex; flex-direction: column; gap: var(--s-4); }
.pagehead__row { display: flex; align-items: flex-start; gap: var(--s-4); flex-wrap: wrap; }
.pagehead__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--brand-050);
  color: var(--brand-700);
  flex: 0 0 auto;
}
.pagehead__mark svg { width: 18px; height: 18px; }
.pagehead__titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pagehead__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text-main);
}
.pagehead__sub { font-size: 12px; font-weight: 400; color: var(--text-muted); max-width: 82ch; }
.pagehead__actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

.pagehead__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(166px, 1fr));
  gap: 10px;
}
.pagehead__stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(170px 100px at 100% 0%, color-mix(in srgb, var(--tile-accent, transparent) 15%, transparent), transparent 72%),
    var(--surface);
  box-shadow: var(--sh-md), var(--sh-inset-card);
  min-width: 0;
}
.pagehead__stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagehead__stat-value {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagehead__stat-foot { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }

/* A tone on a stat means the FIGURE is in that state, so the tile wears a
   reserved status colour — a dot before its label and a faint wash in the
   corner — and the foot line always spells the state out in words, because a
   colour on its own is not an encoding. */
.pagehead__stat--good { --tile-accent: var(--good-fg); }
.pagehead__stat--warn { --tile-accent: var(--warn-fg); }
.pagehead__stat--serious { --tile-accent: var(--serious-fg); }
.pagehead__stat--info { --tile-accent: var(--info-fg); }
.pagehead__stat[class*="pagehead__stat--"] .pagehead__stat-label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--tile-accent);
  vertical-align: 1px;
}

/* -------------------------------------------------------------- Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--card-shadow), inset 0 0 0 1px var(--border-color);
}
.toolbar .u-spacer { flex: 1 1 auto; }
.toolbar__trailing { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 230px;
  max-width: 360px;
  padding: 0 10px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--ink-150);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.searchbox:focus-within { box-shadow: inset 0 0 0 1.5px var(--brand-600), var(--ring-brand); }
.searchbox__icon { color: var(--ink-400); flex: 0 0 auto; }
.searchbox__icon svg { width: 16px; height: 16px; }
.searchbox:focus-within .searchbox__icon { color: var(--brand-600); }
.searchbox__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: var(--t-cell-size);
  font-weight: 400;
  color: var(--ink-900);
}
.searchbox__input::placeholder { color: var(--ink-300); }
.searchbox__input::-webkit-search-cancel-button { cursor: pointer; }

/* ------------------------------------------------------------ Row / list */
.rowlist { display: flex; flex-direction: column; }
.rowlist--scroll { overflow-y: auto; overscroll-behavior-y: contain; }

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 11px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  color: inherit;
  border-bottom: 1px solid var(--ink-100);
  transition: background var(--dur-fast) var(--ease);
  /* In a narrow card the trailing figure drops under the text rather than
     squeezing it down to a word a line. */
  flex-wrap: wrap;
  row-gap: 6px;
}
.rowlist > .row:last-child { border-bottom: 0; }
.row--action { cursor: pointer; }
.row--action:hover { background: var(--hover-bg); text-decoration: none; }
.row.is-selected { background: var(--brand-050); box-shadow: inset 2px 0 0 var(--brand-600); }
.row__lead { flex: 0 0 auto; display: flex; align-items: center; }
.row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 120px; }
.row__title {
  font-size: var(--t-cell-size);
  font-weight: 600;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__sub { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }
.row__trail { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; margin-left: auto; }
.row__value { font-size: var(--t-cell-size); font-weight: 600; letter-spacing: -0.015em; color: var(--ink-900); }
.row__code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--ink-100);
  color: var(--ink-600);
}
.row__meter { width: 100%; margin-top: 6px; }
.row--serious { box-shadow: inset 2px 0 0 var(--serious-fg); }
.row--warn { box-shadow: inset 2px 0 0 var(--warn-fg); }

/* --------------------------------------------------------------- Quorum */
.quorum { display: inline-flex; align-items: center; gap: 8px; }
.quorum__pips { display: inline-flex; gap: 3px; }
.quorum__pip { width: 16px; height: 5px; border-radius: var(--r-pill); background: var(--ink-200); }
.quorum__pip.is-on { background: var(--brand-600); }
.quorum__text { font-size: var(--t-label-size); font-weight: 600; color: var(--ink-500); white-space: nowrap; }

/* ------------------------------------------------------- HealthRow mark */
.health__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  flex: 0 0 auto;
}
.health__mark svg { width: 14px; height: 14px; }
.health__mark--good { background: var(--good-bg); color: var(--good-fg); }
.health__mark--warn { background: var(--warn-bg); color: var(--warn-fg); }
.health__mark--serious { background: var(--serious-bg); color: var(--serious-fg); }

/* ------------------------------------------------------------ KeyValues */
.kv { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 9px var(--s-3); margin: 0; }
.kv__key { font-size: var(--t-label-size); font-weight: 600; color: var(--ink-400); }
.kv__value {
  margin: 0;
  font-size: var(--t-cell-size);
  font-weight: 600;
  color: var(--ink-800);
  overflow-wrap: anywhere;
}
.kv__value--mono { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 12px; font-weight: 400; }

/* ----------------------------------------------------------------- Tabs */
.tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  max-width: 100%;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tabs__tab:hover { color: var(--text-muted); }
.tabs__tab[aria-selected="true"] { color: var(--text-main); border-bottom-color: var(--primary); }
.tabs__count {
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.tabs__tab[aria-selected="true"] .tabs__count { background: var(--brand-100); color: var(--brand-700); }

/* ----------------------------------------------------------- EmptyState */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: var(--s-8) var(--s-5);
  text-align: center;
}
.empty__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--brand-050);
  color: var(--brand-600);
}
.empty__mark svg { width: 20px; height: 20px; }
.empty__title { font-size: var(--t-body-size); font-weight: 600; color: var(--ink-800); }
.empty__sub { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); max-width: 46ch; }

/* ------------------------------------------------------------ HBarChart
   One series, one hue. The value is direct-labelled on every row, which is
   what lets this double as its own table view. */
.hbar { display: flex; flex-direction: column; gap: 12px; }
.hbar__row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 2px 0;
  text-align: left;
  color: inherit;
  border-radius: var(--r-xs);
}
button.hbar__row { cursor: pointer; }
button.hbar__row:hover .hbar__fill { filter: brightness(1.08); }
button.hbar__row:hover .hbar__label { color: var(--brand-700); }
.hbar__head { display: flex; align-items: baseline; gap: var(--s-3); }
.hbar__label {
  font-size: var(--t-cell-size);
  font-weight: 600;
  color: var(--ink-800);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.hbar__value {
  font-size: var(--t-cell-size);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  flex: 0 0 auto;
}
.hbar__track {
  position: relative;
  display: block;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
}
.hbar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: var(--chart-series-1);
  transition: filter var(--dur-fast) var(--ease);
}
.hbar__sub { font-size: var(--t-label-size); font-weight: 400; color: var(--ink-400); }

/* ------------------------------------------------------------ StackedBar
   Segments are separated by a 2px SURFACE GAP, never a border. */
.stackbar { display: flex; flex-direction: column; gap: 12px; }
.stackbar__bar {
  position: relative;
  display: flex;
  gap: 2px;
  width: 100%;
  border-radius: var(--r-xs);
  overflow: hidden;
  background: var(--chart-surface);
}
.stackbar__seg {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 3px;
  transition: filter var(--dur-fast) var(--ease);
}
.stackbar__seg:first-child { border-radius: var(--r-xs) 0 0 var(--r-xs); }
.stackbar__seg:last-child { border-radius: 0 var(--r-xs) var(--r-xs) 0; }
.stackbar__seg:hover { filter: brightness(1.1); }
/* Only rendered when the segment is >= 17% wide, so a label can never clip. */
.stackbar__seg-label {
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.01em;
}
.stackbar__seg[data-ord="1"] .stackbar__seg-label { color: var(--chart-ord-1-ink); }
.stackbar__seg[data-ord="2"] .stackbar__seg-label { color: var(--chart-ord-2-ink); }
.stackbar__seg[data-ord="3"] .stackbar__seg-label { color: var(--chart-ord-3-ink); }
.stackbar__seg[data-ord="4"] .stackbar__seg-label { color: var(--chart-ord-4-ink); }

/* A register row is pickable: clicking it fills the detail rail beside the
   table. Keyboard gets the same affordance, so the focus ring matters here. */
.dtable tbody tr[data-clickable] { cursor: pointer; }
.dtable tbody tr[data-clickable]:focus-visible { outline: 2px solid var(--brand-600); outline-offset: -2px; }
.dtable tbody tr.is-active td { background: var(--brand-050); }
.dtable tbody tr.is-active td:first-child { box-shadow: inset 2px 0 0 var(--brand-600); }
.dtable tbody tr.is-active:hover td { background: var(--brand-100); }

/* the detail rail that a picked row fills */
.detail { display: flex; flex-direction: column; gap: var(--s-4); }
.detail__head { display: flex; align-items: center; gap: var(--s-3); }
.detail__figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.detail__fig {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--ink-100);
  min-width: 0;
}
.detail__fig-label { font-size: var(--t-label-size); font-weight: 600; color: var(--ink-400); }
.detail__fig-value {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.detail__actions .btn { flex: 1 1 auto; }

/* a banner inside a card — a blocker, a suspension reason, an SLA breach */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  font-size: var(--t-label-size);
  font-weight: 400;
  line-height: 1.55;
}
.notice svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.notice b { font-weight: 600; }
.notice--good { background: var(--good-bg); color: var(--good-fg); }
.notice--warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice--serious { background: var(--serious-bg); color: var(--serious-fg); }
.notice--info { background: var(--info-bg); color: var(--info-fg); }
.notice--neutral { background: var(--surface-sunken); color: var(--ink-600); box-shadow: inset 0 0 0 1px var(--ink-100); }

/* ------------------------------------------------------- procedure index
   The left column of the Procedures page. Sticky and self-scrolling: the
   record beside it is long, and an index that scrolls away with the record
   has stopped being an index. */
.proclist {
  position: sticky;
  top: calc(var(--appbar-height) + 12px);
  max-height: calc(100vh - var(--appbar-height) - 24px);
  display: flex;
  flex-direction: column;
  padding: var(--s-3) 0 0;
  gap: 0;
}
.proclist__count {
  padding: 0 var(--s-4) var(--s-2);
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: var(--t-micro-track);
  text-transform: uppercase;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}
.proclist__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 var(--s-2) var(--s-3);
  scrollbar-width: thin;
}
.proclist__section {
  padding: var(--s-4) var(--s-2) 5px;
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: var(--t-micro-track);
  text-transform: uppercase;
  color: var(--ink-300);
}
.proclist__section:first-child { padding-top: var(--s-1); }
.proclist__item {
  display: flex;
  align-items: center;
  /* no gap: "Simple." and the name are one identifier, and a flex gap between
     them renders as "Simple. LittleChamaEnroll" */
  gap: 0;
  width: 100%;
  padding: 6px var(--s-2);
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-600);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.proclist__item:hover { background: var(--hover-bg); color: var(--ink-900); }
.proclist__item[aria-current="true"] { background: var(--active-bg); color: var(--ink-900); }
.proclist__sch { color: var(--ink-400); flex: 0 0 auto; }
.proclist__item[aria-current="true"] .proclist__sch { color: var(--brand-700); }
.proclist__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the book glyph marks a procedure that has a README behind it */
/* pushed to the right edge, so the glyphs line up into a scannable column */
.proclist__item svg { width: 12px; height: 12px; flex: 0 0 auto; margin-left: auto; opacity: 0.5; }
.proclist__item[aria-current="true"] svg { opacity: 0.9; }
.proclist .empty { padding: var(--s-6) var(--s-4); }

/* ------------------------------------------------------ procedure detail */
.proccard { padding: 0; }
.procdetail { padding: var(--s-5) var(--s-5) var(--s-6); }
.procdetail__head { padding-bottom: var(--s-4); border-bottom: 1px solid var(--ink-100); }
.procdetail__title { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.procdetail__name {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  word-break: break-word;
}
.procdetail__sch { color: var(--ink-400); font-weight: 400; }
.procdetail__meta {
  margin-top: 5px;
  font-size: var(--t-label-size);
  font-weight: 400;
  color: var(--ink-500);
}
.procdetail__src { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 11px; color: var(--brand-700); }
.procdetail__writes { margin-top: 6px; font-size: var(--t-label-size); color: var(--ink-400); }
.procdetail__writes b { color: var(--ink-500); font-weight: 600; }
.procdetail__desc { margin-top: var(--s-3); font-size: var(--t-body-size); color: var(--ink-700); max-width: 88ch; }
.procdetail__desc--undoc { color: var(--ink-400); font-style: italic; }

.procdetail__block { margin-top: var(--s-5); }
.procdetail__h {
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: var(--t-micro-track);
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: var(--s-2);
}
.procdetail__grouph {
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--ink-700);
  margin: var(--s-4) 0 6px;
}
.procdetail__hint { font-size: var(--t-label-size); color: var(--ink-500); margin-bottom: var(--s-2); }
.procdetail__hint code,
.procdetail__none code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--ink-100);
  color: var(--ink-600);
}
.procdetail__none { font-size: var(--t-label-size); color: var(--ink-400); font-style: italic; }
.procdetail__group + .procdetail__group { margin-top: var(--s-2); }

/* A README "Note — …": what integrators get wrong. Real borders, not an inset
   shadow, so the amber rule survives the printer. */
.procnote {
  padding: 12px 16px 14px;
  border: 1px solid var(--ink-150);
  border-left: 3px solid var(--chart-warn);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}
.procnote + .procnote { margin-top: var(--s-3); }
.procnote__title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--t-body-size);
  font-weight: 600;
  color: var(--ink-900);
}
.procnote__icon { display: inline-flex; margin-top: 2px; color: var(--warn-fg); flex: 0 0 auto; }
.procnote__p,
.procnote__list li {
  font-size: var(--t-cell-size);
  color: var(--ink-700);
  line-height: 1.6;
  max-width: 96ch;
}
.procnote__title + *,
.procnote__p + *,
.procnote__list + *,
.procnote__table + * { margin-top: 8px; }
.procnote__list { padding-left: 18px; list-style: disc; }
.procnote__list li + li { margin-top: 4px; }
.procnote__list li::marker { color: var(--ink-400); }
.procnote__table { padding: 2px 0; }
.procnote b { font-weight: 600; color: var(--ink-900); }
.procnote code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--ink-100);
  color: var(--ink-800);
}
.procnote .deftable__notes code { white-space: nowrap; }

/* Call and response, two equal halves. Collapses at 1180, not the 820
   `.cols--2` uses: this sits inside `.cols--index-main`, so a 232px index
   eats the room for a second code column well before the viewport does. */
.procdetail__pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  align-items: start;
}
/* Both halves carry .procdetail__block's margin-top, which is what separates
   them once collapsed — hence gap: 0 there. */
@media (max-width: 1400px) {
  .procdetail__pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ------------------------------------------------------------- CodeBlock
   Dark, because a call and an envelope are the two things on this page a
   reader copies rather than skims, and the shift in surface signals it. */
.codeblock {
  margin-top: var(--s-2);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: inset 0 0 0 1px var(--border-color);
}
.codeblock__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3) 6px var(--s-4);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}
.codeblock__lang {
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: var(--t-micro-track);
  text-transform: uppercase;
  color: #7FD5AF;
}
.codeblock__bar .badge { background: rgba(255, 255, 255, 0.1); color: #D8F5E5; }
.codeblock__bar .badge--warn { background: rgba(248, 222, 198, 0.16); color: #F3D9BC; }
.codeblock__copy {
  padding: 3px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: #D8F5E5;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.codeblock__copy:hover { background: var(--brand-600); border-color: var(--brand-500); color: var(--white); }
.codeblock__copy[data-done="true"] { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--white); }
.codeblock__pre {
  margin: 0;
  padding: var(--s-4);
  overflow-x: auto;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  /* Colour does the work weight used to, so both come down. */
  font-size: 11.75px;
  font-weight: 400;
  line-height: 1.65;
  color: #C6DCD2;
  tab-size: 4;
  white-space: pre;
}

/* ------------------------------------------------------------ token palette
   Six hues, one role each, shared by JSON and SQL. All clear 5:1 on the
   --brand-900 ground, sage included. */
.tok--kw { color: #C9A6F5; font-weight: 400; }
.tok--lit { color: #C9A6F5; }
.tok--key { color: #7CC7F5; font-weight: 400; }
.tok--obj { color: #7CC7F5; }
.tok--str { color: #F7C77B; }
.tok--num { color: #FFA98F; }
.tok--var { color: #7FE0B8; }
.tok--punct { color: #6FA189; }
.tok--comment { color: #6FA189; font-style: italic; }
.tok--ellipsis { color: #6FA189; }

/* -------------------------------------------------------------- DefTable
   Parameter, payload-field and exit-code reference tables. */
.deftable { width: 100%; border-collapse: collapse; font-size: var(--t-cell-size); }
.deftable th {
  text-align: left;
  padding: 0 var(--s-4) 6px 0;
  border-bottom: 1px solid var(--ink-150);
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: var(--t-micro-track);
  text-transform: uppercase;
  color: var(--ink-400);
  white-space: nowrap;
}
.deftable td {
  padding: 7px var(--s-4) 7px 0;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: top;
}
.deftable tr:last-child td { border-bottom: 0; }
.deftable__name {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
}
.deftable__name--exit { color: var(--serious-fg); }
.deftable__type {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 11.5px;
  color: var(--ink-500);
  white-space: nowrap;
}
.deftable__def { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 11.5px; color: var(--ink-400); }
.deftable__notes { color: var(--ink-600); min-width: 20ch; }

.reqmark {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-size: var(--t-micro-size);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.reqmark--req { background: var(--serious-bg); color: var(--serious-fg); }
.reqmark--opt { background: var(--neutral-bg); color: var(--neutral-fg); }
/* a constraint the README spells one word per row: one of / these / three */
.reqmark--note { background: var(--info-bg); color: var(--info-fg); }

@media (max-width: 1200px) {
  .proclist { position: static; max-height: 420px; }
}

/* ------------------------------------------------------------------- DFD
   The data flow page. A figure may be wider than the card it sits in — every
   one is wrapped in .u-scroll-x, so it scrolls in its own frame rather than
   shrinking its 9px labels past reading size or pushing the page sideways. */
.dfd__fig {
  margin: var(--s-4) 0 var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-2);
  background: var(--surface-sunken);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
}
.dfd__fig svg {
  display: block;
  width: 100%;
  /* Drawn for ~1040 units across. It may scale up on a wide shell, but not
     without limit: past this the boxes read as a poster rather than a figure. */
  max-width: 1180px;
  min-width: 900px;
  height: auto;
  margin: 0 auto;
}
/* Identifiers are set in mono inside the drawings for the same reason they are
   in the procedure catalogue: a table name should look like a table name. */
.dfd__fig text { font-family: ui-monospace, Consolas, Menlo, monospace; }

.dfd__lede {
  margin: 0;
  max-width: 78ch;
  font-size: var(--t-body-size);
  color: var(--ink-600);
}
.dfd__lede code,
.dfd__caption code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 12px;
  color: var(--ink-800);
  background: var(--ink-100);
  padding: 1px 5px;
  border-radius: var(--r-xs);
}
.dfd__caption {
  margin: 0;
  max-width: 86ch;
  line-height: 1.6;
}
.dfd__caption b { color: var(--ink-700); font-weight: 600; }

/* The notation key. One legend for all four figures, because the shape
   encoding is the one thing that repeats across every one of them. */
.dfd__key {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-7);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.dfd__key-item { display: flex; align-items: center; gap: var(--s-2); }
.dfd__key-mark { width: 46px; height: 24px; flex: none; }
.dfd__key p {
  margin: 0;
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--ink-700);
  line-height: 1.3;
}
.dfd__key em {
  display: block;
  font-style: normal;
  font-weight: 400;
  color: var(--ink-400);
}

/* The four duplication mechanisms — amber, because every one of them is about
   money leaving twice. */
.dfd__rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: var(--s-3);
  margin: var(--s-4) 0 var(--s-3);
}
.dfd__rule {
  padding: var(--s-3) var(--s-4);
  background: var(--surface-sunken);
  border: 1px solid var(--ink-150);
  border-left: 2px solid var(--chart-warn);
  border-radius: var(--r-xs);
}
.dfd__rule b {
  display: block;
  margin-bottom: 4px;
  font-size: var(--t-label-size);
  font-weight: 600;
  color: var(--warn-fg);
}
.dfd__rule span { font-size: var(--t-cell-size); color: var(--ink-600); }

.dfd__register td { vertical-align: top; }
.dfd__register-row--ledger { background: var(--brand-025); }
.dfd__register-id { color: var(--brand-700); }

@media (max-width: 720px) {
  .dfd__fig { padding: var(--s-3) var(--s-3) var(--s-2); }
}

/* ---------------------------------------------------------------- journey */
.journey__jump { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.journey__jump-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  font-size: var(--t-label-size); font-weight: 600; color: var(--ink-700);
  background: var(--surface); border: 1px solid var(--ink-150); border-radius: 999px;
  text-decoration: none;
}
.journey__jump-link:hover { border-color: var(--brand-400); color: var(--brand-700); }
.journey__jump-link b,
.journey__num {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; font-weight: 600; color: #fff; background: var(--brand-600);
}
.journey__steps { list-style: none; margin: 0; padding: 0; }
.journey__step { position: relative; display: flex; gap: var(--s-3); padding-bottom: var(--s-4); }
.journey__step:last-child { padding-bottom: 0; }
.journey__step:not(:last-child)::before {
  content: ''; position: absolute; left: 13px; top: 28px; bottom: 2px;
  width: 2px; background: var(--ink-150);
}
.journey__num { width: 28px; height: 28px; position: relative; }
.journey__body {
  flex: 1 1 auto; min-width: 0;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-sunken); border: 1px solid var(--ink-150); border-radius: var(--r-xs);
}
.journey__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.journey__proc {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 13px; font-weight: 600; color: var(--brand-700);
  text-decoration: none; overflow-wrap: anywhere; margin-right: 4px;
}
.journey__proc:hover { text-decoration: underline; }
.journey__who { margin: 6px 0 0; font-size: var(--t-label-size); color: var(--ink-600); }
.journey__who b { color: var(--ink-800); }
.journey__does { margin: 4px 0 8px; max-width: 86ch; font-size: var(--t-body-size); color: var(--ink-800); }
.journey__meta {
  display: grid; grid-template-columns: 72px 1fr; gap: var(--s-2);
  padding-top: 4px; font-size: var(--t-cell-size); color: var(--ink-600);
}
.journey__meta-label {
  font-size: var(--t-micro-size); font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-500); padding-top: 2px;
}
.journey__body code,
.journey__table code {
  font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 12px;
  color: var(--ink-800); background: var(--ink-100);
  padding: 1px 5px; border-radius: var(--r-xs); overflow-wrap: anywhere;
}
.journey__field { display: inline-block; margin: 0 4px 4px 0; }
.journey__settings { margin-top: var(--s-4); overflow-x: auto; }
.journey__settings-title { margin: 0 0 2px; font-size: var(--t-card-title-size); font-weight: 600; color: var(--ink-800); }
.journey__table { width: 100%; margin-top: var(--s-2); border-collapse: collapse; font-size: var(--t-cell-size); }
.journey__table th {
  text-align: left; padding: 6px 10px; font-size: var(--t-micro-size);
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-500);
  border-bottom: 1px solid var(--ink-200);
}
.journey__table td { padding: 6px 10px; vertical-align: top; color: var(--ink-700); border-bottom: 1px solid var(--ink-150); }
@media (max-width: 720px) {
  .journey__meta { grid-template-columns: 1fr; gap: 0; }
  .journey__body { padding: var(--s-3); }
}

/* A chart with nothing to plot (charts.js EmptyChart): says so, never a flat zero line. */
.chart--empty {
  display: grid;
  place-items: center;
  color: var(--ink-400);
  font-size: 12px;
}
