/* components.css: every component of README §12.5, BEM-like names (.btn, .btn--primary, .btn__label).
   Rules of this file:
   - every value is a token from tokens.css;
   - zero radius everywhere, except avatars, status dots and spinners;
   - no shadows, gradients, glow or blur;
   - NO transition and NO animation here: all motion lives in motion.css.
   - every :hover, :active and :focus-visible rule also matches [data-force~='hover' | 'active' | 'focus'], so
     the component gallery (/dev/components) can show those states standing still with the components' own
     rules. Nothing in the app sets data-force.
   Contents: 1 brand and nav · 2 buttons · 3 form controls · 4 choice controls · 5 status, badge, avatar
   · 6 cards, KPI, amounts · 7 tables and list rows · 8 overlays · 9 feedback · 10 files · 11 claim parts
   · 12 states · 13 small parts. */
@layer components {
  /* ============================ 1. Brand and navigation ============================================ */
  .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--topbar-height);
    color: var(--color-text);
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-semibold);
    text-decoration: none;
  }
  .brand:hover {
    color: var(--color-text);
  }
  /* The SideNav's brand sits on the nav's top edge, inside its scroll box: an outside ring would lose its top. */
  .sidenav > .brand:is(:focus-visible, [data-force~='focus']) {
    outline-offset: calc(-1 * var(--focus-ring));
  }

  .nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
  }
  .nav-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    padding-block-start: var(--spacing-3);
    border-top: var(--border-hairline) solid var(--color-border);
  }
  .nav-group__title {
    padding: var(--spacing-1) var(--spacing-3);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
  }
  .nav__item {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    width: 100%;
    min-height: var(--control-height);
    padding-inline: var(--spacing-3);
    color: var(--color-text-muted);
    font-weight: var(--weight-medium);
    text-decoration: none;
  }
  .nav__item:is(:hover, [data-force~='hover']) {
    background: var(--color-surface-2);
    color: var(--color-text);
  }
  .nav__item:is(:active, [data-force~='active']) {
    background: var(--color-surface-3);
  }
  .nav__label {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* The active item: accent wash, a 2 px accent bar on the left, text colour, aria-current="page".
     The wash and bar are one pseudo-element, so shell.js can slide it from the previous item (motion.slide). */
  .nav__item[aria-current='page'] {
    color: var(--color-text);
  }
  .nav__item[aria-current='page']::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--color-accent-wash);
    border-inline-start: var(--border-strong) solid var(--color-accent);
  }
  .nav__item--user {
    gap: var(--spacing-3);
    padding-inline: var(--spacing-1-5);
  }
  .nav__user {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
  }
  .nav__user-name {
    overflow: hidden;
    color: var(--color-text);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav__user-role {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-regular);
  }

  /* Items stand on a shared label line: an icon (24 px) over its label, centred in the 64 px bar; the New claim
     square is taller and rises above the icons, its "New" label on the same line as the others. */
  .bottomnav__item {
    --bottomnav-inset: calc((var(--bottomnav-height) - var(--icon-lg) - var(--spacing-0-5) - var(--leading-xs)) / 2);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-0-5);
    min-width: var(--control-height);
    min-height: var(--bottomnav-height);
    padding-inline: var(--spacing-1);
    padding-block-end: var(--bottomnav-inset);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
    text-decoration: none;
  }
  .bottomnav__item:is(:hover, [data-force~='hover']) {
    color: var(--color-text);
  }
  .bottomnav__item[aria-current='page'] {
    color: var(--color-accent-text);
  }
  .bottomnav__item[aria-current='page']::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline: var(--spacing-2);
    z-index: -1;
    height: var(--border-strong);
    background: var(--color-accent);
  }
  /* An item two columns wide (Account, for employees) keeps a one-column bar, centred. */
  .bottomnav__list[data-items='4'] > li:last-child > .bottomnav__item[aria-current='page']::before {
    inset-inline: calc(25% + var(--spacing-2) / 2);
  }
  .bottomnav__icon {
    position: relative;
    display: grid;
    place-items: center;
    min-width: var(--icon-lg);
    height: var(--icon-lg);
  }
  /* The count sits on the icon's top-right corner; in the markup it follows the label, so the link reads
     "Approvals 3 waiting for approval". */
  .bottomnav__item > .badge {
    position: absolute;
    inset-block-start: calc(var(--bottomnav-inset) - var(--spacing-1-5));
    inset-inline-start: calc(50% + var(--icon-lg) / 2 - var(--spacing-1-5));
  }
  .bottomnav__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* The central New claim action: a square accent button, one thumb away (README §12.1), labelled "New". The
     whole item is the target (64 px tall). */
  .bottomnav__new {
    display: grid;
    place-items: center;
    width: var(--bottomnav-new-size);
    height: var(--bottomnav-new-size);
    background: var(--color-accent);
    color: var(--color-on-accent);
  }
  .bottomnav__item:is(:hover, [data-force~='hover']) .bottomnav__new {
    background: var(--color-accent-hover);
  }
  .bottomnav__item:is(:active, [data-force~='active']) .bottomnav__new {
    background: var(--color-accent-pressed);
  }
  /* Forced colours drop backgrounds: the current item keeps a visible bar, the New square its outline, a count
     its box. */
  @media (forced-colors: active) {
    .bottomnav__item[aria-current='page']::before {
      height: 0;
      border-block-start: var(--border-strong) solid Highlight;
    }
    .bottomnav__new,
    .badge {
      border: var(--border-hairline) solid ButtonText;
    }
  }

  /* ============================ 2. Buttons and links ================================================ */
  .btn {
    --btn-bg: var(--color-surface-2);
    --btn-fg: var(--color-text);
    --btn-border: var(--color-border-control);
    --btn-bg-hover: var(--color-surface-3);
    --btn-bg-active: var(--color-border);
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    min-width: var(--control-height);
    min-height: var(--control-height);
    padding: 0 var(--spacing-4);
    border: var(--border-hairline) solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-semibold);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
  }
  .btn:is(:hover, [data-force~='hover']) {
    background: var(--btn-bg-hover);
    color: var(--btn-fg);
  }
  .btn:is(:active, [data-force~='active']) {
    background: var(--btn-bg-active);
  }
  .btn--primary {
    --btn-bg: var(--color-accent);
    --btn-fg: var(--color-on-accent);
    --btn-border: transparent;
    --btn-bg-hover: var(--color-accent-hover);
    --btn-bg-active: var(--color-accent-pressed);
  }
  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--color-accent-text);
    --btn-border: transparent;
    --btn-bg-hover: var(--color-surface-3);
    --btn-bg-active: var(--color-surface-3);
  }
  .btn--danger {
    --btn-bg: var(--color-danger);
    --btn-fg: var(--color-on-accent);
    --btn-border: transparent;
    --btn-bg-hover: color-mix(in srgb, var(--color-danger) 88%, var(--color-text));
    --btn-bg-active: color-mix(in srgb, var(--color-danger) 76%, var(--color-text));
  }
  .btn--danger-ghost {
    --btn-bg: transparent;
    --btn-fg: var(--color-danger-text);
    --btn-border: transparent;
    --btn-bg-hover: var(--color-surface-3);
    --btn-bg-active: var(--color-surface-3);
  }
  /* Neutral ghost for icon buttons in toolbars, tiles and dialogs. */
  .btn--quiet {
    --btn-bg: transparent;
    --btn-fg: var(--color-text-muted);
    --btn-border: transparent;
    --btn-bg-hover: var(--color-surface-3);
    --btn-bg-active: var(--color-surface-3);
  }
  .btn--quiet:is(:hover, [data-force~='hover']) {
    --btn-fg: var(--color-text);
  }
  /* Disabled stays legible: surface-2 with text-subtle, no opacity tricks. */
  .btn:disabled,
  .btn[aria-disabled='true'] {
    --btn-bg: var(--color-surface-2);
    --btn-fg: var(--color-text-subtle);
    --btn-border: var(--color-border);
    --btn-bg-hover: var(--color-surface-2);
    --btn-bg-active: var(--color-surface-2);
    cursor: not-allowed;
  }
  /* Loading: the label stays, button.js locks the width and shows the spinner after 150 ms. */
  .btn[aria-busy='true'] {
    pointer-events: none;
    cursor: progress;
  }
  /* The spinner replaces the icon: button.js puts it where the icon was and hides the icon ([hidden]). */
  .btn[data-spinning] {
    padding-inline: var(--spacing-1);
  }
  .btn--lg {
    min-height: var(--control-height-lg);
    padding-inline: var(--spacing-6);
  }
  .btn--block {
    display: flex;
    width: 100%;
  }
  .btn--icon {
    width: var(--control-height);
    padding: 0;
  }
  .btn--icon.btn--lg {
    width: var(--control-height-lg);
  }
  .btn__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Buttons in the shell's page action bar (the bar is in layout.css; these rules must come after .btn, and
     the components layer wins over the layout layer). Below wide they are 52 px tall; on compact the primary
     (or danger) action stretches. A label too long for the bar is cut with an ellipsis, never pushed off screen. */
  .actionbar > .btn {
    min-height: var(--actionbar-button-height, var(--control-height));
    max-width: 100%;
  }
  .actionbar > .btn--primary,
  .actionbar > .btn--danger {
    flex: var(--actionbar-primary-flex, none);
  }

  /* A standalone link or link-styled button with a full 44 px target. Links inside sentences stay inline. */
  .link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    min-height: var(--control-height);
    color: var(--color-accent-text);
    font-weight: var(--weight-medium);
    text-decoration-line: underline;
    text-decoration-thickness: var(--border-hairline);
    text-underline-offset: var(--spacing-0-5);
    cursor: pointer;
  }
  .link:is(:hover, [data-force~='hover']) {
    color: var(--color-accent-pressed);
  }
  .link--plain {
    text-decoration-line: none;
  }
  .link--danger,
  .link--danger:is(:hover, [data-force~='hover']) {
    color: var(--color-danger-text);
  }

  .spinner {
    display: inline-block;
    flex: none;
    width: var(--spinner-size);
    height: var(--spinner-size);
    border: var(--border-strong) solid currentColor;
    border-inline-end-color: transparent;
    border-radius: var(--radius-round);
  }
  .spinner--sm {
    width: var(--spinner-size-sm);
    height: var(--spinner-size-sm);
  }

  /* Drawn icons (drawnIcons.js): one path with pathLength="1", so stroke-dasharray: 1 fits every shape. */
  .drawn {
    display: inline-block;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: var(--border-strong);
    stroke-linecap: square;
    stroke-linejoin: miter;
  }

  /* ============================ 3. Form controls ==================================================== */
  .field {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .field__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
    min-height: var(--leading-sm);
    margin-block-end: var(--spacing-1);
  }
  .field__label,
  .fieldset__legend {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }
  .field__optional {
    color: var(--color-text-subtle);
    font-weight: var(--weight-regular);
  }
  .field__req {
    color: var(--color-danger-text);
  }
  .field__action {
    min-height: var(--leading-sm);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
  }
  .field__help {
    margin-block-start: var(--spacing-1);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .field__error-text {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-1);
    margin-block-start: var(--spacing-1);
    color: var(--color-danger-text);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
  }
  .fieldset {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .fieldset__legend {
    margin-block-end: var(--spacing-1);
  }

  .input {
    display: block;
    width: 100%;
    min-width: 0;
    height: var(--control-height);
    padding: 0 var(--spacing-3);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
    appearance: none;
  }
  .input::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
  }
  .input:is(:hover, [data-force~='hover']) {
    border-color: var(--color-text-muted);
  }
  .input:is(:focus-visible, [data-force~='focus']) {
    border-color: var(--color-accent);
  }
  .input[aria-invalid='true'] {
    border-color: var(--color-danger);
  }
  .input:disabled {
    border-color: var(--color-border);
    background: var(--color-surface-3);
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }
  .input[readonly] {
    border-color: var(--color-border);
    background: transparent;
  }
  .input--mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }
  .input--amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: var(--weight-medium);
    text-align: end;
  }
  textarea.input {
    height: auto;
    min-height: calc(var(--leading-lg) * var(--textarea-lines-min) + 2 * var(--spacing-3));
    max-height: calc(var(--leading-lg) * var(--textarea-lines-max) + 2 * var(--spacing-3));
    padding-block: var(--spacing-3);
    overflow-y: auto;
  }
  textarea.input[data-autogrow] {
    resize: none;
  }
  input[type='date'].input {
    min-width: 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: start;
  }
  input[type='date'].input::-webkit-date-and-time-value {
    text-align: start;
  }
  input[type='search'].input::-webkit-search-cancel-button {
    appearance: none;
  }
  /* iOS zoom guard (README §12.3): below 768 px every input, select and textarea has 16 px text, or iOS Safari
     zooms the page into a focused field. (The 44 px height and the textarea's line maths already fit 16/24.) */
  @media (max-width: 767.98px) {
    .input,
    .palette__input {
      font-size: var(--text-lg);
      line-height: var(--leading-lg);
    }
  }

  /* Native select: appearance none plus a chevron icon. */
  .select {
    position: relative;
    display: block;
    min-width: 0;
  }
  .select > .input {
    padding-inline-end: calc(var(--spacing-3) + var(--icon-md) + var(--spacing-2));
    cursor: pointer;
    text-overflow: ellipsis;
  }
  .select > .input:disabled {
    cursor: not-allowed;
  }
  .select__chevron {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: var(--spacing-3);
    color: var(--color-text-muted);
    pointer-events: none;
    translate: 0 -50%;
  }

  /* Prefix / suffix adornments (the rupee sign, a search icon, the show-password toggle). */
  .input-group {
    display: flex;
    align-items: stretch;
    min-width: 0;
    min-height: var(--control-height);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
  }
  .input-group:is(:hover, [data-force~='hover']) {
    border-color: var(--color-text-muted);
  }
  .input-group:is(:focus-within, :has(> [data-force~='focus'])) {
    border-color: var(--color-accent);
  }
  .input-group:has(> .input:is(:focus-visible, [data-force~='focus'])) {
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: var(--focus-offset);
  }
  .input-group:has(> .input[aria-invalid='true']) {
    border-color: var(--color-danger);
  }
  .input-group:has(> .input:disabled) {
    border-color: var(--color-border);
    background: var(--color-surface-3);
    color: var(--color-text-subtle);
  }
  .input-group:has(> .input[readonly]) {
    border-color: var(--color-border);
    background: transparent;
  }
  .input-group > .input {
    flex: 1 1 0;
    height: auto;
    min-height: calc(var(--control-height) - 2 * var(--border-hairline));
    border: 0;
    background: transparent;
    outline: 0;
  }
  .input-group__affix {
    display: inline-flex;
    flex: none;
    align-items: center;
    padding-inline: var(--spacing-3) 0;
    color: var(--color-text-muted);
    white-space: nowrap;
  }
  .input-group > .input + .input-group__affix {
    padding-inline: 0 var(--spacing-3);
  }
  .input-group > .btn {
    align-self: stretch;
    min-height: 0;
    border: 0;
  }

  /* ============================ 4. Choice controls ================================================== */
  .checkbox,
  .radio {
    position: relative;
    display: inline-flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    min-width: var(--control-height);
    min-height: var(--control-height);
    padding-block: calc((var(--control-height) - var(--leading-md)) / 2);
    color: var(--color-text);
    cursor: pointer;
  }
  /* The real input is invisible and covers a 44 px square centred on the 18 px box. */
  .checkbox > input,
  .radio > input {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: calc((var(--checkbox-size) - var(--control-height)) / 2);
    width: var(--control-height);
    height: var(--control-height);
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }
  .checkbox__box,
  .radio__box {
    display: grid;
    flex: none;
    place-items: center;
    width: var(--checkbox-size);
    height: var(--checkbox-size);
    margin-block-start: var(--border-hairline);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-on-accent);
  }
  .checkbox__box svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: var(--border-strong);
    stroke-linecap: square;
  }
  .radio__dot {
    width: var(--radio-dot);
    height: var(--radio-dot);
    background: currentColor;
    opacity: 0;
    scale: calc(1 - var(--motion));
  }
  .checkbox:is(:hover, [data-force~='hover']) .checkbox__box,
  .radio:is(:hover, [data-force~='hover']) .radio__box {
    border-color: var(--color-text-muted);
  }
  .checkbox > input:checked + .checkbox__box,
  .radio > input:checked + .radio__box {
    border-color: var(--color-accent);
    background: var(--color-accent);
  }
  .radio > input:checked + .radio__box .radio__dot {
    opacity: 1;
    scale: 1;
  }
  .checkbox > input:is(:focus-visible, [data-force~='focus']) + .checkbox__box,
  .radio > input:is(:focus-visible, [data-force~='focus']) + .radio__box {
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: var(--focus-offset);
  }
  .checkbox > input[aria-invalid='true'] + .checkbox__box,
  .radio > input[aria-invalid='true'] + .radio__box,
  [role='radiogroup'][aria-invalid='true'] .radio > input:not(:checked, :disabled) + .radio__box {
    border-color: var(--color-danger);
  }
  .checkbox:has(> input:disabled),
  .radio:has(> input:disabled) {
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }
  .checkbox > input:disabled,
  .radio > input:disabled {
    cursor: not-allowed;
  }
  .checkbox > input:disabled + .checkbox__box,
  .radio > input:disabled + .radio__box {
    border-color: var(--color-border);
    background: var(--color-surface-3);
  }
  .checkbox > input:disabled:checked + .checkbox__box,
  .radio > input:disabled:checked + .radio__box {
    border-color: var(--color-border-control);
    background: var(--color-border-control);
  }
  .choice-list {
    display: flex;
    flex-direction: column;
  }

  /* Segmented control: a radio group in a surface-2 track. The selected segment's fill and 2 px accent
     rule are one pseudo-element, so segmented.js can slide it from the previous segment. */
  .segmented {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
  }
  .segmented--block {
    display: flex;
  }
  .segmented--block > .segmented__option {
    flex: 1 1 0;
  }
  .segmented__option {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    min-width: var(--control-height);
    min-height: calc(var(--control-height) - 2 * var(--border-hairline));
    padding-inline: var(--spacing-4);
    color: var(--color-text-muted);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    cursor: pointer;
  }
  .segmented__option + .segmented__option {
    border-inline-start: var(--border-hairline) solid var(--color-border);
  }
  .segmented__option > input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }
  .segmented__option:is(:hover, [data-force~='hover']) {
    color: var(--color-text);
  }
  .segmented__option:has(> input:checked) {
    color: var(--color-text);
  }
  .segmented__option:has(> input:checked)::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--color-surface-3);
    border-bottom: var(--border-strong) solid var(--color-accent);
  }
  .segmented__option:has(> input:is(:focus-visible, [data-force~='focus'])) {
    z-index: 1;
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: calc(-1 * var(--focus-ring));
  }
  .segmented__option:has(> input:disabled) {
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }
  .segmented__option:has(> input:disabled) > input {
    cursor: not-allowed;
  }

  /* Category picker: a radiogroup grid of square tiles, 3 columns on compact and 4 on wide. The picker measures
     its own width (a container): a label keeps its words whole, so a column is never narrower than "Accommodation"
     needs. 4 columns on wide only when they have that room (a laptop's narrow form column keeps 3); 2 on the
     narrowest phones (320 px). */
  .fieldset:has(> .tiles) {
    container-type: inline-size;
  }
  .tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-2);
  }
  @container (max-width: 339.98px) {
    .tiles {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  @media (min-width: 1024px) {
    @container (min-width: 520px) {
      .tiles {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }
  }
  .tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
    min-height: var(--tile-min-height);
    padding: var(--spacing-2);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
    cursor: pointer;
  }
  .tile > input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }
  .tile__icon {
    color: var(--color-text-muted);
  }
  .tile__label {
    display: -webkit-box;
    overflow: hidden;
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
    overflow-wrap: break-word; /* a word breaks only if it cannot fit a line on its own */
    hyphens: manual;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--line-clamp);
    line-clamp: var(--line-clamp);
  }
  .tile__check {
    position: absolute;
    inset-block-start: var(--spacing-2);
    inset-inline-end: var(--spacing-2);
    color: var(--color-accent-text);
    opacity: 0;
  }
  .tile:is(:hover, [data-force~='hover']) {
    border-color: var(--color-text-muted);
    background: var(--color-surface-3);
  }
  .tile:has(> input:checked) {
    border-color: var(--color-accent);
    background: var(--color-accent-wash);
  }
  .tile:has(> input:checked) .tile__icon {
    color: var(--color-accent-text);
  }
  .tile:has(> input:checked) .tile__check {
    opacity: 1;
  }
  /* Safari does not apply :focus-visible to a radio that the arrow keys moved to, so the tile shows the ring on any
     focus of its radio (a click also focuses it: the ring then marks the choice just made). */
  .tile:has(> input:is(:focus-visible, :focus, [data-force~='focus'])) {
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: var(--focus-offset);
  }
  .tile:has(> input:disabled) {
    border-color: var(--color-border);
    background: var(--color-surface-2);
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }
  .tile:has(> input:disabled) > input {
    cursor: not-allowed;
  }
  .tile:has(> input:disabled) .tile__icon {
    color: var(--color-text-subtle);
  }
  [aria-invalid='true'] > .tiles .tile:not(:has(> input:checked)),
  .tiles[aria-invalid='true'] .tile:not(:has(> input:checked)) {
    border-color: var(--color-danger);
  }
  /* Optical fix on a phone: three tiles across a 390 px screen leave room for "Accommodation" on one line only
     with 6 px at the sides. */
  @media (max-width: 767.98px) {
    .tile {
      padding-inline: var(--spacing-1-5);
    }
  }
  @media (min-width: 768px) {
    .tile {
      padding: var(--spacing-3);
    }
    .tile__check {
      inset-block-start: var(--spacing-3);
      inset-inline-end: var(--spacing-3);
    }
  }

  /* Quick-pick chips: square toggles (aria-pressed), never pills. */
  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
  }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--control-height);
    padding-inline: var(--spacing-3);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
  }
  .chip:is(:hover, [data-force~='hover']) {
    border-color: var(--color-text-muted);
    background: var(--color-surface-3);
  }
  .chip[aria-pressed='true'] {
    border-color: var(--color-accent);
    background: var(--color-accent-wash);
  }
  .chip > .drawn {
    display: none;
    color: var(--color-accent-text);
  }
  .chip[aria-pressed='true'] > .drawn {
    display: inline-block;
  }
  .chip:disabled {
    border-color: var(--color-border);
    background: var(--color-surface-2);
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }

  /* ============================ 5. Status, badge, avatar ============================================ */
  /* <span class="status" data-status="submitted"><span class="status__dot"></span>Pending approval</span>
     An 8 px dot plus a text label, everywhere. Never colour alone. */
  .status {
    --dot-color: var(--color-status-neutral);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    color: var(--color-text);
  }
  .status__dot {
    position: relative;
    flex: none;
    width: var(--status-dot);
    height: var(--status-dot);
    border-radius: var(--radius-round);
    background: var(--dot-color);
  }
  .status[data-status='draft'],
  .status[data-status='withdrawn'],
  .status[data-tone='neutral'] {
    --dot-color: var(--color-status-neutral);
  }
  .status[data-status='submitted'],
  .status[data-tone='warning'] {
    --dot-color: var(--color-status-pending);
  }
  .status[data-status='approved'],
  .status[data-tone='info'] {
    --dot-color: var(--color-status-approved);
  }
  .status[data-status='settled'],
  .status[data-tone='success'] {
    --dot-color: var(--color-status-settled);
  }
  .status[data-status='rejected'],
  .status[data-tone='danger'] {
    --dot-color: var(--color-status-rejected);
  }
  @media (forced-colors: active) {
    .status__dot {
      outline: var(--border-hairline) solid CanvasText;
    }
  }

  /* Badges are for counts only. The accent variant marks a count that needs the user's action. */
  .badge {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-width: var(--badge-size);
    height: var(--badge-size);
    padding-inline: var(--spacing-1);
    background: var(--color-surface-3);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
  }
  .badge--accent {
    background: var(--color-accent);
    color: var(--color-on-accent);
  }

  .avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: var(--avatar-md);
    height: var(--avatar-md);
    border-radius: var(--radius-round);
    background: var(--color-surface-3);
    color: var(--color-text);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-semibold);
    user-select: none;
  }
  .avatar--sm {
    width: var(--avatar-sm);
    height: var(--avatar-sm);
    font-weight: var(--weight-medium);
  }
  /* Avatar, name and a second line (department or email), used in tables and menus. */
  .person {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
  }
  .person__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .person__name,
  .person__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .person__meta {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }

  /* ============================ 6. Cards, KPI tiles, amounts ======================================== */
  .card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    min-width: 0;
    padding: var(--spacing-4);
    background: var(--color-surface-1);
    border: var(--border-hairline) solid var(--color-border);
  }
  @media (min-width: 1024px) {
    .card {
      padding: var(--spacing-6);
    }
  }
  .card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
    min-width: 0;
  }
  .card__title,
  .section__title {
    min-width: 0;
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
    font-weight: var(--weight-semibold);
  }

  .kpi {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
    padding: var(--spacing-4);
    background: var(--color-surface-1);
    border: var(--border-hairline) solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
  }
  a.kpi:is(:hover, [data-force~='hover']) {
    border-color: var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
  }
  a.kpi:is(:active, [data-force~='active']) {
    background: var(--color-surface-3);
  }
  .kpi__label {
    min-height: calc(var(--leading-sm) * 2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }
  .kpi__value {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-size: clamp(var(--text-md), var(--kpi-fluid-size), var(--text-kpi));
    line-height: var(--leading-kpi);
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .kpi__sub {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }

  .amount {
    font-family: var(--font-mono);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  /* The hero amount: large mono numerals, the rupee sign at 0.65 em and muted, the paise muted. */
  .hero-amount {
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    line-height: var(--leading-3xl);
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  @media (min-width: 768px) {
    .hero-amount {
      font-size: var(--text-4xl);
      line-height: var(--leading-4xl);
    }
  }
  .hero-amount__symbol {
    color: var(--color-text-muted);
    font-size: var(--hero-symbol-size);
  }
  .hero-amount__paise {
    color: var(--color-text-muted);
  }

  /* ============================ 7. Data tables and list rows ======================================== */
  /* One shared column system: fixed widths for number, date, amount and status; the text column flexes
     and truncates. Skeleton rows, the empty row and totals use the same <colgroup>. */
  .datatable {
    min-width: 0;
  }
  /* A table that scrolls sideways inside its box (dataTable({ scroll }), fitTable()). The box is now the header's
     scroll container and does not scroll vertically: the header sticks to its top, not under the top bar (the
     shared offset would push it down over the first row). */
  .datatable--scroll {
    --table-sticky-top: 0px;
    overflow-x: auto;
  }
  .table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
  }
  .table th,
  .table td {
    padding: 0 var(--spacing-3);
    overflow: hidden;
    border-bottom: var(--border-hairline) solid var(--color-border);
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
  }
  .table th:first-child,
  .table td:first-child {
    padding-inline-start: var(--panel-inset, var(--spacing-4));
  }
  .table th:last-child,
  .table td:last-child {
    padding-inline-end: var(--panel-inset, var(--spacing-4));
  }
  /* Headers are interface text (12/16 medium, sans) whatever the column's cell role: the role classes on <th>
     only keep the alignment (an amount header sits on the amounts' right edge). */
  .table th {
    position: sticky;
    top: var(--table-sticky-top, 0);
    z-index: 1;
    height: var(--control-height);
    background: var(--color-surface-1);
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
    font-variant-numeric: normal;
  }
  .table td {
    height: var(--table-row-height);
  }
  .table tbody tr:last-child td {
    border-bottom: 0;
  }
  .table tbody tr.row {
    cursor: pointer;
  }
  .table tbody tr.row:is(:hover, [data-force~='hover']) td {
    background: var(--color-surface-2);
  }
  .table tbody tr.row:has(a:is(:focus-visible, [data-force~='focus'])) td {
    background: var(--color-accent-wash);
  }
  .table tbody tr.row:is(:active, [data-force~='active']) td {
    background: var(--color-surface-3);
  }
  .table__link {
    color: inherit;
    text-decoration: none;
  }
  .table__link:is(:hover, [data-force~='hover']) {
    color: inherit;
  }
  .table tfoot td {
    border-top: var(--border-hairline) solid var(--color-border);
    border-bottom: 0;
    background: var(--color-surface-1);
    font-weight: var(--weight-semibold);
  }
  .table .table__state td {
    height: auto;
    padding: 0;
    white-space: normal;
  }

  /* Column widths (on <col>) and cell roles (on <th> and <td>). */
  .col--claim-no {
    width: var(--col-claim-no);
  }
  .col--category {
    width: var(--col-category);
  }
  .col--date {
    width: var(--col-date);
  }
  .col--amount {
    width: var(--col-amount);
  }
  .col--status {
    width: var(--col-status);
  }
  .col--updated {
    width: var(--col-updated);
  }
  .col--waiting {
    width: var(--col-waiting);
  }
  .col--person {
    width: var(--col-person);
  }
  .col--count {
    width: var(--col-count);
  }
  .col--action {
    width: var(--col-action);
  }
  .col--action-lg {
    width: var(--col-action-lg);
  }
  .cell--end {
    text-align: end;
  }
  .cell--claim-no {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
  }
  .cell--date,
  .cell--mono {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-variant-numeric: tabular-nums;
  }
  .cell--amount {
    font-family: var(--font-mono);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    text-align: end;
  }
  .cell--status {
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
  }
  .table td.cell--status {
    white-space: normal;
  }
  .cell--status .status {
    align-items: flex-start;
  }
  .cell--status .status__dot {
    margin-block-start: calc((var(--leading-sm) - var(--status-dot)) / 2);
  }
  .cell__primary,
  .cell__secondary {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cell__secondary {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .cell__icon {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    max-width: 100%;
    min-width: 0;
  }
  .cell__icon > .icon {
    color: var(--color-text-muted);
  }
  .cell__icon > span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  [data-tone='warning'].cell--mono,
  .tone-warning {
    color: var(--color-status-pending);
  }
  [data-tone='danger'].cell--mono,
  .tone-danger {
    color: var(--color-status-rejected);
  }
  /* Below wide, drop the columns a view marks as secondary; below medium the list rows take over. */
  @media (max-width: 1023.98px) {
    .table .wide-only {
      display: none;
    }
  }
  @media (max-width: 767.98px) {
    .datatable[data-compact='rows'] > .table {
      display: none;
    }
  }
  @media (min-width: 768px) {
    .datatable[data-compact='rows'] > .rows {
      display: none;
    }
  }

  /* List rows (compact): the same two-line structure for every row, at least 64 px tall. */
  .rows {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .row {
    min-width: 0;
  }
  .rows > .row + .row {
    border-top: var(--border-hairline) solid var(--color-border);
  }
  .rows > .row:is(:hover, [data-force~='hover']) {
    background: var(--color-surface-2);
  }
  .rows > .row:is(:active, [data-force~='active']) {
    background: var(--color-surface-3);
  }
  /* The two lines are laid out apart: line 1's purpose flexes against the amount only, line 2's claim number and
     date against the status only (one shared right-hand column would be as wide as the longest status label and
     cut the purpose on a phone). A zero-height break item ends line 1. When even the claim number would not fit
     beside a long status (a 320 px screen), the status takes a line of its own, on the right. */
  .row__link {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    column-gap: var(--spacing-3);
    width: 100%;
    min-height: var(--list-row-min-height);
    padding: var(--spacing-3) var(--panel-inset, var(--spacing-4));
    color: var(--color-text);
    text-decoration: none;
  }
  /* The command palette's claim and person results are the same two lines (README §12.5). */
  .palette__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--spacing-3);
    min-width: 0;
  }
  :is(.row__link, .palette__row)::after {
    content: '';
    flex-basis: 100%;
    order: 1;
  }
  :is(.row__link, .palette__row) > :nth-child(odd) {
    flex: 1 1 0;
    min-width: 0;
  }
  :is(.row__link, .palette__row) > :nth-child(even) {
    flex: none;
    max-width: 100%;
    margin-inline-start: auto;
  }
  :is(.row__link, .palette__row) > :nth-child(n + 3) {
    order: 2;
    margin-block-start: var(--spacing-1);
  }
  :is(.row__link, .palette__row) > .row__meta {
    flex: 1 1 var(--row-meta-min);
  }
  /* When the claim number and the date take two lines, the status stays level with the number. */
  :is(.row__link, .palette__row) > .row__status {
    align-self: flex-start;
  }
  .row__link:is(:hover, [data-force~='hover']) {
    color: var(--color-text);
  }
  .row__link:is(:focus-visible, [data-force~='focus']) {
    background: var(--color-accent-wash);
    outline-offset: calc(-1 * var(--focus-ring));
  }
  .row__title {
    overflow: hidden;
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .row__amount {
    font-family: var(--font-mono);
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
    text-align: end;
    white-space: nowrap;
  }
  .row__meta {
    /* Room for a claim number (14 mono characters) beside the status before the status moves down. */
    --row-meta-min: 14ch;
    overflow: hidden;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-sm);
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* A claim row's meta is made of parts (number, date): when they do not fit on one line the date goes under the
     number instead of being cut. */
  .row__meta:has(> .row__meta-part) {
    white-space: normal;
  }
  .row__meta-part {
    white-space: nowrap;
  }
  /* Line 2 in words (a person's email), not a number: the interface font. */
  .row__meta--text {
    font-family: var(--font-sans);
    font-variant-numeric: normal;
  }
  .row__status {
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    white-space: nowrap;
  }

  /* ============================ 8. Overlays ========================================================= */
  /* Dialog: native <dialog>, surface-1, hairline border, max 560 px. dialog.js adds .dialog--sheet < 768 px. */
  /* The column is set on every dialog, not only an open one: while a dialog fades out it has lost [open] but
     is still painted (display transitions with allow-discrete), and it must close looking as it did. */
  .dialog {
    flex-direction: column;
    width: min(var(--dialog-max), calc(100% - 2 * var(--spacing-4)));
    max-width: none;
    max-height: calc(100% - 2 * var(--spacing-6));
    margin: auto;
    overflow: hidden;
    border: var(--border-hairline) solid var(--color-border);
    background: var(--color-surface-1);
    color: var(--color-text);
  }
  .dialog[open] {
    display: flex;
  }
  .dialog--wide {
    width: min(var(--form-max), calc(100% - 2 * var(--spacing-4)));
  }
  .dialog__handle {
    display: none;
  }
  .dialog__header {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
    min-height: var(--topbar-height);
    padding-inline: var(--spacing-6) var(--spacing-3);
    border-bottom: var(--border-hairline) solid var(--color-border);
  }
  .dialog__title {
    min-width: 0;
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
    font-weight: var(--weight-semibold);
  }
  .dialog__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--spacing-4);
    min-height: 0;
    padding: var(--spacing-6);
    overflow-y: auto;
  }
  .dialog__footer {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--spacing-3);
    padding: var(--spacing-4) var(--spacing-6);
    border-top: var(--border-hairline) solid var(--color-border);
  }
  .dialog__footer > [data-align='start'] {
    margin-inline-end: auto;
  }
  /* Bottom sheet: full width, at most 90 vh, with a drag handle. */
  .dialog--sheet {
    width: 100%;
    max-height: var(--sheet-max-height);
    margin: auto 0 0;
    padding-block-end: env(safe-area-inset-bottom, 0px);
    border-inline: 0;
    border-bottom: 0;
  }
  .dialog--sheet .dialog__handle {
    display: grid;
    flex: none;
    place-items: center;
    height: var(--spacing-6);
    cursor: grab;
    touch-action: none;
  }
  .dialog--sheet .dialog__handle::before {
    content: '';
    width: var(--sheet-handle-width);
    height: var(--sheet-handle-height);
    background: var(--color-border-control);
  }
  .dialog--sheet .dialog__header {
    min-height: var(--control-height);
    padding-inline: var(--spacing-4) var(--spacing-1);
    border-bottom: 0;
    touch-action: none;
  }
  .dialog--sheet .dialog__body {
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-4);
  }
  .dialog--sheet .dialog__footer {
    flex-wrap: nowrap;
    padding: var(--spacing-3) var(--spacing-4);
  }
  .dialog--sheet .dialog__footer > .btn {
    flex: 1 1 0;
    min-height: var(--control-height-lg);
  }
  /* A full-height sheet (openDialog({ fullHeight: true })): always as tall as a sheet may be, the body scrolls
     and the footer stays at the bottom edge. */
  .dialog--sheet.dialog--full {
    height: var(--sheet-max-height);
  }

  /* Menu / popover (Popover API where available; [data-open] is the fallback). menu.js sets the position. */
  .menu,
  .tooltip {
    position: fixed;
    inset: auto;
    inset-block-start: var(--popover-top, 0);
    inset-inline-start: var(--popover-left, 0);
    z-index: var(--z-overlay);
    display: none;
    margin: 0;
    color: var(--color-text);
  }
  .menu:popover-open,
  .tooltip:popover-open {
    display: block;
  }
  .menu[data-open],
  .tooltip[data-open] {
    display: block;
  }
  .menu {
    min-width: var(--menu-min-width);
    max-width: min(var(--menu-max-width), calc(100% - 2 * var(--spacing-4)));
    max-height: calc(100% - 2 * var(--spacing-4));
    padding: var(--spacing-1) 0;
    overflow-y: auto;
    border: var(--border-hairline) solid var(--color-border);
    background: var(--color-surface-1);
  }
  .menu__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    min-width: 0;
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-3);
    margin-block-end: var(--spacing-1);
    border-bottom: var(--border-hairline) solid var(--color-border);
  }
  .menu__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    width: 100%;
    min-height: var(--control-height);
    padding-inline: var(--spacing-4);
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
  }
  .menu__item > .icon {
    color: var(--color-text-muted);
  }
  .menu__item:is(:hover, [data-force~='hover']),
  .menu__item:is(:focus-visible, [data-force~='focus']) {
    background: var(--color-surface-2);
    color: var(--color-text);
  }
  .menu__item:is(:focus-visible, [data-force~='focus']) {
    outline-offset: calc(-1 * var(--focus-ring));
  }
  .menu__item:is(:active, [data-force~='active']) {
    background: var(--color-surface-3);
  }
  .menu__item--danger,
  .menu__item--danger:is(:hover, [data-force~='hover']),
  .menu__item--danger > .icon {
    color: var(--color-danger-text);
  }
  .menu__item[aria-disabled='true'],
  .menu__item[aria-disabled='true'] > .icon {
    color: var(--color-text-subtle);
    cursor: not-allowed;
  }
  .menu__item[aria-disabled='true']:is(:hover, [data-force~='hover']) {
    background: transparent;
  }
  .menu__separator {
    margin-block: var(--spacing-1);
    border-top: var(--border-hairline) solid var(--color-border);
  }

  .tooltip {
    z-index: var(--z-toast);
    max-width: var(--tooltip-max-width);
    padding: var(--spacing-1) var(--spacing-2);
    border: var(--border-hairline) solid var(--color-border);
    background: var(--color-surface-3);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    pointer-events: none;
  }

  /* Command palette: a top-anchored dialog with a search input and grouped results. */
  .dialog.palette {
    margin-block-start: var(--palette-offset);
  }
  .palette__search {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--spacing-3);
    min-height: var(--topbar-height);
    padding-inline: var(--spacing-4) var(--spacing-1);
    border-bottom: var(--border-hairline) solid var(--color-border);
    color: var(--color-text-muted);
  }
  .palette__input {
    flex: 1 1 0;
    min-width: 0;
    height: var(--control-height);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-text);
    outline: 0;
  }
  .palette__input::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
  }
  .palette__search:has(.palette__input:is(:focus-visible, [data-force~='focus'])) {
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: calc(-1 * var(--focus-ring));
  }
  .palette__list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: var(--palette-list-max);
    padding-block: var(--spacing-1);
    overflow-y: auto;
  }
  .palette__group-title {
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-1);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
  }
  .palette__option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--spacing-3);
    align-items: center;
    min-height: var(--control-height);
    padding: var(--spacing-1) var(--spacing-4);
    cursor: pointer;
  }
  .palette__option > .icon {
    color: var(--color-text-muted);
  }
  /* A claim or a person: the icon, then the two list-row lines. */
  .palette__option--row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding-block: var(--spacing-2);
  }
  .palette__option:is(:hover, [data-force~='hover']) {
    background: var(--color-surface-2);
  }
  .palette__option[aria-selected='true'] {
    background: var(--color-accent-wash);
  }
  .palette__option-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .palette__option-meta {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    white-space: nowrap;
  }
  .palette__empty {
    padding: var(--spacing-6) var(--spacing-4);
    color: var(--color-text-muted);
    text-align: center;
  }
  .palette__hints {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-4);
    padding: var(--spacing-2) var(--spacing-4);
    border-top: var(--border-hairline) solid var(--color-border);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .palette__hints > span {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
  }

  /* Viewer (lightbox): a full-screen <dialog> on the light canvas. */
  .lightbox {
    position: fixed;
    inset: 0;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    overflow: hidden;
    background: var(--color-bg);
    color: var(--color-text);
  }
  .lightbox[open] {
    display: flex;
  }
  .lightbox__bar {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--spacing-1);
    min-height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
    padding-block-start: env(safe-area-inset-top, 0px);
    padding-inline: var(--spacing-4) var(--spacing-1);
    background: var(--color-surface-1);
    border-bottom: var(--border-hairline) solid var(--color-border);
  }
  .lightbox__name {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lightbox__count {
    flex: none;
    padding-inline: var(--spacing-2);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    white-space: nowrap;
  }
  .lightbox__stage {
    position: relative;
    display: grid;
    flex: 1 1 0;
    place-items: center;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
  }
  .lightbox__slide {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: var(--spacing-4);
    grid-area: 1 / 1;
  }
  .lightbox__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
    translate: var(--pan-x, 0) var(--pan-y, 0);
    scale: var(--zoom, 1);
  }
  .lightbox__image[data-zoomed] {
    cursor: grab;
  }
  .lightbox__frame {
    width: 100%;
    height: 100%;
    border: var(--border-hairline) solid var(--color-border);
    background: var(--color-surface-1);
  }
  .lightbox__nav {
    position: absolute;
    inset-block-start: 50%;
    z-index: 1;
    translate: 0 -50%;
  }
  .lightbox__nav--prev {
    inset-inline-start: var(--spacing-2);
  }
  .lightbox__nav--next {
    inset-inline-end: var(--spacing-2);
  }

  /* ============================ 9. Feedback: toasts, banners, save status =========================== */
  /* Under the top bar, and under the offline banner while it is open (shell.js measures them). */
  .toasts {
    position: fixed;
    inset: auto;
    inset-block-start: calc(
      var(--shell-top-inset, calc(var(--topbar-height) + env(safe-area-inset-top, 0px))) + var(--spacing-2)
    );
    inset-inline: var(--spacing-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2);
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    color: inherit;
    pointer-events: none;
  }
  @media (min-width: 1024px) {
    .toasts {
      inset-block-start: calc(var(--shell-top-inset, var(--topbar-height)) + var(--spacing-4));
      inset-inline: auto var(--spacing-6);
      align-items: flex-end;
      width: var(--toast-width);
    }
  }
  .toast,
  .banner {
    --tone: var(--color-accent);
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: var(--spacing-3);
    align-items: start;
    min-width: 0;
    border: var(--border-hairline) solid var(--color-border);
    border-inline-start: var(--border-strong) solid var(--tone);
    background: var(--color-surface-2);
    color: var(--color-text);
  }
  :is(.toast, .banner)[data-kind='success'] {
    --tone: var(--color-status-settled);
  }
  :is(.toast, .banner)[data-kind='warning'] {
    --tone: var(--color-status-pending);
  }
  :is(.toast, .banner)[data-kind='error'] {
    --tone: var(--color-status-rejected);
  }
  .toast {
    width: 100%;
    max-width: var(--toast-width);
    padding-inline-start: var(--spacing-3);
    overflow: hidden;
    pointer-events: auto;
  }
  .toast__icon,
  .banner__icon {
    margin-block: calc((var(--control-height) - var(--icon-md)) / 2);
    color: var(--tone);
  }
  .toast__content,
  .banner__content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-0-5);
    min-width: 0;
    padding-block: calc((var(--control-height) - var(--leading-md)) / 2);
  }
  .toast__title,
  .banner__title {
    font-weight: var(--weight-semibold);
  }
  .toast__message,
  .banner__message {
    color: var(--color-text-muted);
  }
  .toast__actions {
    display: flex;
    align-items: center;
  }
  .toast__timer {
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    height: var(--timer-height);
    background: var(--tone);
  }
  .banner {
    padding-inline: var(--spacing-3) var(--spacing-1);
  }
  .banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
  }
  .banner__content > .banner__actions {
    margin-block-start: var(--spacing-1);
  }
  .banner:not(:has(> .banner__actions)) {
    padding-inline-end: var(--spacing-3);
  }
  /* Full-bleed banner under the top bar (offline). Its icon lines up with the page title and the content
     (the shell's inset, less the 2 px rule). */
  .banner--flush {
    padding-inline-start: calc(var(--content-inset, var(--spacing-4)) - var(--border-strong));
    border-block-start: 0;
    border-inline-end: 0;
  }

  .save-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1-5);
    min-height: var(--leading-md);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    white-space: nowrap;
  }
  /* Nothing to say yet: no height, so the compact top bar keeps its title centred until the first save. */
  .save-status[data-state='idle'] {
    min-height: 0;
  }
  .save-status .drawn {
    color: var(--color-status-settled);
  }
  .save-status[data-state='error'] {
    color: var(--color-danger-text);
  }

  /* Error summary at the top of a form: a list of links to the fields (README §12.6). */
  .error-summary {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-3) var(--spacing-4);
    border: var(--border-hairline) solid var(--color-danger);
    border-inline-start-width: var(--border-strong);
    background: var(--color-surface-2);
  }
  .error-summary__title {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-semibold);
  }
  .error-summary__title > .icon {
    color: var(--color-danger-text);
  }
  .error-summary__list {
    display: flex;
    flex-direction: column;
    padding-inline-start: calc(var(--icon-md) + var(--spacing-2));
  }
  .error-summary__list .link {
    color: var(--color-danger-text);
  }

  /* ============================ 10. Files: dropzone, tiles ========================================== */
  .dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-1);
    min-height: var(--dropzone-min-height);
    padding: var(--spacing-4);
    border: var(--border-hairline) dashed var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
    text-align: center;
  }
  .dropzone__icon {
    margin-block-end: var(--spacing-1);
    color: var(--color-text-muted);
  }
  .dropzone__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: var(--spacing-1);
  }
  .dropzone__hint {
    max-width: var(--measure);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .dropzone__drop,
  .dropzone__compact {
    display: none;
  }
  .dropzone[data-dragover] {
    border-color: var(--color-accent);
    background: var(--color-accent-wash);
  }
  .dropzone[data-dragover] .dropzone__icon {
    color: var(--color-accent-text);
    translate: 0 calc(-1 * var(--motion-distance-sm));
  }
  .dropzone[data-dragover] .dropzone__title,
  .dropzone[data-dragover] .dropzone__hint {
    display: none;
  }
  .dropzone[data-dragover] .dropzone__drop {
    display: block;
    min-height: var(--control-height);
    font-weight: var(--weight-semibold);
    line-height: var(--control-height);
  }
  .dropzone[aria-invalid='true'] {
    border-color: var(--color-danger);
  }
  .dropzone[aria-disabled='true'] {
    border-color: var(--color-border);
    color: var(--color-text-subtle);
  }
  /* Compact: two large buttons, Take photo and Choose file. [data-variant] forces a variant in the gallery. */
  .dropzone[data-variant='compact'] {
    align-items: stretch;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .dropzone[data-variant='compact'] > :is(.dropzone__icon, .dropzone__title, .dropzone__drop) {
    display: none;
  }
  .dropzone[data-variant='compact'] > .dropzone__compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-3);
  }
  /* Two large buttons side by side: the lg button's 24 px sides would cut "Take photo" and "Choose file" short
     at 320 px, so these keep 12 px. */
  .dropzone__compact > .btn {
    padding-inline: var(--spacing-3);
  }
  @media (max-width: 767.98px) {
    .dropzone:not([data-variant='wide']) {
      align-items: stretch;
      min-height: 0;
      padding: 0;
      border: 0;
      background: transparent;
    }
    .dropzone:not([data-variant='wide']) > :is(.dropzone__icon, .dropzone__title, .dropzone__drop) {
      display: none;
    }
    .dropzone:not([data-variant='wide']) > .dropzone__compact {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--spacing-3);
    }
  }

  .file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--file-tile-min), 1fr));
    gap: var(--spacing-3);
  }
  .file-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: var(--border-hairline) solid var(--color-border);
    background: var(--color-surface-1);
  }
  .file-tile__open {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    background: var(--color-surface-2);
    border-bottom: var(--border-hairline) solid var(--color-border);
    aspect-ratio: var(--ratio-a4);
    cursor: zoom-in;
  }
  .file-tile__open:is(:focus-visible, [data-force~='focus']) {
    outline-offset: calc(-1 * var(--focus-ring));
  }
  .file-tile__open:disabled {
    cursor: default;
  }
  .file-tile__preview {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
  }
  .file-tile__preview > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .file-tile__doc {
    display: grid;
    gap: var(--spacing-1);
    justify-items: center;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
  }
  .file-tile__body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-0-5);
    min-width: 0;
    padding: var(--spacing-2);
  }
  .file-tile__name {
    overflow: hidden;
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-tile__meta {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .file-tile__state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1);
    min-height: var(--leading-xs);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .file-tile__state .drawn {
    color: var(--color-status-settled);
  }
  .file-tile__state .link {
    min-height: var(--control-height);
    font-size: var(--text-xs);
  }
  .file-tile[data-state='queued'] .file-tile__name {
    color: var(--color-text-subtle);
  }
  .file-tile[data-state='error'] {
    border-color: var(--color-danger);
  }
  .file-tile[data-state='error'] .file-tile__state {
    color: var(--color-danger-text);
    font-weight: var(--weight-medium);
  }
  .file-tile__warning {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-1);
    color: var(--color-status-pending);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-medium);
  }
  .file-tile__remove {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    display: grid;
    place-items: center;
    width: var(--control-height);
    height: var(--control-height);
    color: var(--color-text);
  }
  .file-tile__remove > span {
    display: grid;
    place-items: center;
    width: var(--icon-box);
    height: var(--icon-box);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-1);
  }
  .file-tile__remove:is(:hover, [data-force~='hover']) > span {
    background: var(--color-surface-3);
  }
  /* Upload progress along the tile's bottom edge: the track stays still, only .upload__bar moves. */
  .upload {
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    height: var(--timer-height);
    background: var(--color-border);
    opacity: 0;
  }
  .upload__bar {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
  }
  [data-state='uploading'] > .file-tile__open > .upload,
  .upload[data-active] {
    opacity: 1;
  }

  /* ============================ 11. Claim parts: progress rail, timeline, details =================== */
  /* Three 12 px square nodes on a stationary 2 px track. Only .rail__fill moves (motion.css). */
  .rail {
    --rail-surface: var(--color-bg);
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }
  :is(.card, .panel, .dialog, .kpi) .rail {
    --rail-surface: var(--color-surface-1);
  }
  .rail__track {
    position: absolute;
    inset-block-start: calc((var(--rail-node) - var(--timer-height)) / 2);
    inset-inline-start: calc(var(--rail-node) / 2);
    width: calc(100% / 3 * 2);
    height: var(--timer-height);
    background: var(--color-border);
  }
  .rail__fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
  }
  .rail__step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-0-5);
    min-width: 0;
    padding-inline-end: var(--spacing-3);
  }
  .rail__node {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--rail-node);
    height: var(--rail-node);
    margin-block-end: var(--spacing-2);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--rail-surface);
    color: var(--color-on-accent);
  }
  .rail__step[data-state='done'] > .rail__node {
    border-color: var(--color-accent);
    background: var(--color-accent);
  }
  .rail__step[data-state='current'] > .rail__node {
    border: var(--border-strong) solid var(--color-accent);
  }
  .rail__step[data-state='ended'] > .rail__node {
    border-color: var(--dot-color, var(--color-status-neutral));
    background: var(--dot-color, var(--color-status-neutral));
  }
  .rail__node > .drawn {
    width: 100%;
    height: 100%;
  }
  .rail__label {
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }
  .rail__step[data-state='future'] > .rail__label {
    color: var(--color-text-muted);
  }
  .rail__meta {
    color: var(--color-text-subtle);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    overflow-wrap: anywhere;
  }
  :is(.rail__step, .timeline__item)[data-status='submitted'] {
    --dot-color: var(--color-status-pending);
  }
  :is(.rail__step, .timeline__item)[data-status='approved'] {
    --dot-color: var(--color-status-approved);
  }
  :is(.rail__step, .timeline__item)[data-status='settled'] {
    --dot-color: var(--color-status-settled);
  }
  :is(.rail__step, .timeline__item)[data-status='rejected'] {
    --dot-color: var(--color-status-rejected);
  }

  /* Timeline: an 8 px dot in the event's status colour, a title, a mono timestamp, optional detail. */
  .timeline {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .timeline__item {
    --dot-color: var(--color-status-neutral);
    position: relative;
    display: grid;
    grid-template-columns: var(--status-dot) minmax(0, 1fr) auto;
    column-gap: var(--spacing-3);
    align-items: start;
    padding-block-end: var(--spacing-4);
  }
  .timeline__item:last-child {
    padding-block-end: 0;
  }
  .timeline__item::before {
    content: '';
    position: absolute;
    inset-block: calc(var(--leading-md) / 2) calc(-1 * var(--leading-md) / 2);
    inset-inline-start: calc((var(--status-dot) - var(--border-hairline)) / 2);
    width: var(--border-hairline);
    background: var(--color-border);
  }
  .timeline__item:last-child::before {
    display: none;
  }
  .timeline__dot {
    position: relative;
    width: var(--status-dot);
    height: var(--status-dot);
    margin-block-start: calc((var(--leading-md) - var(--status-dot)) / 2);
    border-radius: var(--radius-round);
    background: var(--dot-color);
  }
  .timeline__title {
    min-width: 0;
    font-weight: var(--weight-medium);
  }
  .timeline__time {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-md);
    white-space: nowrap;
  }
  .timeline__detail {
    grid-column: 2 / -1;
    margin-block-start: var(--spacing-2);
    padding-inline-start: var(--spacing-3);
    border-inline-start: var(--border-strong) solid var(--color-border);
    color: var(--color-text-muted);
  }
  @media (forced-colors: active) {
    .timeline__dot {
      outline: var(--border-hairline) solid CanvasText;
    }
  }

  /* Details: term and value pairs on one shared axis; stacked on compact. */
  .details {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }
  .details > dt {
    padding-block-start: var(--spacing-3);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .details > dt:first-child {
    padding-block-start: 0;
  }
  .details > dd {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  @media (min-width: 768px) {
    .details {
      grid-template-columns: var(--details-term-width) minmax(0, 1fr);
      gap: var(--spacing-3) var(--spacing-4);
    }
    .details > dt {
      padding-block-start: 0;
      color: var(--color-text-muted);
      font-size: var(--text-md);
      line-height: var(--leading-md);
    }
  }

  /* ============================ 12. States: skeleton, empty, error panel ============================ */
  .skeleton {
    display: block;
    height: var(--spacing-3);
    background: var(--color-skeleton);
  }
  .skeleton--w-25 {
    width: 25%;
  }
  .skeleton--w-40 {
    width: 40%;
  }
  .skeleton--w-60 {
    width: 60%;
  }
  .skeleton--w-80 {
    width: 80%;
  }
  .skeleton--title {
    height: var(--leading-md);
  }
  .skeleton--value {
    height: var(--leading-xl);
    margin-block: calc((var(--leading-kpi) - var(--leading-xl)) / 2);
  }
  .skeleton--block {
    height: var(--spacing-16);
  }
  .skeleton--tile {
    height: auto;
    aspect-ratio: var(--ratio-a4);
  }
  .skeleton--avatar {
    width: var(--avatar-sm);
    height: var(--avatar-sm);
    border-radius: var(--radius-round);
  }
  .skeleton--dot {
    width: var(--status-dot);
    height: var(--status-dot);
    border-radius: var(--radius-round);
  }
  .cell--end > .skeleton,
  .cell--amount > .skeleton {
    margin-inline-start: auto;
  }
  .row--skeleton,
  .table tbody tr.row--skeleton {
    cursor: default;
  }

  .empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2);
    width: 100%;
    max-width: var(--panel-max);
    margin-inline: auto;
    padding: var(--spacing-8) var(--spacing-4);
    text-align: center;
  }
  .empty__icon {
    display: grid;
    place-items: center;
    width: var(--empty-frame);
    height: var(--empty-frame);
    margin-block-end: var(--spacing-2);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-1);
    color: var(--color-text-muted);
  }
  .empty--error .empty__icon {
    color: var(--color-danger-text);
  }
  .empty__title {
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
    font-weight: var(--weight-semibold);
  }
  .empty__message {
    color: var(--color-text-muted);
  }
  .empty__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-3);
    margin-block-start: var(--spacing-2);
  }

  /* ============================ 13. Small parts ===================================================== */
  .kbd {
    display: inline-grid;
    place-items: center;
    min-width: var(--kbd-size);
    height: var(--kbd-size);
    padding-inline: var(--spacing-1-5);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-2);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .shortcuts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--spacing-2) var(--spacing-4);
    align-items: center;
  }
  .shortcuts > dd {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-1);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
  }

  .load-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2) var(--spacing-4);
    padding: var(--spacing-3) var(--spacing-4);
  }
  .count-note {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-variant-numeric: tabular-nums;
  }

  /* A value with its copy button (claim number, payment reference). */
  .copyable {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    min-width: 0;
    font-family: var(--font-mono);
    font-weight: var(--weight-medium);
  }

  /* Password checklist: each rule draws its tick when it passes, in a filled square; a rule not met yet shows a
     short dash (an empty box would read as a checkbox to tick). A text label, never colour alone. */
  .checklist {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    margin-block-start: var(--spacing-2);
  }
  .checklist__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
  }
  .checklist__mark {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: var(--icon-sm);
    height: var(--icon-sm);
    color: var(--color-on-accent);
  }
  .checklist__mark::before {
    content: '';
    position: absolute;
    inset-block-start: calc(50% - var(--border-hairline));
    inset-inline: var(--spacing-1);
    height: var(--border-strong);
    background: var(--color-border-control);
  }
  .checklist__mark > .drawn {
    width: 100%;
    height: 100%;
    opacity: 0;
  }
  .checklist__item[data-passed] {
    color: var(--color-text);
  }
  .checklist__item[data-passed] > .checklist__mark {
    background: var(--color-status-settled);
  }
  .checklist__item[data-passed] > .checklist__mark::before {
    opacity: 0;
  }
  .checklist__item[data-passed] > .checklist__mark > .drawn {
    opacity: 1;
  }
  .strength {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-block-start: var(--spacing-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  .strength__track {
    flex: 1 1 0;
    height: var(--sheet-handle-height);
    background: var(--color-border);
  }
  .strength__bar {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-text-muted);
  }
  .strength__label {
    flex: none;
    min-width: var(--spacing-12);
    text-align: end;
  }

  /* A meter (usage against a limit): a still track and a fill that motion.fill() moves (--progress 0–1).
     <div class="meter" data-tone="warning|danger"><span class="meter__fill"></span></div>; say the number in
     text next to it (the meter is decoration: aria-hidden). */
  .meter {
    display: block;
    height: var(--meter-height);
    overflow: hidden;
    background: var(--color-surface-3);
  }
  .meter__fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
    transform-origin: left;
    scale: var(--progress, 0) 1;
  }
  .meter[data-tone='warning'] .meter__fill {
    background: var(--color-status-pending);
  }
  .meter[data-tone='danger'] .meter__fill {
    background: var(--color-status-rejected);
  }

  /* The success moment (README §12.6): check frame, title, claim number, rail, "Notified" list, actions. */
  .success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-4);
    width: 100%;
    max-width: var(--panel-max);
    margin-inline: auto;
    padding-block: var(--spacing-8);
    text-align: center;
  }
  .success__check {
    display: grid;
    place-items: center;
    width: var(--empty-frame);
    height: var(--empty-frame);
    background: var(--color-status-settled);
    color: var(--color-on-accent);
  }
  .success__title {
    font-size: var(--text-xl);
    line-height: var(--leading-xl);
    font-weight: var(--weight-semibold);
  }
  .success__rail {
    width: 100%;
    padding-block: var(--spacing-2);
    text-align: start;
  }
  .success__notified {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    width: 100%;
  }
  .success__message {
    color: var(--color-text-muted);
  }
  .success__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-3);
    width: 100%;
  }
  .notified {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2) var(--spacing-4);
  }
  .notified__label {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }
  .notified__item {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1-5);
    font-weight: var(--weight-medium);
  }
  .notified__item > .drawn {
    color: var(--color-status-settled);
  }
  @media (max-width: 767.98px) {
    .success__actions > .btn {
      flex: 1 1 100%;
      min-height: var(--control-height-lg);
    }
  }

  /* A folded-away optional section ("+ Add a note"): field.js disclosure(). */
  .disclosure {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .disclosure > .link {
    align-self: flex-start;
  }

  /* A rail rendered with its fill already in place (static examples; no script needed). */
  .rail[data-filled][data-progress='0.5'] .rail__fill {
    --progress: 0.5;
  }
  .rail[data-filled][data-progress='1'] .rail__fill {
    --progress: 1;
  }

  /* Skeleton list rows keep the two-line geometry: the left-hand bars keep their share of the row, the right-hand
     ones have the amount's width. */
  .row--skeleton > .row__link > .skeleton:nth-child(odd) {
    flex: 0 1 auto;
    max-width: calc(100% - var(--spacing-16) - var(--spacing-3));
  }
  .row--skeleton > .row__link > .skeleton:nth-child(even) {
    width: var(--spacing-16);
  }

  /* The command palette has no visible header: its search input is the header. */
  .dialog.palette > .dialog__header {
    display: none;
  }
  .dialog.palette > .dialog__body {
    gap: 0;
    padding: 0;
    overflow: hidden;
  }
}
