/*
 * ui-system.css — the design system.
 *
 * Loaded AFTER `daisy/ui-alias.css` (see `EcaUiAssets.defaultPageStyles`, the one place the
 * chain is declared) and BEFORE UnoCSS. It is the last word on every component it names: where
 * this sheet styles a component, the alias sheet's rule for that component was DELETED in the
 * same commit. A rule that survives in two places is how the layer became patchy — five
 * declarations of `.eca-section` padding, four of `.table` cell padding, each one a correction
 * of the one above it, and no reader able to say which one is the design.
 *
 * ── The three rules this file is written to ────────────────────────────────────────────────────
 *
 * 1. MOBILE FIRST. The base rules below target a 360–390 px viewport. Every breakpoint is
 *    `min-width`: 480, 640, 900, 1200. There is no `max-width` media query in this file, and
 *    `DesignSystemSuite` fails if one appears. A desktop rule is an ENHANCEMENT — the base must
 *    be a complete, usable phone layout on its own; a wide screen adds columns, not usability.
 *
 * 2. TOKENS ONLY. No `#hex`, no bare `px` in a component declaration. Colour comes from
 *    `--color-*`, space from the 4 px scale (`--space-1`…`--space-8`) or a semantic token that
 *    aliases it, type from the fluid `--text-*` ramp. A value that is not a token is a decision
 *    nobody recorded.
 *
 * 3. ONE RULE PER COMPONENT. A component states its padding, its border and its type once.
 *    Media blocks change only what the breakpoint changes (direction, column count, density).
 *
 * Reading order: tokens → document → shell → components → print.
 */

/* ═══ 1. TOKENS ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Type: one fluid ramp, base 16 px ──────────────────────────────────────────────────────
   * Every step is a `clamp(min, preferred, max)` in rem, so the type scales with the viewport
   * AND with the reader's own font-size setting — text no longer jumps at a breakpoint.
   * Measured at the widths the system is judged at (see docs/ui/design-system.md):
   *
   *   token          360px   768px   1440px
   *   --text-xs      12.0    12.0    12.0   (fixed: the label floor)
   *   --text-sm      13.1    13.6    14.4
   *   --text-base    14.8    15.3    16.0
   *   --text-lg      17.3    18.7    20.0
   *   --text-xl      20.4    22.6    26.0   page title
   *   --text-2xl     24.0    27.7    32.0   stat value / public brand
   *
   * `--text-xs` is deliberately NOT a clamp: 12 px is the floor for table headers, badges and
   * labels, and a clamp that dips to 11 px at 360 makes the densest text the least readable.
   */
  --text-xs: 0.75rem;                                        /* 12px — floor, never smaller */
  --text-sm: clamp(0.8125rem, 0.79rem + 0.12vw, 0.9375rem);   /* 13.1 → 14.4 */
  --text-base: clamp(0.9375rem, 0.90rem + 0.12vw, 1rem);      /* 14.8 → 16   */
  --text-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);        /* 17.3 → 20   */
  --text-xl: clamp(1.25rem, 1.15rem + 0.55vw, 1.625rem);      /* 20.4 → 26   */
  --text-2xl: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);            /* 24   → 32   */

  /* Line height is a function of the job, not of the step: a number is packed, a heading is
   * tight, prose breathes. */
  --leading-tight: 1.15;    /* stat values, badges, single-line buttons  */
  --leading-snug: 1.3;      /* headings                                   */
  --leading-normal: 1.5;    /* body, table cells                          */
  --leading-relaxed: 1.65;  /* form hints, page hints, empty-state prose  */

  --tracking-tight: -0.011em;  /* a display size needs optical tightening */
  --tracking-wide: 0.04em;     /* small caps-style table headers          */

  /* ── Measure: how many characters a line is allowed to be ─────────────────────────────────
   * Prose is 55–75 characters (Bringhurst's 66 ± 10); the audit reads `ch` so a change here is a
   * measurable change in line length, not a vibe. Hints and empty-state copy get the narrow
   * measure: a two-line sentence, not a 90-character ribbon. */
  --measure: 68ch;
  --measure-narrow: 55ch;
  --width-form: min(100%, 42rem);   /* one-column form: 672px ceiling, no media query needed */
  --width-reading: var(--measure);
  /* The content column. This is a WORKBENCH, not a reading surface: 1180 was chosen for prose and
   * then applied to a 9-column ticket table, so at 1440 the table had 1116 px of usable width for
   * eight columns and every subject wrapped to three lines. 1560 keeps a 1600+ display honest (the
   * column stops growing, so a line of prose does not become a 2000 px ribbon) and gives 1440 a
   * content column of 1376 px — the available width minus the 32 px gutter on each side. Reading
   * text is NOT widened: `--measure` (68ch) still governs every paragraph (`--width-reading`,
   * `.eca-page-hint`, `.eca-empty__hint`).
   *
   * A fluid `min(100vw - 2*var(--gutter), 1680px)` was the alternative; `100vw` includes the
   * scrollbar, so on a page that scrolls the column is 15 px wider than the viewport and the page
   * grows a horizontal scrollbar — the one thing the 390 px layouts must never do. A fixed ceiling
   * and a 100 %-wide box below it cannot overflow. */
  --width-page: 1560px;             /* the shell's content column */

  /* ── Space: a 4 px grid ───────────────────────────────────────────────────────────────────
   * The scale used to be Fibonacci (4 8 13 21 34 55 89) and this sheet argued for it. The
   * argument was wrong in the only place it mattered: 13 and 21 are not divisors of the 38 px
   * control, so a card's padding (21) and its table's cell padding (10) never aligned to each
   * other, and no two components could be optically lined up without a bespoke correction.
   * 4 px divides the 40 px dense row, the 44 px touch target and the 38 px control exactly.
   * Names are unchanged — every page already reads `--space-3`/`--space-4`. */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Semantic rhythm — the names pages already use. */
  --pad-card: var(--space-4);        /* 16: card padding, on every edge                     */
  --gap-inline: var(--space-2);      /* 8:  between a label and its control                 */
  --gap-block: var(--space-3);       /* 12: between blocks inside a card                    */
  --gap-section: var(--space-5);     /* 24: between page-level sections                     */
  --gap-actions: var(--space-3);     /* 12: between adjacent CONTROLS in one action row     */
  --row-dense: 40px;                 /* the height a dense table row aims at                */
  --gutter: var(--space-4);          /* the page gutter — WIDENS below, see §2              */

  /* An ACTION ROW is not an inline row. `--gap-inline` (8) separates a label from the control it
   * names; two buttons need more, because they are two independent decisions and 8 px at a 38 px
   * control height reads as one control split in half — the user's "buttons joined together".
   * Measured on this build before the token: 24 page families sat at exactly 8 px (the floor of a
   * generic inline gap), and the issue page's header actions measured 10 px — i.e. the spacing was
   * whatever container happened to own the buttons. `--gap-actions` is the one answer, and the
   * guard (`docs/ui/verify/action-gap.mjs` in each app) fails under 8 for regressions. */

  /* ── Colour: semantic only ────────────────────────────────────────────────────────────────
   * The brand lives in `daisy/theme.css` (`--color-primary` … `--color-error`, daisy's names).
   * What this sheet adds is the pair a component actually needs — a SURFACE and an INK for each
   * state — plus the contrast decisions, measured (WCAG 2.2 AA: 4.5:1 body, 3:1 large/UI):
   *
   *   ink on white      ink on base-200     ratio
   *   --color-ink       #16191d  #16191d     17.63 / 16.44
   *   --color-muted     #5f6165  #5f6165      6.29 /  5.86
   *   --color-primary   #0f6b5c  #0f6b5c      6.41 /  5.97
   *   --color-info      #276f86  #276f86      5.67 /  5.29
   *   --color-success   #2c662d  #2c662d      6.90 /  6.43
   *   --color-error     #b3261e  #b3261e      6.54 /  6.09
   *   --color-warning   #b5820b  #b5820b      3.41 /  3.18  ← FAILS as text
   *   --color-warning-ink #7a5606 #7a5606     6.54 /  6.10  ← the text-safe warning
   *
   * `--color-warning` stays the *fill* (a warning bar, a soft badge) and
   * `--color-warning-ink` is its *ink*. The old sheet used the fill for text and measured 3.4:1.
   */
  --color-surface: var(--color-base-100);
  --color-surface-sunken: var(--color-base-200);
  --color-surface-inset: color-mix(in oklab, var(--color-base-200) 60%, var(--color-base-100));
  --color-border: var(--color-base-300);
  /* The utility layer (`agent-web/uno.config.ts`) composes `border-line` from these two names; they
   * were undefined, so every `.eca-section` / `.eca-btn` border resolved `color-mix(... an undefined
   * var ...)` to `currentColor` — the heavy dark outline on every card. The utility layer reads the
   * design token. */
  --color-line: var(--color-base-300);
  --color-line-strong: color-mix(in oklab, var(--color-base-content) 22%, var(--color-base-100));
  --color-border-strong: color-mix(in oklab, var(--color-base-content) 22%, var(--color-base-100));
  --color-ink: var(--color-base-content);
  --color-muted: #5f6165;            /* 6.3:1 on white, 5.9:1 on base-200 — AA for 13px */
  --color-link: var(--color-primary);

  --color-info-soft: color-mix(in oklab, var(--color-info) 12%, var(--color-base-100));
  --color-success-soft: color-mix(in oklab, var(--color-success) 12%, var(--color-base-100));
  --color-warning-soft: color-mix(in oklab, var(--color-warning) 14%, var(--color-base-100));
  --color-error-soft: color-mix(in oklab, var(--color-error) 12%, var(--color-base-100));
  /* ── Identity tints: the avatar chip's eight grounds ───────────────────────────────────────
   * A person's chip must be recognisable ACROSS a page — the same assignee is the same colour in the
   * list and on the ticket — so the tint is a stable function of the name, not of row position.
   * Deliberately NOT the state colours: an identity chip painted in `--color-error` reads as an
   * alert, which is exactly the "colour only means status" problem this pass set out to fix. These
   * are a separate, muted identity ramp (teal, blue, violet, slate, cyan, ochre, mauve, olive), each
   * with a darker ink measured on its own 14 % ground (≥4.5:1). */
  --tint-1: #0f6b5c;  --tint-ink-1: #0b5347;   /* teal   */
  --tint-2: #1d4ed8;  --tint-ink-2: #1a41b5;   /* blue   */
  --tint-3: #6b4fbb;  --tint-ink-3: #5b3fa8;   /* violet */
  --tint-4: #475569;  --tint-ink-4: #334155;   /* slate  */
  --tint-5: #0e7490;  --tint-ink-5: #0b5f74;   /* cyan   */
  --tint-6: #8a5a12;  --tint-ink-6: #6f4708;   /* ochre  */
  --tint-7: #7a5560;  --tint-ink-7: #6b4550;   /* mauve  */
  --tint-8: #4d7c0f;  --tint-ink-8: #3f650c;   /* olive  */

  --color-warning-ink: #7a5606;
  --color-info-ink: var(--color-info);
  --color-success-ink: var(--color-success);
  --color-error-ink: var(--color-error);

  /* ── Metric: one control height, one radius, one border ─────────────────────────────────── */
  --control-h: 38px;         /* ≥640.  Below 640 it is 44 (see §6, and the 900 block)        */
  --control-h-touch: 44px;   /* the touch target (WCAG 2.2 2.5.8 asks 24; 44 is the aim)      */
  --control-h-sm: 32px;      /* a row action inside a table                                   */
  --control-h-xs: 28px;      /* ≥640 only: a dense row action                                 */
  /* The floor a control may shrink to — WCAG 2.2 2.5.8's own 24 px. Named because it was written
   * as a bare `24px` twice (the breadcrumb trail) and a bare pixel in a metric property is exactly
   * what `DesignSystemSuite` fails on: it is a value nobody can retheme. */
  --target-min: 24px;
  --brand-mark: 28px;        /* the header mark: an identity, not a control                   */
  --caret-size: 7px;         /* the drawn disclosure chevron (nav groups)                     */
  --check-size: 20px;        /* a native checkbox/radio, inside a 44px row                    */
  --radius-field: 6px;
  --radius-box: 8px;
  --radius-pill: 999px;
  --border: 1px;
  /* The accent rail: a 3 px mark on a row that is SELECTED inside content (a batch action's target,
   * a picked assignee) — a state inside a list, which is a different job from "where am I".
   *
   * It is NOT the "you are here" mark any more: the nav states the current page with a 2 px
   * UNDERLINE and the page eyebrow with a 2 px rail, deliberately the same weight at two ranks
   * (see §2 and §4). A 3 px inset bar on the leading edge of a menu row read as a raw strip of
   * colour and competed with the eyebrow at the same weight. */
  --rail: 3px;

  /* ── The three surfaces, and the only place a shadow is allowed ──────────────────────────
   *
   * A page has three planes and they must be distinguishable without colour:
   *
   *   canvas  `--color-surface-sunken`, a table's header band the same plane
   *           the page's ground (shell in §2); a table's header band is the same plane, so a
   *           header reads as a band cut INTO the card rather than a second card stacked on it;
   *   card    `--color-surface` + 1 px border + radius
   *           anything a page is made of (`.eca-section`), and an empty state's ground;
   *   inset   `--color-surface-inset`
   *           a well: a code block, an empty state, an input's own ground.
   *
   * **A shadow is never a static container's property.** Card = white + 1 px border is the whole
   * statement; a permanent shadow on a permanent box is a lie about depth, and it is the thing
   * that turns into a grey smear in `forced-colors` (a shadow is dropped there, so a card that
   * needed it would lose its shape — the border is what survives). The lift below is published for
   * the three cases where something really is above something else: the row under the pointer, the
   * tile that is a link, and a popover/overlay. Its value is deliberately 2 px of blur: enough to
   * read as "this responds", not enough to be an elevation system of its own. */
  --shadow-lift: 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-2: 0 6px 16px rgb(16 24 40 / 0.10);
  --shadow-3: 0 16px 40px rgb(16 24 40 / 0.16);

  /* Motion: three durations, each tied to how far the thing travels, and every transition is
   * optional (see the reduced-motion block in §9).
   *
   *   90  hover/focus, a colour or a 2 px lift — a state change the reader caused and is watching;
   *   160 a popover: it appears under the pointer, so it must arrive before the eye finishes the
   *       movement, or it reads as a delayed paint;
   *   240 a drawer/panel: it crosses the layout, and 240 is the longest a control may take before
   *       it feels like the app is thinking.
   *
   * A transition longer than the gesture it acknowledges reads as lag; this was 120/180/240 with
   * every hover on the slowest of the three. */
  --motion-fast: 90ms;
  --motion-pop: 160ms;
  --motion-slow: 240ms;

  --focus-ring: 0 0 0 3px color-mix(in oklab, var(--color-primary) 45%, transparent);
}

/* ── The gutter widens with the room available, not with the content ───────────────────────── */
@media (min-width: 900px) {
  :root { --gutter: var(--space-5); }   /* 24px */
}
@media (min-width: 1200px) {
  :root { --gutter: var(--space-6); }   /* 32px */
}

/* ═══ 2. DOCUMENT ═════════════════════════════════════════════════════════════════════════════ */

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* A scrollbar appearing changes the line length of every paragraph; reserve it once. */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  margin: 0;
  background: var(--color-surface-sunken);
  color: var(--color-ink);
  font-family: var(--font-sans, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* A page is one column; the shell owns the gutter. `min-width: 0` on every child is what stops a
 * wide table from widening the document instead of scrolling inside its own box. */
/* ── The document is a COLUMN, and the footer sits at its bottom ─────────────────────────────
 *
 * The footer is emitted as the last child of `<body>`, a sibling of `.eaw-shell`. `.eaw-shell` used
 * to claim `min-height: 100dvh` itself, so on a short page the shell filled the viewport and the
 * footer started BELOW the fold — the user's "why didn't the footer stick to the bottom of the
 * viewport instead of at the end of the page". `margin-top: auto` on the footer cannot help: the
 * flex container is `body`, and the shell had already consumed the whole height.
 *
 * The correction is containment, not `position: fixed` (which would overlay content and repeat on
 * every printed page): body is the 100dvh column, the shell grows into it, and the footer is the
 * last fixed-height row. On a tall page the shell grows past the viewport and the footer follows
 * the content — the same rules, no overlap, and printing is unaffected. */
body.eaw-migration-body { display: flex; flex-direction: column; min-height: 100dvh; }
/* NOT the bare shell: the sign-in / 404 surface has no footer to pin and centres its own content,
 * so growing it would move the card down (measured: 11 401 px of the login capture). */
body.eaw-migration-body > .eaw-shell:not(.eaw-shell--bare) { flex: 1 0 auto; min-height: 0; }
body.eaw-migration-body > .eca-page-footer { margin-top: auto; flex: 0 0 auto; width: 100%; }

.eaw-shell { display: flex; flex-direction: column; min-height: 100dvh; }
/* A bare shell (sign-in, 404) has no footer to pin: it stays a block so its child can centre. */
.eaw-shell--bare { display: block; min-height: 100dvh; }
.eaw-page { flex: 1 0 auto; min-width: 0; }

.eca-container {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

/* Headings: one ramp, no `:where()` — the sheet must out-rank `admin.css`'s element rules, which
 * still carry a desktop divider under every h1 (the "second rule under the title" that made every
 * page look like a form). */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 650;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
h1 { font-size: var(--text-xl); border-bottom: 0; padding-bottom: 0; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
h4 { font-size: var(--text-sm); }
p { margin: 0 0 var(--gap-block); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
small { font-size: var(--text-xs); color: var(--color-muted); }
hr {
  height: 0;
  margin: var(--gap-section) 0;
  border: 0;
  border-top: var(--border) solid var(--color-border);
}
img, svg, video { max-width: 100%; height: auto; }

/* Prose links are the accent; chrome links are ink. A table's link is prose. */
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.eaw-page a:not([class*="eca-"]):not(.button):not(.item) { color: var(--color-link); }

/* One focus ring for everything, keyboard-only. A component that overrides it must be reachable
 * by Tab and must still show something (shell-audit.mjs walks every focusable element). */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-field);
}

/* Skip link: first tab stop, visible only when focused (WCAG 2.4.1). */
.eca-skip-link {
  position: absolute;
  inset-inline-start: var(--space-2);
  top: -100px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-primary-content);
  background: var(--color-primary);
  border-radius: var(--radius-field);
  text-decoration: none;
}
.eca-skip-link:focus { top: var(--space-2); }

/* ═══ 3. SHELL: HEADER, NAV, FOOTER ══════════════════════════════════════════════════════════
 *
 * The nav used to be a run of text with a glyph between the words — at 1440 every destination read
 * as one sentence ("iTrack 6 · Create · Search · Recent Tickets · …") and the group caret was a
 * 5 px dot; at 390 the whole thing hid behind a bare hamburger, taking the app's name with it.
 * The anatomy below is the same at every width:
 *
 *   .eca-header
 *     .eca-header__bar      brand · [toggle] · nav · account
 *     .eca-header__where    (mobile only) the page you are on, under the bar
 *
 * Grouping is real: `<details class="eca-menu__group">` per group, one open at a time, and the
 * group holding the current page is marked. Base = drawer; ≥900 = one row with popover panels.
 */

.eca-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: var(--border) solid var(--color-border);
}

.eca-header__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding: var(--space-2) var(--gutter);
  box-sizing: border-box;
}

/* A bar WITHOUT a header surface: `EcaShell.brand` wraps `[brand][menu]` in `.eca-bar`.
 *
 * Most migrated apps emit their menu as `nav.eca-menu` and no `.eca-header` (that anatomy is for an
 * app that also has a brand slot and an account surface of its own). On a phone that menu is a
 * drawer, so the closed bar held a lone hamburger and the product's name was nowhere — measured on
 * claim-system at 390, 2026-11-10. The wrapper is emitted ONLY when a brand is supplied, so every
 * app that does not opt in renders the markup it already had.
 *
 * The bar owns the GUTTER and a menu inside a bar never pads on its own (see the ≥900 block), so the
 * first and last item land on the page column: one edge, one owner. */
.eca-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

/* The product's name, for the width where the menu is a drawer. It is a `div`, not a heading: the
   page's `<h1>` is the page, and a second heading in the bar competes with it. */
.eca-brand {
  display: inline-flex;
  /* `flex: 1 1 0` — the brand takes what is LEFT of the row and nothing more. A content-sized basis
     (the default) makes the line breaker compare the name's full width, so a long product name took
     the whole line and `flex-wrap` put the hamburger on a second one (measured at 390 with a 441 px
     name: the bar became 99 px tall and the toggle sat at y=53.6). A `max-width: calc(100% - …)`
     fixed the width but not the break, because the button's own inline margin (1.6 px) is part of
     its outer size and the two still did not fit by that 1.6 px. A zero basis cannot overflow. */
  flex: 1 1 0;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding-inline-end: var(--space-2);
  min-width: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
  white-space: nowrap;
}
/* The name's own box stays text-sized, so the link's hit area is the words and not the empty rest of
   the row; a name longer than that box is ellipsised, never wrapped. */
.eca-brand > * {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}
.eca-brand a:hover { color: var(--color-primary); text-decoration: none; }
/* An OPEN drawer shows the app's own brand as its first row, so the bar's copy steps out: the same
   name said twice, 44 px apart, reads as two products. */
.eca-bar:has(> .eca-menu.is-open) > .eca-brand { display: none; }

/* The brand is an identity, not a menu item: a mark and a name, never part of the item run. */
.eca-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding-inline-end: var(--space-1);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}
.eca-header__brand:hover { text-decoration: none; color: var(--color-primary); }
.eca-header__mark {
  display: inline-grid;
  place-items: center;
  width: var(--brand-mark);
  height: var(--brand-mark);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary-content);
  background: var(--color-primary);
  border-radius: var(--radius-field);
}
.eca-header__name { font-size: var(--text-lg); }
.eca-header__suffix {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* The mobile "you are here" line: the current page is always visible in the nav, and inside a
 * closed drawer this is where it lives. */
.eca-header__where {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--gutter) var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.eca-header__where-label { color: var(--color-muted); }
.eca-header__where-current { color: var(--color-ink); font-weight: 600; }

/* ── The toggle: a real 44 px target with three bars, aligned to the bar's far edge ───────── */
.eca-menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  margin-inline-start: auto;
  width: var(--control-h-touch);
  height: var(--control-h-touch);
  padding: 0 var(--space-2);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-field);
  cursor: pointer;
}
.eca-menu-toggle > span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--color-ink);
  transition: transform var(--motion-fast) ease, opacity var(--motion-fast) ease;
}
.eca-menu-toggle[aria-expanded="true"] { background: var(--color-surface-sunken); }
.eca-menu-toggle[aria-expanded="true"] > span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.eca-menu-toggle[aria-expanded="true"] > span:nth-child(2) { opacity: 0; }
.eca-menu-toggle[aria-expanded="true"] > span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── The menu: BASE = a full-width drawer under the bar ──────────────────────────────────── */
.eca-menu {
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-2) 0 var(--space-3);
  border-top: var(--border) solid var(--color-border);
}
.eca-menu.is-open { display: flex; }

.eca-menu > .item,
.eca-menu__right > .item,
.eca-menu__account > .item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-field);
  color: var(--color-ink);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  /* The current-state marker is a pseudo-element pinned to this row's own baseline; without a
   * positioning box it would escape to the nearest positioned ancestor (the header bar). */
  position: relative;
}
.eca-menu > .item:hover,
.eca-menu__right > .item:hover,
.eca-menu__account > .item:hover { background: var(--color-surface-sunken); text-decoration: none; }

/* ── Current page: a wash, the words, and a rule UNDER them ──────────────────────────────────
 *
 * It used to be `box-shadow: inset var(--rail) 0 0 var(--color-primary)`: a 3 px bar welded to the
 * row's leading edge, under a 10 % tint and weight 650. On `/roles` the reader called it exactly
 * what it is — cheap and raw: a strip of colour on the edge of a menu row reads as a browser
 * selection, not as a designed state, and because the page eyebrow carries the same 3 px rail the
 * nav competed with the page's own "where am I".
 *
 * So the mark is now the shape a reader already reads as "this one": a 2 px rule under the label,
 * drawn from the label's start edge (`scaleX`) so it arrives as a gesture rather than appearing as
 * a slab. The wash drops to 9 % and the weight to 600 — at 10 %/650 two adjacent rows look like a
 * text selection, which this is not.
 *
 * "You are here" is then ONE signal at two ranks: this underline, and the 2 px eyebrow rail on a
 * page you drilled INTO (both 2 px, both the accent, different lengths, different jobs).
 *
 * The rule exists on every item at `scaleX(0)`, not only on the current one: a transition needs a
 * from-state, and this way `nav-active.js` swapping the class animates in place with no layout shift
 * and no second CSS rule. */
.eca-menu > .item::after,
.eca-menu__panel > .item::after {
  content: "";
  position: absolute;
  inset-inline-start: var(--space-3);
  inset-inline-end: var(--space-3);
  bottom: var(--space-1);
  height: 2px;
  border-radius: 1px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--motion-pop) ease;
}
.eca-menu > .item.active,
.eca-menu > .item[aria-current],
.eca-menu__panel > .item.active,
.eca-menu__panel > .item[aria-current] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 9%, var(--color-surface));
  font-weight: 600;
}
.eca-menu > .item.active::after,
.eca-menu > .item[aria-current]::after,
.eca-menu__panel > .item.active::after,
.eca-menu__panel > .item[aria-current]::after { transform: scaleX(1); }
/* RTL: `transform-origin` takes a physical keyword, so the rule has to grow from the other edge. */
:dir(rtl) .eca-menu > .item::after,
:dir(rtl) .eca-menu__panel > .item::after { transform-origin: 100% 50%; }
@media (prefers-reduced-motion: reduce) {
  .eca-menu > .item::after,
  .eca-menu__panel > .item::after,
  .eca-menu__group > summary::before { transition: none; }
}

/* A group is a disclosure. Its summary is a row (mobile) / a button (desktop) — both 44px. */
.eca-menu__group { margin: 0; border-radius: var(--radius-field); }
.eca-menu__group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  list-style: none;
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-ink);
  border-radius: var(--radius-field);
}
.eca-menu__group > summary::-webkit-details-marker { display: none; }
.eca-menu__group > summary:hover { background: var(--color-surface-sunken); }
/* The caret is DRAWN, not a glyph: a 7×7 box with two visible borders, rotated. A 5 px one read
 * as a stray dot at 1440; this one is legible at both ends of the range. */
.eca-menu__group > summary::after {
  content: "";
  flex: 0 0 auto;
  width: var(--caret-size);
  height: var(--caret-size);
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0.55;
  transition: transform var(--motion-fast) ease;
}
.eca-menu__group[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
/* The group holding the current page states it: the summary takes the wash and the 2 px rule (not
 * the rail the item used to carry) and keeps them while the panel is COLLAPSED, so "you are in
 * Dashboards" survives the collapse. */
.eca-menu__group.active > summary,
.eca-menu__group--current > summary {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 9%, var(--color-surface));
  font-weight: 600;
}
/* The summary's underline is a `::before` because `::after` is the caret. Both are absolutely
 * positioned, so neither becomes a flex item of the summary's row. */
.eca-menu__group > summary { position: relative; }
.eca-menu__group > summary::before {
  content: "";
  position: absolute;
  inset-inline-start: var(--space-3);
  inset-inline-end: var(--space-3);
  bottom: var(--space-1);
  height: 2px;
  border-radius: 1px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--motion-pop) ease;
}
:dir(rtl) .eca-menu__group > summary::before { transform-origin: 100% 50%; }
.eca-menu__group.active > summary::before,
.eca-menu__group--current > summary::before { transform: scaleX(1); }
/* ONE marker, not two. With the group OPEN, the current item inside its panel already carries the
 * marker; the summary repeating it put two underlines within 30 px of each other and neither read
 * as the answer. `:has()` is the only way to see the panel from the summary — the panel is a
 * descendant, so no sibling selector can express it. */
.eca-menu__group[open]:has(> .eca-menu__panel > .item.active) > summary,
.eca-menu__group[open]:has(> .eca-menu__panel > .item[aria-current]) > summary {
  color: var(--color-ink);
  background: none;
  font-weight: 600;
}
.eca-menu__group[open]:has(> .eca-menu__panel > .item.active) > summary::before,
.eca-menu__group[open]:has(> .eca-menu__panel > .item[aria-current]) > summary::before {
  transform: scaleX(0);
}

/* The panel: in flow on mobile (a list under its heading, indented by a rail), a floating card
 * on desktop. Never clipped by an ancestor — see the overflow rule in §4. */
.eca-menu__group > .eca-menu__panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 var(--space-1);
  padding: 0 0 0 var(--space-3);
  border-inline-start: 2px solid var(--color-border);
  margin-inline-start: var(--space-3);
}
.eca-menu__group > .eca-menu__panel > .item {
  display: flex;
  align-items: center;
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-field);
  color: var(--color-ink);
  font-size: var(--text-base);
  text-decoration: none;
  /* The current-state underline is pinned to the item; without its own positioning box it escapes
   * to the next positioned ancestor (on a phone the panel itself is static). */
  position: relative;
}
.eca-menu__group > .eca-menu__panel > .item:hover { background: var(--color-surface-sunken); }

/* The account is a menu with a name on it, not a text run. */
.eca-menu__account { margin-inline-start: 0; }
.eca-menu__account > .eca-menu__group > summary {
  font-weight: 600;
}
.eca-menu__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.eca-menu__user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── ≥900: one row, groups are popover buttons, panels float ─────────────────────────────── */
@media (min-width: 900px) {
  .eca-header__bar { flex-wrap: nowrap; gap: var(--space-1); }
  .eca-header__where { display: none; }
  .eca-menu-toggle { display: none; }
  /* The open menu IS the bar, and its first item already names the product (claim-system's first
     `.item` is "Greenfossil Claims"), so the bar's own brand would be the same words twice on one
     row at 1440. It exists for the width where the menu is a drawer. */
  .eca-brand { display: none; }
  .eca-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;          /* a dense nav wraps; it never clips and never pans */
    align-items: center;
    /* A BAR NEVER GROWS. `flex: 1 1 auto` here made the nav absorb every spare pixel of a flex
     * column when an app rendered it directly under `<body>` (no `.eaw-shell` wrapper): on
     * elementum-simple that produced a 701 px-tall nav at a 900 px viewport with the brand centred
     * at y≈339 and the page content pushed to the bottom. Growth belongs to `.eaw-page`; a bar that
     * is asked to fill the viewport is a missing shell, and it must look wrong, not tall. */
    flex: 0 1 auto;
    flex-basis: auto;
    gap: var(--space-1);
    margin: 0;
    /* THE BAR SITS ON THE PAGE COLUMN. `.eca-menu` is OUTSIDE `.eca-container` (the bar is
     * full-bleed) and carried `padding: 0` here, so its first item began at the viewport edge and its
     * own inset was the only gutter: measured on claim-system at 1440 (2026-11-10) the first item
     * started at x≈20 while the page's content column started at x=32. The bar now carries the
     * container's own token, so its first and last items land on the page column.
     *
     * A bar that already pads is exempt (below): `.eca-header__bar` and `.eca-bar` own the gutter and
     * the menu is a row INSIDE them — one edge, one owner (X120). */
    padding-block: 0;
    padding-inline: var(--gutter);
    border-top: 0;
    min-width: 0;
  }
  :is(.eca-header__bar, .eca-bar) > .eca-menu { padding-inline: 0; }
  /* A MENU INSIDE A BAR FILLS IT. `.eca-bar` (emitted only when `EcaShell.brand` is supplied) is a
   * ROW, so its menu is a flex ITEM; content-sized (`flex: 0 1 auto`, above) it never takes the
   * bar's slack, and the `margin-inline-start: auto` on `.eca-menu__right` then has nothing to
   * consume. Measured on oauth2-authserver-app at 1440, RC6, fresh JVM: the account run ended at
   * x=864 with the page column ending at 1425 — 561 px of empty bar to its right. Before the
   * wrapper (RC5) the menu stretched across the shell column and the run was flush.
   *
   * Growth here is HORIZONTAL and scoped to a menu the bar already owns the gutter for; it does not
   * reintroduce the vertical growth the rule above forbids (that was the menu as a CHILD OF A
   * COLUMN). The bar keeps the gutter, the menu keeps `padding-inline: 0` — one owner (X120). */
  .eca-bar > .eca-menu { flex: 1 1 auto; }
  .eca-menu > .item[href],
  .eca-menu__group > summary { font-size: var(--text-sm); }
  .eca-menu__group > summary {
    width: auto;
    min-height: var(--control-h);
    padding: var(--space-2) var(--space-3);
    font-weight: 500;
    gap: var(--space-2);
  }
  /* ── A GROUP OPENED IN THE BAR STAYS IN THE BAR — IT NEVER FLOATS OVER THE PAGE (X120) ──────────
   *
   * The panel used to be a POPOVER (`position: absolute`, `top: 100%`). An app that marks the group
   * holding the current page renders it `open` — `ark` and `claim-system` both do — so at first
   * paint a panel the READER NEVER OPENED sat on the page's first control and stayed there. Measured
   * on a driven shell (2026-11-17): with that group open, `document.elementFromPoint` at the centre
   * of the page's first button returned a panel `.item` — not the button — at 900 AND at 1440. The
   * reader's only fix was to close a menu the page had opened for them.
   *
   * So an open panel is IN FLOW: the group takes a row of the bar, and its destinations run along
   * that row. `.eca-menu` already wraps, so the row is inside the bar's own band; the page starts
   * BELOW the bar and its first control is hit-testable by construction. `<details>` is native, so
   * the summary still toggles the row — nothing here can make it a dead control — and the strip
   * WRAPS like every other nav run (the bar's own rule: "a dense nav wraps; it never clips and never
   * pans"). A sideways-scrolling strip was the first cut and it measured **"Consol…"** against the
   * viewport edge at 900: a scroll container is not a licence to cut a destination in half.
   *
   * What went with the popover: the two mirrored placements (`.eca-menu__group--end`, the account's
   * right-anchored panel) — a strip is placed by the bar — and the `@starting-style` slide, which on
   * an in-flow row would paint an empty band for the length of the transition. The page shifts down
   * by one row while a group is open; that is the cost of not covering the reader's work, and it is
   * the same shift the drawer has always had below 900. */
  .eca-menu__group[open] {
    display: flex;
    /* The summary sits on the strip's FIRST line, not centred between two lines of it. */
    align-items: flex-start;
    /* One row of the bar. `flex-wrap` on `.eca-menu` breaks the line before a 100%-basis item, so
       the row starts at the bar's leading edge and the rest of the bar continues below it. */
    flex: 0 0 100%;
    gap: var(--space-2);
    /* It now owns a row, not a word in the row: it draws no boundary of its own and starts on the
       bar's leading edge (measured before this: the strip's first item sat 8 px right of row 1's). */
    padding-inline-start: 0;
    box-shadow: none;
  }
  .eca-menu__group > .eca-menu__panel {
    position: static;
    flex: 1 1 auto;
    min-width: 0;                  /* a scrolling strip is allowed to be narrower than its items */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;               /* a long section adds lines to the band; it never clips */
    align-items: center;
    gap: var(--space-1);
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .eca-menu__group > .eca-menu__panel > .item { font-size: var(--text-sm); white-space: nowrap; }
  .eca-menu__account { margin-inline-start: auto; }
  /* A group boundary is a hairline, not a dot between two words. */
  .eca-menu > .eca-menu__group + .eca-menu__group {
    box-shadow: inset 1px 0 0 var(--color-border);
    padding-inline-start: var(--space-1);
  }
}

/* ── ≥1200: the bar is ONE ROW at every desktop width ─────────────────────────────────────────
 *
 * Measured at 1440 before this block: the seven group buttons at 12 px inline padding needed
 * 871 px, the brand 189 px, against 1003 px available — the account menu wrapped to a second row
 * and the sticky bar was **108 px instead of 60**, i.e. 48 px of every page spent on chrome.
 * Folding the tail into a "More" menu was the other option and it costs a click to reach a
 * destination the nav exists to show. 8 px inline padding (the system's own nav target) saves
 * ~56 px, and 2 px between groups another ~10 — against a 57 px shortfall, so every group stays
 * visible and the bar is one row from 1200 to 1440. The fix is in the shared shell, not an
 * app-side override, because every app inherits this bar. */
@media (min-width: 1200px) {
  .eca-header__bar { gap: 2px; }
  /* The bar is a row of DISCLOSURES, not a run of words: 4 px between two hit boxes read as one
   * glued sentence (UAT, 2026-11-09). 8 px is what fits at 1200 with every group present (measured
   * slack before: 48 px; 7 gaps x 8 px less the 2 px that were there). The odd per-group 2 px inset
   * is gone — it spaced one pair differently from the others. */
  /* 6 px, measured: 8 px wrapped the account to a second row at exactly 1200 (bar height 112), and the
   * one-row rule is not negotiable. The wider spacing is the container query below. */
  .eca-menu { gap: calc(var(--space-1) + 2px); }
  .eca-menu__group > summary { padding-inline: var(--space-2); }
}

/* ── Footer: a real footer row — what this is, and the app's own links ───────────────────── */
.eca-page-footer {
  margin-top: auto;
  padding: var(--space-4) 0;
  background: var(--color-surface);
  border-top: var(--border) solid var(--color-border);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.eca-page-footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
}
.eca-page-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-4);
}
/* A footer link is still a control: 44px at every width. Measured before this rule: 93x20 — below
 * even the 24px minimum tap target, on every page, at every width (the audit measures 390, 768 and
 * 1440). A 44px row in a footer costs nothing; a 20px row costs a mis-tap. */
.eca-page-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-touch);
}
/* The colophon's BUILD half: a commit sha (AGENTS.md — "the footer is a colophon — product,
 * environment, build"). It is a COLOPHON DATUM, not a component: it lives inside this footer block
 * rather than as a top-level `eca-*` name, because nothing else will ever want it.
 *
 * Why it needs a rule at all: `thorium-website` emitted `eca-page-footer__commit` with none, so the
 * hash rendered as ordinary body text — the class was a name with no component behind it, and the
 * fleet's `check-ecaw-components.py` was red on exactly this one class (X107). Unstyled, the sha
 * inherits the footer's proportional sans at 13 px, where `0`/`O` and `1`/`l` are near-identical and
 * the digits do not sit in columns — a build stamp whose only job is to be compared between two
 * builds.
 *
 * Three decisions, each measurable:
 *  - MONOSPACE + `tabular-nums`: the hex aligns in columns and each glyph is unambiguous. `0.92em`
 *    matches `.eca-code`, so the datum reads as "a code, not prose" without dropping below the
 *    12 px floor the rest of the sheet keeps.
 *  - `--color-muted`, inherited rather than re-declared bright: the sha is the least important word in
 *    the row and must not compete with the copyright for the eye. (Contrast is the footer's own
 *    6.3:1 — AA at this size, so muting is a hierarchy choice, not a legibility one.)
 *  - `white-space: nowrap`: a 7-character hash has NO break opportunity inside it, so a narrow
 *    viewport splits it wherever the browser likes ("abc1" / "234") — unreadable, and it looks like
 *    two data. Nowrap + the row's `flex-wrap` moves the whole datum to the next line at 390 instead,
 *    which is what a colophon should do. The 7-char span is far narrower than the 390 gutter, so this
 *    cannot cause horizontal overflow. */
.eca-page-footer__commit {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  white-space: nowrap;
}
.eca-page-footer a { color: var(--color-muted); }
.eca-page-footer a:hover { color: var(--color-link); }

/* ═══ 4. PAGE SKELETON ════════════════════════════════════════════════════════════════════════ */

/* THE PAGE'S BLOCK RHYTHM — the block BELOW owns the boundary (X120). The block above never adds a
 * top margin to its neighbour: one owner per boundary.
 *
 * The shell wraps a page in `.eca-container.eaw-page`, but a migrated page emits its blocks into a
 * wrapper of its own — `.eca-page-section` (compat pages) or a classless `div` (app pages). A
 * `> * + *` rule on the page therefore reached nothing: form → section, field-row → toolbar,
 * wrapper → section and form → message all started at the same y as the block above them
 * (22 findings, measured on the gate).
 *
 * Both parents are BLOCK containers — this sheet gives neither `.eca-page-section` nor a classless
 * `div` a `display` — so the new `margin-block-start` COLLAPSES with the bottom margin the block
 * above already owns (`max(12, 12)` = 12, never 24). It is deliberately not one ancestor deeper: a
 * `margin-block-start` inside a flex column or a grid is an extra TRACK gap on top of the
 * container's `gap` (`.eca-form`, `.eca-form__fields`, `.eca-field-row`, `.eca-workbench__pane` all
 * set `gap`), which is why this rule names its parents instead of using a descendant combinator.
 * The one descendant form is a bare `<form>`: it has no layout of its own, and its children are
 * stacked blocks (`.eca-field-row` is the grid inside it, not its parent).
 *
 * `:where()` keeps it at ONE class of specificity for two reasons: the intent-bearing header rule
 * below must outrank it (a header's boundary is `--gap-section`, a wider break), and a component
 * that still declared `margin: 0 0 …` would beat it on source order. The page-level blocks that
 * owned the measured defects no longer zero their own top margin — they state their BOTTOM margin
 * only (§4 `.eca-section`/`.eca-toolbar`/`.eca-tabs`, §8 `.eca-message`, `.statistics`). */
.eaw-page > * + *,
.eaw-page > :where(.eca-page-section, div:not([class])) > * + * { margin-block-start: var(--gap-block); }
/* A bare `<form>` is a wrapper too: the log filter is `<form action="/logs/list">` — no class, no
 * layout — so its field row and its toolbar started at the same y (`/logs/list`,
 * `/ticket/dashboard`, the two `/builder/report` pages). Its children are stacked blocks in normal
 * flow, never grid items — `.eca-field-row` is the grid, and it is one child of the form. */
.eaw-page form:not([class]) > * + * { margin-block-start: var(--gap-block); }
.eaw-page > .eca-page-header + * { margin-block-start: var(--gap-section); }

/* A filter row that introduces a toolbar owns the gap between them (measured: 0 px on
 * `/ticket/dashboard`, `/logs/list` and both report-builder pages). */
.eca-field-row + .eca-toolbar { margin-block-start: var(--gap-block); }

/* An action row UNDER a table draws no second rule: the table's own edge is the boundary, and two
 * rules 13 px apart read as a stray divider (measured on `/space/1`). */
.table-scroll + .eca-actions,
table + .eca-actions { border-top: 0; padding-top: var(--gap-block); }
/* The header owns its boundary, so the block that follows it never touches the rule — including the
 * pages where the header is not a direct child of `.eaw-page` (a wrapper div). Measured on `/roles`
 * and `/permissions/all`: header and the next block started at the same y (0 px gap). */
/* Specificity, not politeness: `.eca-section { margin: 0 }` is declared later, so a one-class
 * sibling rule lost to it and 128 pages still had the next block touching the rule at 0 px. */
.eaw-page .eca-page-header + * { margin-block-start: var(--gap-section); }

/* Title + hint + actions. Mobile: three stacked rows in the order the reader needs them —
 * what this is, what it does, what I can do. Desktop: the actions take the right edge. */
.eca-page-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4) 0 var(--space-3);
  border-bottom: var(--border) solid var(--color-border);
}
.eca-page-heading { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.eca-page-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
}
.eca-page-hint {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-muted);
}
.eca-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-actions);
}
/* The BREADCRUMB above a title (the product's word; the class was `eyebrow`): "Tickets › #1". It is not a title and not a hint, so it gets the accent
 * rail and small caps rather than a third weight of body text.
 *
 * The rail is the SAME signal as the nav's current-page marker, one rank quieter: both are the
 * accent, both are 2 px — a page you drilled INTO (this rail, running the height of a line of small
 * caps) versus the section you are inside (the nav's underline, running the width of a word). It
 * was `var(--rail)` (3 px) while the nav drew a 3 px inset bar of its own, so the two competed at
 * the same weight and neither read as "you are here". The rail is a BORDER on the container, not a
 * pseudo-element, so it costs no extra box and survives print. */
.eca-page-breadcrumb, .eca-page-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  padding-inline-start: var(--space-2);
  border-inline-start: 2px solid var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
  min-height: var(--control-h-touch);
}
/* The trail's links are controls: 44 px so a thumb can hit them (measured 55x18 before — below even
 * the 24 px minimum; the audit reads `tap<24`). */
.eca-page-breadcrumb a, .eca-page-eyebrow a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-touch);
  color: var(--color-link);
  text-decoration: none;
}
.eca-page-breadcrumb a:hover, .eca-page-eyebrow a:hover { text-decoration: underline; }
/* A rail on its own is shape without a seam: the eyebrow is flush with the title below it, so the
 * two read as one block ("where I am" over "what this is"). */
.eca-page-breadcrumb + .eca-page-header, .eca-page-eyebrow + .eca-page-header { padding-top: var(--space-2); }
@media (min-width: 640px) {
  .eca-page-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
  }
  .eca-page-actions { flex: 0 0 auto; align-items: flex-start; }
}

/* A card. One padding, one border, one radius — declared here and nowhere else. It is a PLANE, not
 * a floating object: no shadow (see the three-surfaces block in §1).
 *
 * BOTTOM margin only. Stating `margin: 0 0 …` here also claimed the TOP margin — which is the
 * boundary the page's rhythm rule owns (§4) — and being one class of specificity declared later, it
 * silently zeroed that boundary: `/system/diagnostic/sms` and `/system/diagnostic/mail` had the form
 * and the configuration card welded together. */
.eca-section {
  padding: var(--pad-card);
  margin-block-end: var(--gap-block);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
  min-width: 0;
  /* NOT `overflow: hidden`/`auto`: a popover inside a card must escape it. */
}
.eca-section:last-child { margin-bottom: 0; }
/* TWO CARDS on a page are a wider break than two blocks in a card. The top margin is the BELOW
 * card's, and it needs two classes to beat the page rhythm rule (§4) — which is why it is not
 * written as `.eca-section + .eca-section`. */
.eaw-page > .eca-section + .eca-section,
.eaw-page > :where(.eca-page-section, div:not([class])) > .eca-section + .eca-section { margin-block-start: var(--gap-section); }

.eca-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  margin: 0 0 var(--gap-block);
}
.eca-section-title { margin: 0; font-size: var(--text-base); font-weight: 650; line-height: var(--leading-snug); }
/* A master/detail pane has a name that is more than a section label but less than the page's `<h1>`
 * (which belongs to the tree): e.g. "Space Clusters" beside "Space Clusters Tree". */
.eca-pane-title { margin: 0; font-size: var(--text-lg); font-weight: 650; line-height: var(--leading-snug); }
/* A path, not a heading: the subject line above a pane's content. Inherits the ink so a
 * self-referential last crumb does not read as a second (teal) title. */
/* A standalone link, when the page means "a link" and not a sentence. It had NO rule anywhere —
 * X107 in practice: `/user/change-pw/request`'s "Back to sign in" measured 93x21 at every width. */
/* MOBILE-FIRST, as the sheet's guard requires: touch is the base, the pointer case is the
 * `min-width` refinement. */
.eca-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-touch);
  color: var(--color-link);
  text-decoration: none;
}
.eca-link:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 1200px) {
  .eca-link { min-height: 1.5rem; }
}
.eca-breadcrumb { font-size: var(--text-sm); color: var(--color-muted); }
.eca-breadcrumb ol { margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.eca-breadcrumb a, .eca-breadcrumb__link {
  display: inline-flex;
  align-items: center;
  /* Mobile-first: the BASE is the thumb's 44 px, and a wide screen with a pointer gets the 24 px
   * floor. It was written the other way round (base 24, a `max-width: 1024px` block re-stating 44),
   * which put the SMALL target on the device that cannot hit it and which `DesignSystemSuite`
   * rejects as a desktop-first correction. */
  min-height: var(--control-h-touch);
  color: inherit;
  text-decoration: none;
}
@media (min-width: 900px) {
  .eca-breadcrumb a, .eca-breadcrumb__link { min-height: var(--target-min); }
}
.eca-breadcrumb a:hover, .eca-breadcrumb__link:hover { text-decoration: underline; }
.eca-section-hint { margin: 0; font-size: var(--text-xs); color: var(--color-muted); }

/* A region label INSIDE a page ("Details", "Activity", "Attachments" on a ticket) is a different
 * rank from the page's own title: it names a part, not the subject. It is set as a tracked overline
 * in the muted ink, which lets the eye tell the two apart at a glance without a second heading size,
 * a coloured bar or a heavier weight. `.eca-section-title` stays the words — only the rank changes,
 * so no page loses a heading to the screen reader. */
/* Only the TITLE becomes the overline. The hint stays a hint: setting a sentence in uppercase with
 * wide tracking makes it shout (measured on `/issue/1`, where a 90-character hint wrapped to two
 * lines of caps beside a 12 px label). */
.eca-section-head--label .eca-section-title {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}
.eca-section-head--label .eca-section-hint { font-size: var(--text-xs); }
/* Prose keeps the reading measure wherever it sits, including inside a card that is now 1376 px
 * wide: a paragraph is read, not scanned, and 1300 px of it is a 140-character line. */
.eca-prose { max-width: var(--width-reading); }
.eca-prose > p:first-child { margin-top: 0; }
.eca-prose > p:last-child { margin-bottom: 0; }
.eca-section-head--label { margin-bottom: var(--space-2); }

/* A card whose only content is an empty state drops its own frame — one border for one sentence.
 * Both forms are supported: the explicit `.eca-section--bare`, and (below) the automatic one. */
.eca-section--bare { background: transparent; border: 0; box-shadow: none; padding: 0; }
.eca-section--bare > .eca-section-head { margin-bottom: var(--space-2); }
/* The same rule without the opt-in. Every list page that renders "nothing here yet" inside a section
 * produced a bordered box around a dashed bordered box — the third page to need the patch is the
 * point at which it belongs in the system. `:has()` keeps the frame when the card has real content
 * beside the empty state (a filter form, a toolbar). */
.eca-section:has(> .eca-empty):not(:has(> :not(.eca-section-head):not(.eca-empty))) {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.eca-section:has(> .eca-empty):not(:has(> :not(.eca-section-head):not(.eca-empty))) > .eca-section-head {
  margin-bottom: var(--space-2);
}

/* A row of controls above content. BOTTOM margin only — the top belongs to the page's rhythm rule
 * (§4). `margin: 0 0 …` here is why `/ticket/dashboard`, `/logs/list` and the two
 * `/builder/report` pages had the filter row and this toolbar start at the same y. */
.eca-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-actions);
  margin-block-end: var(--gap-block);
}

/* Tabs: a strip of buttons with one selection. It PANS when it does not fit — a label that
 * overflows is cut at a word boundary by the mask, never mid-word by the box. */
.eca-tabs {
  display: flex;
  gap: var(--space-1);
  margin-block-end: var(--gap-block);
  padding-bottom: var(--space-1);
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.eca-tabs > .item,
.eca-tabs > a.item {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-field);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  scroll-snap-align: start;
  text-decoration: none;
}
.eca-tabs > .item:hover { background: var(--color-surface-sunken); color: var(--color-ink); }
.eca-tabs > .item.active,
.eca-tabs > .item[aria-selected="true"],
.eca-tabs > .item[aria-current] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-surface));
}
/* The strip fades at the edge it continues past, so "there is more" is visible without a scrollbar
 * the reader cannot see on touch. It is ON by default and the mask is over the element's own box:
 * a strip that fits leaves the trailing 2rem EMPTY, so the fade is invisible, while an overflowing
 * strip (measured: `Present Late Future Past Project Tim|` at 390) shows the fade instead of a word
 * cut in half. */
.eca-tabs {
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2rem), transparent 100%);
}
@media (min-width: 640px) {
  .eca-tabs { flex-wrap: wrap; overflow: visible; mask-image: none; }
}

/* Statistics: a KPI strip. Base 2 per row (equal heights), 3 at 640, 6 at 1200. */
.eca-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;                 /* equal heights: a 3-line label cannot make one row taller */
  gap: var(--space-2);
  margin-block-end: var(--gap-block);
}
.eca-stats__item,
.statistics > .statistic {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  min-width: 0;
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
}
.eca-stats__value,
.statistics > .statistic > .value {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
}
.eca-stats__label,
.statistics > .statistic > .label {
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: var(--leading-normal);
  color: var(--color-muted);
  text-wrap: pretty;
  /* Every tile is the same height whether its label is one line or two: a strip whose cards grow
   * and shrink by their text reads as ragged (measured at 390: 108 / 92 / 84 px rows). */
  min-height: 2lh;
}
.statistics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-block-end: var(--gap-block); }
/* A tile may be a link: the whole card is the target, and the number keeps its tint. */
.eca-stats__item > a {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: inherit;
  text-decoration: none;
}
.eca-stats__item > a:hover { text-decoration: none; }
.eca-stats__item > a:hover .eca-stats__value { text-decoration: underline; }
/* State by tile: the VALUE takes the state ink, and the state words are still in the label. The
 * warning step is the fill that fails as text, so its ink is the text-safe one. */
.eca-stats__item--success .eca-stats__value { color: var(--color-success-ink); }
.eca-stats__item--warning .eca-stats__value { color: var(--color-warning-ink); }
.eca-stats__item--danger .eca-stats__value { color: var(--color-error-ink); }
.eca-stats__item--info .eca-stats__value { color: var(--color-info-ink); }
@media (min-width: 640px) {
  .eca-stats, .statistics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
  .eca-stats__item, .statistics > .statistic { padding: var(--space-4); }
}
@media (min-width: 1200px) {
  .eca-stats, .statistics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  /* A strip long enough to leave a 6 + 2 rag divides into fours instead. Count-aware, but stated
   * with the breakpoint rather than as an `!important` override of the base. */
  .eca-stats:has(> :nth-child(8)), .statistics:has(> :nth-child(8)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ═══ 5. TABLE ════════════════════════════════════════════════════════════════════════════════
 *
 * One table policy for the whole fleet (the contract's §3):
 *   · a header wraps only at a space, never inside a word, never hyphenated;
 *   · a body cell breaks an unbroken token only when it does not fit;
 *   · numbers are `.number` — right-aligned, tabular;
 *   · row actions are 32 px controls in one cell;
 *   · a table scrolls inside its box, the box never widens the page;
 *   · below 640 a list becomes labelled cards (`.eca-table--cards`), not a sideways scroll.
 */

.table, .eca-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  font-variant-numeric: tabular-nums;
}
.table thead th, .eca-table thead th {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-align: start;
  color: var(--color-muted);
  /* The header is a BAND cut into the card, not a row of the card: the same sunken plane the page
   * canvas uses, so a table's header separates itself from the body without a heavier rule. Before
   * this the header was white on white with one hairline, which is why a 200-row list read as a
   * single undifferentiated block of text. */
  background: var(--color-surface-sunken);
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  border-bottom: var(--border) solid var(--color-border);
  vertical-align: bottom;
}
.table tbody td, .eca-table tbody td {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border) solid var(--color-border);
  vertical-align: top;
  overflow-wrap: break-word;   /* only a token WIDER than the cell wraps */
  word-break: normal;
  hyphens: manual;
}
.table tbody tr:last-child td, .eca-table tbody tr:last-child td { border-bottom: 0; }
/* The row under the pointer is the ONE place a table gets the lift (see §1): it is the row that
 * answers the pointer, so it may sit above its neighbours while the pointer is on it. 90 ms is the
 * whole duration — a row that fades in over 200 ms lags the pointer that is already moving on. */
.table tbody tr, .eca-table tbody tr {
  transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.table tbody tr:hover td, .eca-table tbody tr:hover td { background: var(--color-surface-sunken); }
.table tbody tr:hover, .eca-table tbody tr:hover { box-shadow: var(--shadow-lift); }

/* The selected row (a batch action's target, a picked assignee): a tinted ground AND the accent
 * rail on its leading edge, so "selected" is not carried by tint alone (WCAG 1.4.1 — a colour-only
 * state is unreadable in forced-colors and to a colour-blind reader). */
.table tbody tr.is-selected td, .eca-table tbody tr.is-selected td,
.table tbody tr[aria-selected="true"] td, .eca-table tbody tr[aria-selected="true"] td {
  background: color-mix(in oklab, var(--color-primary) 8%, var(--color-surface));
}
.table tbody tr.is-selected td:first-child,
.eca-table tbody tr.is-selected td:first-child,
.table tbody tr[aria-selected="true"] td:first-child,
.eca-table tbody tr[aria-selected="true"] td:first-child {
  box-shadow: inset var(--rail) 0 0 var(--color-primary);
}
.table .number, .eca-table .number { text-align: end; font-variant-numeric: tabular-nums; }
.table td > .button, .eca-table td > .button { margin: 0; vertical-align: middle; }
.table-scroll { overflow-x: auto; max-width: 100%; }

@media (min-width: 640px) {
  .table thead th, .eca-table thead th,
  .table tbody td, .eca-table tbody td { padding: var(--space-2) var(--space-4); }
  /* A row action inside a cell is a DENSE control: 32 px, the `--control-h-sm` this sheet already
   * publishes for exactly that. Only `.table td > .button` applied it, so a migrated row action
   * (`.eca-btn`, which is what every page emits) measured the full 38 px and set the row at 60 px
   * against the 40 px dense target — iTrack carried this delta in its own sheet until now. */
  .eca-table td .eca-btn, .table td .eca-btn {
    min-height: var(--control-h-sm);
    padding-block: 0;
    padding-inline: var(--space-2);
    font-size: var(--text-xs);
  }
  .eca-table td .eca-actions, .table td .eca-actions { margin: 0; padding: 0; border: 0; flex-wrap: nowrap; }
}

/* ── The card rendering (`.eca-table--cards`): every cell becomes a labelled row ─────────────
 *
 * **The one `max-width` block in this sheet, and why it is the correct shape here.**
 *
 * Mobile-first governs LAYOUT DIRECTION: a base that is right on a phone and an enhancement for
 * width. A table is not a direction problem — the base of `<table>` IS the table layout, and a card
 * rendering is an alternative for a constrained input device. Written the "mobile-first" way round
 * (base = cards, `min-width: 640` = table) it produced a broken table: nine header cells against a
 * body whose cells no longer participate in table layout, so the first column took 837 of 1617 px
 * and the subject rendered under `DEVELOPERS` (measured on `/issues/tickets` at 1440; `table-layout:
 * fixed !important` did not move a single column, which is the proof that the cells were not in a
 * table at all). The downward block is the implementation that works, because it *starts from the
 * table* Chrome already knows how to lay out and makes it a block list — never the other way round.
 *
 * `DesignSystemSuite` allows exactly this one `max-width` block, and asserts that everything inside
 * it names `.eca-table--cards` — the exception is pinned, not a hole in the rule.
 */
@media (max-width: 639.98px) {
  /* A card is not a scroller: a page that wrapped its table in `.table-scroll` must not keep a
   * horizontal scroll box around the cards (measured by the audit as "card tables have a locked
   * scroll wrapper"). */
  .table-scroll:has(> .eca-table--cards) { overflow-x: visible; }
  .eca-table--cards {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 0;
  }
  .eca-table--cards > thead { display: none; }
  .eca-table--cards > tbody { display: block; }
  .eca-table--cards > tbody > tr {
    display: block;
    margin: 0 0 var(--space-2);
    padding: var(--space-3);
    background: var(--color-surface);
    border: var(--border) solid var(--color-border);
    border-radius: var(--radius-box);
  }
  .eca-table--cards > tbody > tr:last-child { margin-bottom: 0; }
  /* The first cell is the record's name: it is the card's title, so it gets the full width. */
  .eca-table--cards > tbody > tr > td:first-child {
    padding: 0 0 var(--space-2);
    font-size: var(--text-base);
    font-weight: 650;
  }
  .eca-table--cards > tbody > tr > td {
    display: block;
    padding: var(--space-2) 0;
    border: 0;
    text-align: start;
    overflow-wrap: break-word;
  }
  .eca-table--cards > tbody > tr > td + td { border-top: var(--border) solid var(--color-border); }
  /* A label and its value on one line: the label is a 12px uppercase tag in its own column, so the
   * value starts at the same x on every row of the card. */
  .eca-table--cards > tbody > tr > td:not(:first-child) {
    display: grid;
    grid-template-columns: minmax(5.5rem, 32%) minmax(0, 1fr);
    gap: var(--space-2);
    align-items: baseline;
  }
  .eca-table--cards > tbody > tr > td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--text-xs);
    font-weight: 650;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-muted);
  }
  .eca-table--cards > tbody > tr > td:first-child::before { display: none; }
  /* The last cell is the record's ACTIONS: its label sits above a full-width control, so a button
   * label has the card's width instead of one grid column ("Change notification" was clipped at
   * 145px when the action shared the label/value grid). */
  .eca-table--cards > tbody > tr > td:last-child {
    display: block;
    padding-top: var(--space-2);
    border-top: var(--border) solid var(--color-border);
  }
  .eca-table--cards > tbody > tr > td:last-child::before { margin-bottom: var(--space-1); }
  .eca-table--cards > tbody > tr > td:empty { display: none; }
  /* A badge or a person chip is an INLINE mark, not a column: as a grid item it stretched to the
   * whole value column, so a state read as a full-width progress bar (measured on `/issues/tickets`
   * at 390: the `Open` pill spanned 190 px instead of 62). */
  .eca-table--cards td > .eca-badge,
  .eca-table--cards td > .eca-person,
  .eca-table--cards td > .eca-empty__art { justify-self: start; }
  .eca-table--cards td a, .eca-table--cards td button {
    min-height: var(--control-h-touch);
    min-width: var(--control-h-touch);
    display: inline-flex;
    align-items: center;
  }
  .eca-table--cards td .eca-btn, .eca-table--cards td .button { min-height: var(--control-h-touch); }
}

/* Legacy mobile card lists: one rendering, never two (a page that emitted both showed 21
 * duplicate cards at every width). BASE = the card list; ≥640 hides it and the table shows. */
.leaves-mobile-cards, .balance-mobile-cards, .config-mobile-cards, .tiers-mobile-cards { display: block; }
@media (min-width: 640px) {
  .leaves-mobile-cards, .balance-mobile-cards, .config-mobile-cards, .tiers-mobile-cards { display: none; }
}

/* ═══ 6. FORM ═════════════════════════════════════════════════════════════════════════════════
 *
 * A field is a stack of four things, always in this order: label → control → help → error. The
 * error is UNDER ITS OWN FIELD; a page-level error belongs in the notification slot.
 * Base = one column, 44 px controls (touch). ≥640 = the form may state columns.
 */

.eca-form { display: flex; flex-direction: column; gap: var(--gap-block); }
.form-fields, .eca-form__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap-block);
}
.eca-field, .field, .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin: 0;
}
.eca-field-row, .eca-field--row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  min-width: 0;
}
/* A row of related controls (a filter: Projects / States / From / To) becomes the number of columns
 * that fit, never a fixed count: 1 at 390, 2–3 at 768, 4–5 at 1440. `align-items: end` puts the
 * control boxes on one line even when one label wraps. */
@media (min-width: 640px) {
  .eca-field-row, .eca-field--row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    gap: var(--space-1) var(--space-3);
    align-items: end;
  }
}
.eca-label, .field > label, .form-field > label, .eca-field > label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink);
}
.eca-required { color: var(--color-error-ink); font-weight: 700; }
.eca-hint {
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--color-muted);
  max-width: var(--measure-narrow);
}
.eca-hint--error { color: var(--color-error-ink); font-weight: 600; }

/* One control box, whichever element it is on. 44 px at every width below 640 is the touch
 * target; above it the 38 px field is dense enough to scan. */
.eca-input, .eca-select, .eca-textarea, input[type="text"], input[type="email"],
input[type="password"], input[type="search"], input[type="number"], input[type="date"],
input[type="month"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border-strong);
  border-radius: var(--radius-field);
  box-sizing: border-box;
}
.eca-input:hover, .eca-select:hover, textarea:hover, select:hover { border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-border-strong)); }
.eca-input:focus, .eca-select:focus, textarea:focus, select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.eca-input::placeholder, textarea::placeholder { color: var(--color-muted); opacity: 1; }
.eca-input[readonly], .eca-input:disabled, select:disabled, textarea:disabled {
  background: var(--color-surface-sunken);
  color: var(--color-muted);
  cursor: not-allowed;
}
textarea, .eca-textarea { min-height: 8rem; resize: vertical; }

/* A FILE INPUT is its own control, not a text box: the text-box rule would clip the browser's
 * "Choose file" chrome into a 38px slab. The control keeps the field's border and radius; the inner
 * button becomes a real button — `::file-selector-button` is the only hook that styles it, and the
 * file-name text beside it is UA-owned. */
input[type="file"], .eca-input[type="file"] {
  height: auto;
  padding: var(--space-1);
  line-height: var(--leading-normal);
  cursor: pointer;
}
input[type="file"]::file-selector-button, .eca-input[type="file"]::file-selector-button {
  margin-inline-end: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: var(--border) solid var(--color-border-strong);
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--color-border); }
select, .eca-select {
  appearance: none;
  padding-inline-end: var(--space-6);
  /* A drawn chevron in a data URI — no external asset, no icon-font dependency, and it is the
   * same mark the nav's groups use. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235f6165' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px 8px;
}
[dir="rtl"] select, [dir="rtl"] .eca-select { background-position: left var(--space-3) center; }

/* A checkbox/radio is a 24 px control with a 44 px row: the whole label is the target. */
.eca-checkbox, .eca-radio, .eca-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  font-size: var(--text-sm);
  cursor: pointer;
}
.eca-checkbox > input, .eca-radio > input, .eca-check > input {
  flex: 0 0 auto;
  width: var(--check-size);
  height: var(--check-size);
  min-height: 0;
  margin: 0;
  accent-color: var(--color-primary);
}
.eca-radio-group, .eca-checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }

/* Multi-select as a disclosure (never a tall `<select multiple>`). Only the OPEN control is
 * elevated: every one at `z-index: 40` meant the next closed control painted over an open panel. */
.eca-multiselect { position: relative; z-index: 1; min-width: 0; }
.eca-multiselect[open] { z-index: 80; }
.eca-multiselect > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border-strong);
  border-radius: var(--radius-field);
  list-style: none;
  cursor: pointer;
}
.eca-multiselect > summary::-webkit-details-marker { display: none; }
.eca-multiselect__panel {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + var(--space-1));
  z-index: 60;
  min-width: 100%;
  max-height: 18rem;
  overflow-y: auto;
  padding: var(--space-1);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
  box-shadow: var(--shadow-3);
}
/* The disclosure's caret is DRAWN, like the nav's and the select's: the legacy markup puts a `▾`
 * glyph in a span, and at 10px it reads as a stray dot at the end of the trigger. `font-size: 0`
 * removes the glyph box and the borders draw the mark. */
.eca-multiselect__caret {
  flex: 0 0 auto;
  font-size: 0;
  width: var(--caret-size);
  height: var(--caret-size);
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: .6;
}
.eca-multiselect[open] > summary .eca-multiselect__caret { transform: rotate(-135deg) translateY(-1px); }
.eca-multiselect__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-field);
  cursor: pointer;
}
.eca-multiselect__row:hover { background: var(--color-surface-sunken); }
.eca-multiselect__row input { width: var(--check-size); height: var(--check-size); margin: 0; flex: 0 0 auto; accent-color: var(--color-primary); }
.eca-multiselect__row > span { flex: 1 1 auto; }
/* A panel that would be cut off below opens upward (the placement is decided by the shared
 * disclosure script, which only adds the class). */
.eca-multiselect.opens-up > .eca-multiselect__panel { top: auto; bottom: calc(100% + var(--space-1)); }

/* A filter row: above the list it filters, one column on a phone, one line above 640. */
.eca-filter-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  margin: 0;
}
.eca-filter-bar > * { min-width: 0; flex: 0 1 auto; }
/* ── THE ROW'S DIRECTION IS THE BLOCK'S, NOT THE UTILITY LAYER'S ────────────────────────────────
 *
 * `uno.css` (agent-web's utility sheet, linked LAST by `EcaUiAssets.defaultPageStyles`) also declares
 * `.eca-filter-bar { display: flex; flex-wrap: wrap; gap: …; align-items: flex-end }`. One class
 * against one class, so it wins the tie by source order and the bar's own `display`/`flex-wrap`/
 * `align-items` above are dead on every app. It does NOT name `flex-direction`, so at a phone width
 * the bar was left as a COLUMN whose items are shrink-to-content and pushed to the CROSS-AXIS END —
 * i.e. right-aligned — and `flex-wrap: wrap` then laid the overflow into a second column that ran
 * past the form's edge. Measured on `ark` at 390: 112 px fields at x=230 inside a 309 px form (33 px
 * of the row outside it). The page abandoned the shared bar for `.eca-field-row` groups, which is an
 * app routing around the layer — the defect is here.
 *
 * The repair is not `!important` (the system sheet bans it) and not rank (a duplicated class or an
 * ancestor would only buy the same tie one class higher): the ITEMS state their own place on the
 * cross axis with `align-self`, which nothing in the chain declares. Whatever `align-items` the
 * utility layer sets, a narrow bar is a full-width stack again — the layout this block already
 * states for a phone. Above 640 the items opt back out and the bar is the row the media block
 * below describes, so 640 and 768 are untouched. */
.eca-filter-bar > * { align-self: stretch; }
.eca-filter-bar .eca-field, .eca-filter-bar .field, .eca-filter-bar .form-field { flex: 0 1 auto; }
.eca-filter-bar .eca-actions { margin-top: var(--space-1); }
@media (min-width: 640px) {
  .eca-filter-bar > * { align-self: auto; }
  .eca-filter-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3) var(--space-4);
  }
  .eca-filter-bar input[type="text"], .eca-filter-bar input[type="date"],
  .eca-filter-bar input[type="month"], .eca-filter-bar input[type="number"],
  .eca-filter-bar select { min-width: 11rem; }
}

/* ── THE LIVE ROW (`FilterBar.live`): the same bar, as a real GET form ────────────────────────────
 *
 * The block already existed and only its CSS did: every app with a long list re-implemented the
 * behaviour (nexus on 15 pages, through ListJS), which is the X107 shape — styling with no
 * component. `FilterBar.live` is the form, `javascripts/filter/eca-filter.js` is the island, and the
 * three rules below are the parts the SUBMIT-only row never needed:
 *
 *   · `__actions` — the submit/reset pair. An action row, so it states `--gap-actions` (one answer
 *     for the space between two independent controls, §1).
 *   · `__status` — the live region. It is in the accessibility tree from first paint (a
 *     `display:none` region that later gains text is a region some screen readers never announce),
 *     and it is EMPTY until something is filtered: a permanent "12 of 12 rows match" is noise. An
 *     empty flex item is zero-width, so `:empty` drops its 100% basis and it adds no line of its own.
 *   · `__field--column` — a per-column control. It is `display: none` until the island sets
 *     `data-eca-filter-ready` on the form: with JavaScript off the row still narrows on the server
 *     (the query field and the submit), but a per-column box that posts nothing the server binds
 *     would be a control that does nothing, and a control that does nothing is a defect.
 *     The selectors are `>`-child and carry the block class, because the alias layer's
 *     `.eca-filter-bar > .eca-filter-bar__field` (0,2,0) sets `display: grid` and would out-rank a
 *     bare `.__field--column` (0,1,0) hide.
 */
.eca-filter-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-actions);
  margin: 0;
}
.eca-filter-bar__status {
  flex: 1 1 100%;
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-muted);
}
.eca-filter-bar__status:empty { flex: 0 0 auto; }
.eca-filter-bar > .eca-filter-bar__field--column { display: none; }
.eca-filter-bar[data-eca-filter-ready] > .eca-filter-bar__field--column { display: grid; }

/* A row the filter hid must not paint. `tr` has no `display` of its own in this sheet, but a page's
 * own sheet (`display: table-row`, a card layout) would beat the UA's `[hidden]` rule — the same
 * defect `.eca-repeat__remove[hidden]` was written for. */
.table tbody > tr[hidden], .eca-table tbody > tr[hidden] { display: none; }

/* The action row at the end of a form: separated by a rule, primary on the RIGHT above 480 (the
 * reader's eye ends there), stacked full-width on a phone with the primary first.
 *
 * `margin-block-end` is part of the component, not page taste: measured on `/role/Administrator/
 * details` and `/role/Customer%20Developer/members`, the row's bottom edge was at the EXACT y where
 * the table below it started — 0 px between a button and the first `<th>`, so the row read as the
 * table's own header band. One block gap under the row is what makes it a row. */
.eca-actions {
  /* DOM order, not `column-reverse`: pages put the primary LAST (because on a desktop the primary is
   * the rightmost control), so a column of them ends with the primary at the thumb — the platform
   * convention — without inverting a page that put its primary first (the login page's "Sign In"
   * ended up BELOW "Sign in with Singpass" under `column-reverse`). */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap-actions);
  margin-top: var(--gap-block);
  margin-block-end: var(--gap-block);
  padding-top: var(--gap-block);
  border-top: var(--border) solid var(--color-border);
}
/* A row that ends its container needs no trailing gap: the container's own padding is the gap. */
.eca-actions:last-child { margin-block-end: 0; }
/* …and a row that is a flex ITEM of a horizontal bar (a filter bar, a toolbar) must not carry it
 * either: a bottom margin makes the item's margin box taller, so `align-items: center`/`flex-end`
 * lifts the row off the controls' baseline by half of it. The bar's own gap owns that spacing. */
.eca-filter-bar .eca-actions,
.eca-toolbar .eca-actions { margin-block-end: 0; }
/* ── ONE separator per boundary ───────────────────────────────────────────────────────────────
 *
 * A page header already draws the rule under the title (`border-bottom`). An action row directly
 * under it drew a SECOND rule 12 px lower (the row's `margin-top` sits outside its own border), so
 * two hairlines of the same weight bracketed 12 px of nothing — measured on `/role/Administrator/
 * details` and `/role/Customer%20Developer/members`. The header owns the line: when the row follows
 * one, its top border and its top padding stand down and the row starts on the header's own rhythm.
 *
 * The base rule above is deliberately NOT touched: an action row that appears WITHOUT a header (a
 * form's footer, a card's actions) still needs its own separator, and removing it there would leave
 * the row floating in its card. */
.eca-page-header + .eca-actions {
  padding-top: 0;
  border-top: 0;
}
/* ── A page's OWN row draws no rule it did not ask for ─────────────────────────────────────────
 *
 * The base rule above is for a row that OWNS its boundary (a form footer, a card's actions). A row
 * a page renders inside a surface that already has an edge — the sign-in card is the case that
 * caught this — was getting a hairline above it that nobody designed: `ark`'s login renders its own
 * "Sign in" row and measured a rule above it that its (older, page-local) sheet had never asked for.
 * The page's own sheet predates the class, so the answer cannot be "edit the page" — it is a
 * modifier a page opts into, plus the login surface's own sheet, which owns its boundary (the same
 * rule X120 states: one separator per boundary, one owner per line).
 *
 * `--plain` removes the rule and the padding that made room for it, and the top margin too: a row
 * inside a padded card is separated by the card's padding, and a second gap under it is the block
 * rhythm's job, not the row's.
 */
.eca-actions--plain {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
@media (min-width: 480px) {
  .eca-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
}

/* ── One row, one height: a button-only form is not a box, and `--sm` stays in the table ────────
 *
 * Measured on `/issue/673` at 1440: `Back to tickets` and `Edit ticket` sat at y=133, and `Save
 * ticket` at y=127 — 6 px higher — because it is a `<button>` inside `<form class="eca-form">`, a
 * flex COLUMN that added its own box to the action row, so the button was laid out inside the form
 * instead of as a sibling of the two links. A form that holds nothing but a button is not a layout
 * element: `display: contents` removes the box and keeps the submit semantics (`:has()` keeps a
 * form that really has fields untouched).
 *
 * The second half of the same defect: `.eca-btn--sm` is documented as "dense — inside a table row",
 * and a header/action row mixes it with normal buttons, so two controls of one row had different
 * heights in different rows. Inside an action row every button is the control height; the dense
 * variant keeps its meaning where it belongs. */
/* `input:not([type="hidden"])`: every form in these rows carries the CSRF token as a hidden input, so
 * a plain `:has(input)` matched EVERY form — the rule then applied to nothing and the 6 px offset
 * survived (measured: `/issue/673`, `Save comment` y=2110 against `Reply` y=2116). */
.eca-actions > form:not(:has(input:not([type="hidden"]), select, textarea)),
.eca-page-header form:not(:has(input:not([type="hidden"]), select, textarea)),
.eca-page-actions > form:not(:has(input:not([type="hidden"]), select, textarea)) { display: contents; }
/* Only where there IS a pointer: below 640 the base is `--control-h-touch` (44) and forcing 38 here
 * dropped 14 controls under the touch minimum on `/issue/673` at 390 — the audit caught it as
 * `below44`, which is a WCAG 2.5.8 target-size failure, not a taste call. */
@media (min-width: 640px) {
  .eca-actions .eca-btn, .eca-page-header .eca-btn, .eca-page-actions .eca-btn {
    height: var(--control-h);
    min-height: var(--control-h);
  }
}

/* Third-party widgets: the editor's toolbar is styled by its OWN sheet (`trumbowyg.css`), because a
 * page appends the plugin's stylesheets AFTER this chain — a rule here would be dead. The tree,
 * the calendar host and the mask are shared enough to belong here. */
/* The datepicker's host (`FormSupport.calendarField`): a positioning box for the picker, sized by
 * its input. It had no rule at all — a class the shared layer emits and nothing styles (X107). */
.eca-calendar { display: block; min-width: 0; }
.eca-calendar--datepicker { position: relative; }
.eca-mdtree__master, .eca-mdtree__detail { display: block; min-width: 0; }
.eca-mdtree__master { flex: 0 0 auto; }

/* ═══ 7. BUTTONS: ONE component, one hierarchy ═══════════════════════════════════════════════
 *
 * The hierarchy is FILL vs OUTLINE, and the default is the outline:
 *
 *   .eca-btn              default (quiet)  — Back, Cancel, Filter: most controls on a page
 *   .eca-btn-primary      the one filled action the screen exists for
 *   .eca-btn-danger       destructive — outlined, error ink, always confirmed
 *   .eca-btn--sm          dense — inside a table row
 *
 * The default is the quiet one *because the markup already means that*: 178 bare `.eca-btn`, 86
 * `.eca-btn-secondary`, 70 `.eca-btn-primary` across this app's views. Making the bare class
 * filled would repaint every "Back to tickets" green and give half the pages two primaries. A
 * hierarchy that requires rewriting every call site is a hierarchy that ships half-applied.
 *
 * Every variant states its own colour so a later sheet's `.eca-btn` cannot repaint it: the
 * selector is `.eca-btn.eca-btn-…` (specificity 0,2,0). That is a measured requirement — caas
 * shipped a danger button that computed the body ink, because `uno.css` loaded last.
 */

.eca-btn, button.button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  /* A touch target is a BOX, not a height. The floor was stated for height only, so a button whose
   * label is one short word ("Go", "OK", "Yes") measured 43×44 at phone width — height met, width
   * missed, and WCAG 2.2 2.5.8 is about the target's size. `caas` had to carry
   * `.eaw-page .eca-btn{min-width: var(--control-h-touch)}` in its own `overwatch.css` to reach
   * 44×44; that rule belongs here, in the component, so every app gets it and none repeats it.
   * Padding is the natural width, this is the floor under it — a longer label is unaffected. */
  min-width: var(--control-h-touch);
  /* The component states its own box, including the margin. `admin.css`'s legacy blanket
   * `button, .button { margin: .1rem }` was leaking 1.6 px into every `.eca-btn`: two buttons in one
   * header row measured y=133 and y=127 (`/issue/673`), and it is the same 1.6 px the alias layer's
   * own comments blame for "adjacent actions look stuck together". Overridden here rather than
   * deleted there, because unmigrated legacy markup still relies on that rule. */
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-ink);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border-strong);
  border-radius: var(--radius-field);
  cursor: pointer;
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.eca-btn:hover, button.button:hover, a.button:hover {
  background: var(--color-surface-sunken);
  border-color: var(--color-muted);
  text-decoration: none;
}
.eca-btn:active { background: var(--color-surface-sunken); }
.eca-btn[disabled], .eca-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.eca-btn > i, .eca-btn > .mdi { font-size: 1.15em; line-height: 1; display: inline-flex; align-items: center; }

.eca-btn.eca-btn-primary {
  color: var(--color-primary-content);
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.eca-btn.eca-btn-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.eca-btn.eca-btn-secondary, .eca-btn.eca-btn--secondary {
  color: var(--color-ink);
  background: transparent;
  border-color: var(--color-border-strong);
}
.eca-btn.eca-btn-secondary:hover, .eca-btn.eca-btn--secondary:hover {
  background: var(--color-surface-sunken);
  border-color: var(--color-muted);
}

.eca-btn.eca-btn-danger {
  color: var(--color-error-ink);
  background: transparent;
  border-color: color-mix(in oklab, var(--color-error) 45%, var(--color-border));
}
.eca-btn.eca-btn-danger:hover {
  color: var(--color-error-content);
  background: var(--color-error);
  border-color: var(--color-error);
}

.eca-btn.eca-btn--sm {
  /* NO `min-height` at the base: a dense row action is still a 44px touch target on a phone and
   * only becomes compact where there is a pointer instead of a thumb. */
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-field);
}
.eca-btn.eca-btn-icon {
  width: var(--control-h-touch);
  height: var(--control-h-touch);
  min-width: var(--control-h-touch);
  padding: 0;
  gap: 0;
  flex: 0 0 auto;
  /* An icon-only control states its own ink: the page's prose-link rule deliberately does not
   * reach `eca-*` anchors, so without this it inherits whatever it sits in. */
  color: var(--color-ink);
  font-size: var(--text-base);
}
.eca-btn.eca-btn-icon > .mdi, .eca-btn.eca-btn-icon > .mdi::before { font-size: 1.15em; line-height: 1; }

/* A button GROUP: a set of actions on one subject ("Edit · Clone · Details · Members"), spaced by
 * the action rhythm and never two filled buttons. It is NOT a segmented control with shared
 * borders: abutting them makes one control with four labels, which is the "joined together" the
 * user reported. The group's job is to say "these belong together"; the spacing is what makes the
 * belonging legible.
 *
 * The doubled selector is a measured requirement, not defensive noise: `agent-web/uno.config.ts`
 * publishes `eca-btn-group` as a shortcut (`inline-flex items-center gap-2`) and `uno.css` is
 * loaded AFTER this sheet, so a single-class rule loses its gap to a utility's 8 px — silently.
 * 0,2,0 wins without `!important`, the same technique the button variants use above. */
.eca-btn-group { display: inline-flex; flex-wrap: wrap; align-items: center; }
.eca-btn-group.eca-btn-group { gap: var(--gap-actions); }
.eca-btn-group > .eca-btn { margin: 0; }
/* A form that ends in two bare buttons (no `.eca-actions`) still spaces them: several pages emit
 * `<form>` + two siblings, and 8 px was the old answer there too. */
form > .eca-btn + .eca-btn { margin-inline-start: var(--gap-actions); }
/* A one-control form in a table row is an ACTION, not a form layout. `.eca-form` is a **column**
 * with `gap` (label → fields → actions), so a delete button wrapped in one measured 52 px against
 * the 40 px link beside it, and centring the row left the button 6 px high — the "View/Delete not
 * aligned" complaint. The form keeps its POST; only its layout changes. */
.eca-table td form.eca-form { display: inline-flex; flex-direction: row; align-items: center; gap: 0; }

@media (min-width: 640px) {
  /* The touch floor follows the metric at the pointer breakpoint exactly as the height does: 44 px
   * of thumb below 640, the 38 px `--control-h` above it. A narrow label is never *smaller* than
   * the control it sits in, which is the mismatch this pairs away. */
  .eca-btn { min-height: var(--control-h); min-width: var(--control-h); }
  .eca-btn.eca-btn--sm { min-height: var(--control-h-xs); padding: var(--space-1) var(--space-3); }
  .eca-btn.eca-btn-icon { width: var(--control-h); height: var(--control-h); min-width: var(--control-h); }
}

/* ═══ 8. FEEDBACK: message, badge, empty state ═══════════════════════════════════════════════ */

/* A page outcome: a sentence with a state-coloured rule and a tint. Text first — the tint is
 * reinforcement, and every variant's ink is measured against its own tint (≥4.5:1).
 *
 * BOTTOM margin only — the top is the page's rhythm rule (§4). The `margin: 0 0 …` that used to be
 * here is why `/user/profile/1/relationship/search` had its form and this banner welded at 0 px. */
.eca-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-block-end: var(--gap-block);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-ink);
  background: var(--color-info-soft);
  border: var(--border) solid color-mix(in oklab, var(--color-info) 32%, var(--color-border));
  border-radius: var(--radius-box);
}
.eca-message--error, .eca-message--danger {
  background: var(--color-error-soft);
  border-color: color-mix(in oklab, var(--color-error) 32%, var(--color-border));
}
.eca-message--success {
  background: var(--color-success-soft);
  border-color: color-mix(in oklab, var(--color-success) 32%, var(--color-border));
}
.eca-message--warning {
  background: var(--color-warning-soft);
  border-color: color-mix(in oklab, var(--color-warning) 40%, var(--color-border));
}
.eca-message__title { font-weight: 650; }

/* A badge states a value in words; the colour repeats it. */
.eca-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 650;
  line-height: var(--leading-tight);
  white-space: nowrap;
  color: var(--color-ink);
  background: var(--color-surface-sunken);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-pill);
}
.eca-badge.is-open, .eca-badge.is-new { color: var(--color-info-ink); background: var(--color-info-soft); border-color: color-mix(in oklab, var(--color-info) 32%, var(--color-border)); }
.eca-badge.is-pending, .eca-badge.is-pending-approval, .eca-badge.is-pending-amendment,
.eca-badge.is-waiting, .eca-badge.is-kiv {
  color: var(--color-warning-ink);
  background: var(--color-warning-soft);
  border-color: color-mix(in oklab, var(--color-warning) 40%, var(--color-border));
}
.eca-badge.is-approved, .eca-badge.is-taken, .eca-badge.is-closed, .eca-badge.is-resolved,
.eca-badge.is-done, .eca-badge.is-released {
  color: var(--color-success-ink);
  background: var(--color-success-soft);
  border-color: color-mix(in oklab, var(--color-success) 32%, var(--color-border));
}
.eca-badge.is-rejected, .eca-badge.is-void, .eca-badge.is-cancelled, .eca-badge.is-overdue {
  color: var(--color-error-ink);
  background: var(--color-error-soft);
  border-color: color-mix(in oklab, var(--color-error) 32%, var(--color-border));
}
.eca-badge.is-draft { color: var(--color-muted); }

/* A count: a pill that grows with the digits. A fixed 28 px circle clipped "611". */
.eca-badge--count, .eca-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
  background: var(--color-surface-sunken);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-pill);
}

/* An empty state says WHAT IS MISSING and WHAT TO DO NEXT. Its action lives inside it. */
.eca-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  background: var(--color-surface-inset);
  border: var(--border) dashed var(--color-border);
  border-radius: var(--radius-box);
}
.eca-empty__title { font-size: var(--text-sm); font-weight: 650; color: var(--color-ink); }
.eca-empty__hint { margin: 0; max-width: var(--measure-narrow); font-size: var(--text-sm); line-height: var(--leading-relaxed); color: var(--color-muted); }
.eca-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap-actions); margin-top: var(--space-1); }

/* ── Small shared bits ─────────────────────────────────────────────────────────────────────── */
.eca-lead { font-size: var(--text-lg); line-height: var(--leading-snug); max-width: var(--measure); color: var(--color-ink); }
.eca-hint--block { display: block; margin-bottom: var(--gap-block); }
.eca-code, code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.eca-code, pre {
  display: block;
  max-width: 100%;
  padding: var(--space-3);
  overflow-x: auto;
  background: var(--color-surface-inset);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
}
.eca-divider { margin: var(--gap-section) 0; border: 0; border-top: var(--border) solid var(--color-border); }
/* A label that only a screen reader reads: an icon-only control still needs an accessible name, and
 * a visible one would undo the reason the control is icon-only. The clip technique (not
 * `display:none`) keeps it in the accessibility tree. */
.eca-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.eca-inline-form { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.eca-reading-column { max-width: var(--width-reading); }
.form-column { max-width: var(--width-form); }


/* ═══ 8b. ICONS: one drawn set, painted with the text's own ink ═══════════════════════════════
 *
 * The system shipped no icons at all, which is half of why a finished page read as a wireframe: a
 * row of text-only controls gives the eye nothing to aim at. It also shipped a 560 KB icon WEBFONT
 * for three table cells while every other icon-only control rendered an empty box — a font is a
 * second download that can fail, a second glyph set that can drift, and it cannot take the ink of
 * the control it sits in.
 *
 * So: one inline SVG per glyph, applied as a `mask-image` over `background-color: currentColor`.
 * One drawing paints in whatever ink the element has (a danger row action's icon is the danger ink,
 * a nav marker's is the nav's), it cannot fail to load while text renders, and it costs one
 * declaration per glyph in a sheet that is already cached with the page.
 *
 * Every glyph is paired with words or with an `aria-label` on its control: a mask is not painted in
 * `forced-colors` and is not read by a screen reader, and both are correct — the words carry the
 * meaning (WCAG 1.4.1).
 *
 * Sizes: 16 inline with 13 px text, 20 a row action, 24 a standalone mark. The Scala side
 * (`Icons.scala`) names a glyph; `IconSuite` fails if a name has no rule here, the same contract the
 * component guard enforces for every other `eca-*` class.
 */
:root {
  --eca-icon-edit: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M4 20l1-5L16 4l4 4L9 19z'/><path d='M14 6l4 4'/></svg>");
  --eca-icon-view: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z'/><circle cx='12' cy='12' r='3'/></svg>");
  --eca-icon-search: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='6.5'/><path d='M20 20l-4.4-4.4'/></svg>");
  --eca-icon-filter: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M4 5h16l-6 7v6l-4 2v-8z'/></svg>");
  --eca-icon-sort: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M7 20V5M7 5L4 8M7 5l3 3'/><path d='M17 4v15M17 19l-3-3M17 19l3-3'/></svg>");
  --eca-icon-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  --eca-icon-check: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M4 12.5l5 5L20 6.5'/></svg>");
  --eca-icon-close: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M5 5l14 14M19 5L5 19'/></svg>");
  --eca-icon-plus: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M12 5v14M5 12h14'/></svg>");
  --eca-icon-download: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3v12M12 15l-4-4M12 15l4-4'/><path d='M4 19h16'/></svg>");
  --eca-icon-attach: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M20 12l-7.4 7.4a5 5 0 01-7-7L13 5a3.4 3.4 0 015 5l-7.5 7.5a2 2 0 01-3-3L15 7'/></svg>");
  --eca-icon-comment: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M20 15a3 3 0 01-3 3H8l-4 3V6a3 3 0 013-3h10a3 3 0 013 3z'/></svg>");
  --eca-icon-clock: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='8.5'/><path d='M12 7v5.5l3.5 2'/></svg>");
  --eca-icon-user: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='3.6'/><path d='M5 20c0-3.6 3-6 7-6s7 2.4 7 6'/></svg>");
  --eca-icon-users: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='3.2'/><path d='M2.5 20c0-3.2 2.9-5.5 6.5-5.5s6.5 2.3 6.5 5.5'/><path d='M17 5.2a3.2 3.2 0 010 5.9'/><path d='M18 14.8c2.3.7 3.5 2.4 3.5 5.2'/></svg>");
  --eca-icon-lock: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><rect x='4.5' y='10' width='15' height='10' rx='2'/><path d='M8 10V7.5a4 4 0 018 0V10'/></svg>");
  --eca-icon-alert: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3.5L21.5 20H2.5z'/><path d='M12 9.5v4.5'/><circle cx='12' cy='17.2' r='0.9' fill='%23000' stroke='none'/></svg>");
  --eca-icon-history: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M3.5 12a8.5 8.5 0 108.5-8.5'/><path d='M12 3.5V7'/><path d='M12 7l4 2'/><path d='M3.5 12H7'/><path d='M3.5 12l2.5-2.5'/></svg>");
  --eca-icon-external: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M14 4h6v6'/><path d='M20 4l-8.5 8.5'/><path d='M18 14v5a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h5'/></svg>");
  --eca-icon-info: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='8.5'/><path d='M12 11v5.5'/><circle cx='12' cy='7.8' r='0.9' fill='%23000' stroke='none'/></svg>");
  --eca-icon-tray: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M3.5 13.5l2.5-7h12l2.5 7v4a1 1 0 01-1 1H4.5a1 1 0 01-1-1z'/><path d='M3.5 13.5h5l1 2h5l1-2h5'/></svg>");
  --eca-icon-arrow-right: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M4 12h15'/><path d='M14 7l5 5-5 5'/></svg>");
}

.eca-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  background-color: currentColor;
  -webkit-mask-image: var(--glyph, var(--eca-icon-info));
  mask-image: var(--glyph, var(--eca-icon-info));
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: -0.15em;
}
.eca-icon--sm { width: 1rem; height: 1rem; }
.eca-icon--md { width: 1.25rem; height: 1.25rem; }
.eca-icon--lg { width: 1.5rem; height: 1.5rem; }

.eca-icon--edit { --glyph: var(--eca-icon-edit); }
.eca-icon--view { --glyph: var(--eca-icon-view); }
.eca-icon--search { --glyph: var(--eca-icon-search); }
.eca-icon--filter { --glyph: var(--eca-icon-filter); }
.eca-icon--sort { --glyph: var(--eca-icon-sort); }
.eca-icon--chevron { --glyph: var(--eca-icon-chevron); }
.eca-icon--check { --glyph: var(--eca-icon-check); }
.eca-icon--close { --glyph: var(--eca-icon-close); }
.eca-icon--plus { --glyph: var(--eca-icon-plus); }
.eca-icon--download { --glyph: var(--eca-icon-download); }
.eca-icon--attach { --glyph: var(--eca-icon-attach); }
.eca-icon--comment { --glyph: var(--eca-icon-comment); }
.eca-icon--clock { --glyph: var(--eca-icon-clock); }
.eca-icon--user { --glyph: var(--eca-icon-user); }
.eca-icon--users { --glyph: var(--eca-icon-users); }
.eca-icon--lock { --glyph: var(--eca-icon-lock); }
.eca-icon--alert { --glyph: var(--eca-icon-alert); }
.eca-icon--history { --glyph: var(--eca-icon-history); }
.eca-icon--external { --glyph: var(--eca-icon-external); }
.eca-icon--info { --glyph: var(--eca-icon-info); }
.eca-icon--tray { --glyph: var(--eca-icon-tray); }
.eca-icon--arrow-right { --glyph: var(--eca-icon-arrow-right); }


/* ═══ 8c. IDENTITY: the avatar chip, and the person in a row ══════════════════════════════════
 *
 * A ticket list with an ASSIGNEE is a list of work that belongs to people; a list without one is a
 * column of subject lines. The chip exists to make "whose is this" answerable at a glance, in the
 * list and on the ticket, with the SAME mark both times — the tint is a stable function of the
 * name, so the reader learns "the amber chip is Sam" without reading the label.
 *
 * It is initials + a 12 % tint, not a photo: most of this fleet's users have no photo, and an
 * avatar that is sometimes a photo and sometimes an empty circle is worse than one that is always
 * initials. The ink is measured against the tint (≥4.5:1 on the surface it sits on), and the chip
 * keeps its 1 px border so it survives `forced-colors`, where the tint is not painted.
 */
.eca-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--tint-ink, var(--color-muted));
  background: color-mix(in oklab, var(--tint, var(--color-muted)) 14%, var(--color-surface));
  border: var(--border) solid color-mix(in oklab, var(--tint, var(--color-muted)) 30%, var(--color-surface));
}
.eca-avatar--sm { width: 1.25rem; height: 1.25rem; font-size: 0.5625rem; }
.eca-avatar--md { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.eca-avatar--lg { width: 2rem; height: 2rem; font-size: 0.75rem; }
.eca-avatar--xl { width: 4rem; height: 4rem; font-size: 1.375rem; }
.eca-avatar__img { width: 100%; height: 100%; object-fit: cover; }

/* Eight tints from the semantic family — no fourth colour vocabulary. Each pairs a hue with the
 * ink that is measurable on its own 14 % ground. */
.eca-avatar--tint-1 { --tint: var(--tint-1); --tint-ink: var(--tint-ink-1); }
.eca-avatar--tint-2 { --tint: var(--tint-2); --tint-ink: var(--tint-ink-2); }
.eca-avatar--tint-3 { --tint: var(--tint-3); --tint-ink: var(--tint-ink-3); }
.eca-avatar--tint-4 { --tint: var(--tint-4); --tint-ink: var(--tint-ink-4); }
.eca-avatar--tint-5 { --tint: var(--tint-5); --tint-ink: var(--tint-ink-5); }
.eca-avatar--tint-6 { --tint: var(--tint-6); --tint-ink: var(--tint-ink-6); }
.eca-avatar--tint-7 { --tint: var(--tint-7); --tint-ink: var(--tint-ink-7); }
.eca-avatar--tint-8 { --tint: var(--tint-8); --tint-ink: var(--tint-ink-8); }

/* A person is an avatar and a name, in that order, on one line — the same pair in a table cell, on
 * a ticket's assignee field, and in the account menu. */
.eca-person {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
}
.eca-person__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  color: var(--color-ink);
}
.eca-person--muted .eca-person__name { color: var(--color-muted); }

/* ═══ 8d. THE EMPTY STATE'S DRAWING ═══════════════════════════════════════════════════════════
 *
 * An empty page that is one sentence in a dashed box reads as a render failure — which is exactly
 * what the user saw. The drawing says WHICH kind of empty it is, in the same glyph language as the
 * rest of the system: a tray for "nothing exists yet", a magnifier for "nothing matched". It is
 * `aria-hidden` (the title already says it), and it is `--color-muted` so it is a quiet mark, not a
 * second illustration style.
 */
.eca-empty__art {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: var(--space-1);
  background-color: color-mix(in oklab, var(--color-muted) 70%, var(--color-surface));
  -webkit-mask-image: var(--eca-icon-tray);
  mask-image: var(--eca-icon-tray);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.eca-empty--filtered .eca-empty__art {
  -webkit-mask-image: var(--eca-icon-search);
  mask-image: var(--eca-icon-search);
}

/* ═══ 8e. UPLOAD: a file control, the chosen files, and their removal ═════════════════════════
 *
 * The gap this fills (ark's inventory, four page families): the legacy upload surfaces each
 * carried their own markup — `forms-web-module`'s Dropzone, `notification-web-module`'s bare
 * `<input type="file" multiple>` and `rbac-user-anonymizer-web-module`'s attachment row — and three
 * ports had already shipped a file field whose posted parameter name was not the one the controller
 * bound (`attachments` vs `attachments[]` vs a generated name).
 *
 * So the contract is one line, and `EcaUploadSuite` renders it: **the control posts exactly the
 * field name the page configured**, verbatim. Never `name[]`, never a derived name.
 *
 * PROGRESSIVE: the base is a real `<input type="file">` — the browser's own control, which opens a
 * picker, accepts a drop and posts the files with JavaScript off. The island
 * (`javascripts/upload/eca-upload.js`) adds the chosen-file list, the per-file remove, the drop
 * target and (only when the page opts in) the progress bar. The row markup lives in a `<template>`
 * this sheet also styles, so the island clones a shape the design system owns and carries no markup
 * of its own (X107: a class emitted by a script and styled nowhere is a component that does not
 * exist).
 */
.eca-upload { display: block; min-width: 0; }
.eca-upload__hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--color-muted);
  max-width: var(--measure-narrow);
}
/* The well is a WELL, not a lie: it only advertises a drop target once the island is behind it
 * (`data-eca-upload-ready`), because a dashed box that ignores a dropped file is worse than no box. */
.eca-upload__drop {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding: var(--space-3);
  background: var(--color-surface-inset);
  border: var(--border) dashed var(--color-border);
  border-radius: var(--radius-box);
}
.eca-upload[data-eca-upload-ready] .eca-upload__drop { border-color: var(--color-border-strong); }
.eca-upload[data-eca-upload-over] .eca-upload__drop {
  border-color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 8%, var(--color-base-100));
}
/* The control keeps the element rule's box (`input[type="file"]` above) and only states that it
 * fills the well: a file input is not a text box and must not be clipped into one. */
.eca-upload__input { width: 100%; min-width: 0; }
.eca-upload__prompt { margin: 0; font-size: var(--text-sm); color: var(--color-muted); }
.eca-upload__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}
.eca-upload__file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  font-size: var(--text-sm);
  border-bottom: var(--border) solid var(--color-border);
}
.eca-upload__file:last-child { border-bottom: 0; }
.eca-upload__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--color-ink);
}
.eca-upload__size {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}
.eca-upload__remove { flex: 0 0 auto; }
.eca-upload__progress {
  display: block;
  width: 100%;
  height: var(--space-2);
  margin-top: var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface-inset);
  accent-color: var(--color-primary);
}
.eca-upload__status {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--color-muted);
}
/* `display: block` on a component beats the UA's `[hidden]` rule, so every element this section
 * shows and hides has to say so. A hidden state that still paints is a control the reader was told
 * was gone. */
.eca-upload__progress[hidden] { display: none; }

/* ═══ 8f. STEPS: where the reader is in a multi-step task ═══════════════════════════════════════
 *
 * The indicator is an `<ol>`, because the order IS the information, and the state is announced:
 * the current step carries `aria-current="step"`, and every step carries its state as TEXT (a
 * visually-hidden word) so "completed" is never colour alone. Sighted readers get the second
 * signal too — a tick for a completed step, a ring and a heavier label for the current one, a
 * quiet marker for the ones ahead. Base is a vertical run (a phone, or a wizard in a narrow
 * column); ≥640 lays the same markup out as a row.
 */
.eca-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.eca-steps__step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
  min-height: var(--control-h-touch);
  padding-block: var(--space-1);
}
/* The connector is drawn from the marker's centre down to the next step, in the marker's column —
 * one rule for the base (vertical) layout, replaced by one horizontal rule at ≥640. The 12px
 * reach is the inter-step gap (8) plus the next step's own top padding (4): a shorter reach leaves
 * a stub that reads as a broken rail rather than a path. */
.eca-steps__step:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--space-6) / 2);
  top: calc(var(--space-6) + var(--space-1));
  bottom: calc(-1 * var(--space-3));
  width: 2px;
  background: var(--color-border);
}
.eca-steps__step.is-complete:not(:last-child)::before { background: var(--color-primary); }
.eca-steps__marker {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: var(--space-6);
  height: var(--space-6);
  font-size: var(--text-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
  border: var(--border) solid var(--color-border-strong);
  border-radius: var(--radius-pill);
}
.eca-steps__step.is-complete .eca-steps__marker {
  color: var(--color-primary-content);
  background: var(--color-primary);
  border-color: var(--color-primary);
}
/* `content` on the marker is a SHAPE, not a colour: a completed step reads as done in forced
 * colours and to a reader who cannot separate the tint from the ground. */
.eca-steps__step.is-complete .eca-steps__marker::after { content: "\2713"; }
.eca-steps__step.is-current .eca-steps__marker {
  color: var(--color-primary);
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.eca-steps__step.is-upcoming .eca-steps__marker {
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  border-color: var(--color-border);
}
.eca-steps__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-ink);
}
.eca-steps__step.is-current .eca-steps__label { font-weight: 650; color: var(--color-primary); }
.eca-steps__step.is-upcoming .eca-steps__label { font-weight: 500; color: var(--color-muted); }
.eca-steps__hint {
  display: block;
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--color-muted);
}
/* A step that is a link keeps the label's own appearance: the row is the target, and a second
 * colour system for "this step is clickable" would compete with the state colours above. */
.eca-steps__step a {
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-field);
}
.eca-steps__step a:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 640px) {
  .eca-steps { flex-direction: row; gap: var(--space-4); }
  .eca-steps__step { flex: 1 1 0; flex-direction: column; gap: var(--space-2); }
  .eca-steps__step:not(:last-child)::before {
    inset-inline-start: calc(var(--space-6) + var(--space-2));
    inset-inline-end: calc(-1 * var(--space-4));
    top: calc(var(--space-6) / 2);
    bottom: auto;
    width: auto;
    height: 2px;
  }
}

/* ═══ 8g. PRINT DOCUMENT: a sheet on screen, a page on paper ═══════════════════════════════════
 *
 * Two page families print a document that is NOT the page: a baptism certificate, a report. The
 * shell they need is the same — issuer, title, reference line, body sections, a signature block —
 * and the two legacy implementations were page-local sheets with their own `@media print`.
 *
 * **This section has a real screen rule, and it is the on-screen PREVIEW.** A component whose only
 * rule lives inside `@media print` is a half-finished component: on screen it renders as unformatted
 * text and nobody notices until paper comes out (`check-ecaw-components.py` fails a class styled only
 * in print, for exactly this reason). So the sheet is a card here, and print only removes the
 * screen's furniture.
 */
.eca-print-document {
  display: block;
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--space-5);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
  box-shadow: var(--shadow-lift);
}
.eca-print-document__toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--gap-actions);
  margin-block-end: var(--gap-block);
}
.eca-print-document__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-block-end: var(--space-3);
  border-bottom: var(--border) solid var(--color-border-strong);
}
.eca-print-document__issuer {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}
.eca-print-document__title { margin: 0; font-size: var(--text-lg); color: var(--color-ink); }
.eca-print-document__meta {
  margin: 0;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}
.eca-print-document__body {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
  padding-block: var(--gap-block);
}
.eca-print-document__section { display: block; min-width: 0; }
.eca-print-document__section-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}
/* The field pairs are a `<dl>`: a certificate states labelled facts, and a reader (or a screen
 * reader) must be able to move from the label to the value. Two bare `<div>`s are a paragraph that
 * looks like a form. */
.eca-print-document__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 var(--space-4);
  margin: 0;
}
.eca-print-document__field {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  padding-block: var(--space-1);
  border-bottom: var(--border) dotted var(--color-border);
}
.eca-print-document__field-label {
  flex: 0 0 auto;
  min-width: 9rem;
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.eca-print-document__field-value {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink);
}
.eca-print-document__signature {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding-block-start: var(--gap-block);
  border-top: var(--border) solid var(--color-border-strong);
}
.eca-print-document__sign { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.eca-print-document__sign-rule {
  display: block;
  height: var(--border);
  background: var(--color-border-strong);
}
.eca-print-document__sign-name { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.eca-print-document__sign-label { font-size: var(--text-xs); color: var(--color-muted); }
.eca-print-document__footer {
  margin-block-start: var(--gap-block);
  font-size: var(--text-xs);
  color: var(--color-muted);
}
@media (min-width: 640px) {
  .eca-print-document { padding: var(--space-6); }
  .eca-print-document__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eca-print-document__signature { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ═══ 8h. REPEAT: a row group the reader can add to and remove from ════════════════════════════
 *
 * This one is not cosmetic. `claim-system`'s `/newClaim` hand-wrote a `reindexRows` function in
 * `claim.js` because cloning a row duplicated its `id` and its `aria-label`: a copied row announced
 * "Item 1 amount" for item 2, and its `<label for>` pointed at the FIRST row's input. The rule that
 * fixes it belongs here, once:
 *
 *   1. a row's control `id` is derived from its binding NAME (`FormSupport.domIdFor`), so the id
 *      carries the row index and two rows can never collide;
 *   2. the island re-derives `name`, `id` and `for` from the row's POSITION after an add or a
 *      remove — one pass, from the position, which is the only source of truth;
 *   3. the per-row accessible name ("Item 2 amount") is re-derived from the same position, using the
 *      ordinal prefix the group declares once (`data-eca-repeat-prefix`).
 *
 * The remove control is rendered by the server **only when removal is legal** (more rows than the
 * group's minimum), so with JavaScript off there is no button that does nothing.
 */
.eca-repeat { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
.eca-repeat__legend { padding: 0; font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.eca-repeat__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}
.eca-repeat__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3);
  background: var(--color-surface);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
}
.eca-repeat__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  min-width: 0;
}
.eca-repeat__remove { align-self: flex-start; flex: 0 0 auto; }
.eca-repeat__add { flex: 0 0 auto; }
/* `.eca-btn` is `inline-flex`, which beats the UA's `[hidden]` rule — so a remove control the
 * island switched off still painted (the same trap `--control-h` had). One rule, where the state
 * is set. */
.eca-repeat__remove[hidden] { display: none; }
.eca-repeat__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-actions);
  margin-block-start: var(--space-3);
}
.eca-repeat__status { margin: 0; font-size: var(--text-xs); color: var(--color-muted); }
@media (min-width: 640px) {
  .eca-repeat__row { flex-direction: row; align-items: flex-start; }
  .eca-repeat__fields { flex: 1 1 auto; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
}

/* ═══ 9. PRINT, REDUCED MOTION, FORCED COLOURS ═══════════════════════════════════════════════ */

@media print {
  /* The chrome block lives in ui-alias.css (PrintMediaSuite pins it there); this adds the header
   * that file never knew, and unboxes the cards. */
  .eca-header, .eca-menu-toggle, .eca-skip-link { display: none !important; }
  .eca-section { border: 0; box-shadow: none; padding: 0 0 var(--space-3); }
  .eca-section + .eca-section { margin-top: var(--space-4); break-inside: avoid; }
  .eca-page-footer { border-top: var(--border) solid var(--color-border); }
  a[href]::after { content: ""; }      /* the suffix rule is in ui-alias; never double it */
  /* A print sheet prints as itself: the screen preview's card furniture (a border, a shadow, a
   * centred measure, a toolbar) is the PREVIEW, not the document. The toolbar is the one element
   * that must disappear even though the page is a print sheet — a "Print" button printed onto paper
   * is the classic artifact. */
  .eca-print-document { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .eca-print-document__toolbar { display: none !important; }
  .eca-print-document__section, .eca-print-document__signature, .eca-print-document__field { break-inside: avoid; }
  .eca-print-document__field-value { color: CanvasText; }
  /* The upload control and its island furniture are not part of a printed form. */
  .eca-upload__remove, .eca-upload__prompt, .eca-upload__status, .eca-upload__progress { display: none !important; }
  .eca-repeat__remove, .eca-repeat__actions, .eca-repeat__status { display: none !important; }
  .eca-repeat__row { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .eca-btn, .eca-section, .eca-page-header, .eca-badge, .eca-empty,
  .eca-menu__group > summary, .eca-input, .eca-avatar, .eca-empty__art { border: 1px solid CanvasText; }
  /* An icon mask is not painted here; the glyph stays a box so the control's size does not move. */
  .eca-icon { background-color: CanvasText; }
  /* The rail and the selected row are tints: restate them as a border/outline, never colour alone. */
  .eca-page-breadcrumb, .eca-page-eyebrow { border-inline-start: 2px solid Highlight; }
  /* The current-page marker is an UNDERLINE drawn as a background box, and a background is dropped
   * here — so it is restated as a border, which is the one form forced colours guarantees. The
   * pseudo-element is switched off in the same breath, or the row would carry a line and a border. */
  .eca-menu > .item.active::after,
  .eca-menu > .item[aria-current]::after,
  .eca-menu__panel > .item.active::after,
  .eca-menu__panel > .item[aria-current]::after,
  .eca-menu__group.active > summary::before,
  .eca-menu__group--current > summary::before { content: none; }
  .eca-menu > .item.active,
  .eca-menu > .item[aria-current],
  .eca-menu__panel > .item.active,
  .eca-menu__panel > .item[aria-current],
  .eca-menu__group.active > summary,
  .eca-menu__group--current > summary { border-bottom: 2px solid Highlight; }
  .eca-table tbody tr.is-selected td:first-child,
  .eca-table tbody tr[aria-selected="true"] td:first-child { box-shadow: none; border-inline-start: 3px solid Highlight; }
  .eca-btn { forced-color-adjust: none; color: ButtonText; background: ButtonFace; }
}

/* ── The bar's own width, not the viewport's ─────────────────────────────────────────────────────
   A `min-width: 1440` media query would be a fifth layout the system does not publish, and the
   viewport is the wrong measurement anyway: what matters is the bar. When the BAR has room (≥1400),
   the groups get the spacing the user asked for; at 1200 they keep the 8 px that still fits one row. */
.eca-header__bar { container-type: inline-size; container-name: appbar; }
@container appbar (min-width: 1360px) {
  .eca-menu { gap: var(--space-3); }
  .eca-menu__group > summary { padding-inline: var(--space-3); }
}
