/* ============================================================================
   ts-display.css — display components
   TOM SHAW Portal Design System · v1.2 · workstream A

   Card, content list, card row, avatar sizes and variants, badge tones,
   skeleton, progress, meter, spinner, icon sizing.

   Import at position 5: AFTER ts-components.css, BEFORE ts-forms.css.
   See docs/00-build-contract.md §1.1.

   Tooltips and popovers are NOT in this file. They float, so they load after
   ts-overlays.css — see ts-tips.css at position 15.

   Depends on: ts-tokens.css (all values), ts-portal.css (@keyframes ts-spin,
   .ts-visually-hidden), ts-app-shell.css (.ts-avatar, .ts-badge base).

   What this file is built to (contract §8):
     · Tokens, never hex — rgba() included.
     · Single-class specificity. Extensions to frozen blocks carry a comment
       naming the block's home and win on import order, never !important.
     · Both surfaces. Dark treatments use --ts-violet-300, never --ts-violet
       (violet-500 is 4.2:1 on black and fails).
     · Nothing loops except a spinner the user asked for (§7.9).
   ============================================================================ */


/* ============================================================================
   1. ICON
   One block replacing the width/height/fill/stroke quartet restated in eight
   components. Sizes are 14 / 16 / 20 per docs/01-foundations.md §5.

   Existing components in the frozen stylesheets size their own SVGs with
   descendant selectors (.ts-control svg, .ts-menu__item > svg, .ts-nav__item
   svg). Those are more specific than .ts-icon and keep their 15 / 17 / 18px.
   That is intentional: .ts-icon governs everywhere a component rule does not,
   and new components size icons with it rather than restating the block.
   ========================================================================= */
.ts-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7; vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ts-icon--sm { width: 14px; height: 14px; }   /* inside a chip, badge or dense cell */
.ts-icon--lg { width: 20px; height: 20px; }   /* topbar, rail, card header */

/* Chevrons, plus marks and ticks read thin at 1.7 — 01 §5 allows 2.0–2.2 */
.ts-icon--bold  { stroke-width: 2.2; vector-effect: non-scaling-stroke; }
/* Dot glyphs (overflow "more", presence marks) are filled, not stroked */
.ts-icon--solid { fill: currentColor; stroke: none; }

/* An icon that is the only thing in a control is decorative to AT; the
   control's aria-label carries the meaning. This is a reminder, not a rule
   the CSS can enforce — see docs/06-accessibility.md §3. */


/* ============================================================================
   2. CARD — the one surface container
   Border, radius and background are copied from .ts-tablewrap (home:
   ts-app-shell.css) so a card and a table sit side by side without a seam.
   If .ts-tablewrap ever changes, this changes with it.
   ========================================================================= */
.ts-card {
  border: 1px solid var(--ts-grey-light);
  border-radius: var(--ts-radius-card);
  background: var(--ts-white);
  color: var(--ts-ink);
  font-size: var(--ts-fs-ui);
  line-height: var(--ts-lh-ui);
}

.ts-card__head {
  display: flex;
  align-items: center;
  gap: calc(var(--ts-space) * 1.5);
  padding: calc(var(--ts-space) * 2);
  border-bottom: 1px solid var(--ts-grey-light);
}
.ts-card__icon { color: var(--ts-purple); }
.ts-card__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--ts-fs-section);
  font-weight: var(--ts-fw-bold);
  line-height: 1.3;
}
/* A card title is frequently the link to the thing the card is about. Without
   this it renders browser-default blue and underlined, which is off-theme on
   every card that links anywhere. Matches .ts-list__title a exactly. */
.ts-card__title a { color: inherit; text-decoration: none; }
.ts-card__title a:hover {
  color: var(--ts-purple);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ts-card--dark .ts-card__title a:hover { color: var(--ts-violet-300); }
/* Shrinkable, not fixed: a long "Updated 14 Aug 2026, 06:12 AEST" must wrap
   rather than push the card sideways (rule 11). */
.ts-card__meta {
  flex: 0 1 auto;
  min-width: 0;
  font-size: var(--ts-fs-ui-sm);
  color: var(--ts-grey-text);
}
.ts-card__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }

.ts-card__body { padding: calc(var(--ts-space) * 2); }
.ts-card__body > :last-child { margin-bottom: 0; }
.ts-card__body p { margin: 0 0 calc(var(--ts-space) * 1.5); max-width: 72ch; color: var(--ts-grey-text); }

.ts-card__foot {
  display: flex;
  align-items: center;
  gap: var(--ts-space);
  flex-wrap: wrap;
  padding: calc(var(--ts-space) * 1.5) calc(var(--ts-space) * 2);
  border-top: 1px solid var(--ts-grey-light);
  font-size: var(--ts-fs-ui-sm);
  color: var(--ts-grey-text);
}
.ts-card__foot-end { margin-left: auto; display: flex; align-items: center; gap: var(--ts-space); }

/* Flush: the body is a list or a table and provides its own row padding.
   Clips its children to the radius, so nothing that floats (a popover, a
   menu) may live inside a flush card. */
.ts-card--flush { overflow: hidden; }
.ts-card--flush .ts-card__body { padding: 0; }

/* Band — a full-width card acting as a page-level surface rather than a tile
   in a grid. It carries the bottom margin a gridded card must not have. */
.ts-card--band { display: block; margin-bottom: calc(var(--ts-space) * 3); }

/* Flagged — the replacement for the corner ribbon the inventory uses (§7.2).
   A 3px left rule plus a .ts-tag in the header. Never rotated text. */
.ts-card--flagged { border-left: 3px solid var(--ts-violet); }
.ts-card--flagged-critical { border-left: 3px solid var(--ts-error); }

/* Interactive — the whole card is one link or button. Matches
   .ts-catalog__item (home: ts-stepper.css) so a selectable card looks the
   same wherever it appears. */
.ts-card--interactive {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--ts-dur-fast) var(--ts-ease),
              box-shadow var(--ts-dur-fast) var(--ts-ease);
}
.ts-card--interactive:hover { border-color: var(--ts-violet-300); box-shadow: var(--ts-shadow-1); }
.ts-card--interactive[aria-pressed="true"],
.ts-card--interactive[aria-current="true"] {
  border-color: var(--ts-violet);
  box-shadow: inset 0 0 0 1px var(--ts-violet);
}

/* ── Card on black ─────────────────────────────────────────────────────────
   No glow. One glow surface per screen and it belongs to .ts-hero or
   .ts-promo (contract §7.5 rule 4); a glowing card would spend the 12%
   allocation twelve times over. */
.ts-card--dark {
  background: var(--ts-black);
  border-color: var(--ts-hairline-dark);
  color: var(--ts-on-dark-1);
}
.ts-card--dark .ts-card__head,
.ts-card--dark .ts-card__foot { border-color: var(--ts-hairline-dark); }
.ts-card--dark .ts-card__icon { color: var(--ts-violet-300); }
.ts-card--dark .ts-card__meta,
.ts-card--dark .ts-card__foot { color: var(--ts-on-dark-3); }
.ts-card--dark .ts-card__body p { color: var(--ts-on-dark-2); }
.ts-card--dark a { color: var(--ts-violet-300); }          /* 8.0:1 on black */
.ts-card--dark :focus-visible { outline-color: var(--ts-focus-dark); }
.ts-card--dark.ts-card--interactive:hover { border-color: var(--ts-violet-300); box-shadow: none; }


/* ============================================================================
   3. CARD ROW — the carousel replacement (contract §7.1)
   Real scroll, real focus, real keyboard. Nothing advances on a timer: an
   operator triaging an incident must never lose a panel because a timer fired.
   ========================================================================= */
.ts-cardrow { margin-bottom: calc(var(--ts-space) * 3); }

.ts-cardrow__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ts-space);
  margin-bottom: calc(var(--ts-space) * 1.5);
}
.ts-cardrow__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--ts-fs-section);
  font-weight: var(--ts-fw-bold);
}
.ts-cardrow__nav { flex: 0 0 auto; display: flex; gap: 4px; }
/* display:flex from an author sheet beats [hidden]'s UA display:none, so the
   hidden state has to be restated. ts-display.js hides the nav when the row
   does not overflow. */
.ts-cardrow__nav[hidden] { display: none; }
.ts-cardrow__nav [aria-disabled="true"] { opacity: .35; cursor: not-allowed; }

.ts-cardrow__track {
  display: flex;
  gap: calc(var(--ts-space) * 2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  /* Room for the focus ring and the interactive card's shadow */
  padding: 4px 4px calc(var(--ts-space) * 1.5);
  margin: -4px -4px 0;
}
.ts-cardrow__item {
  flex: 0 0 clamp(240px, 72vw, 304px);
  scroll-snap-align: start;
}

/* Wrapped: same block, no scroll. Use when the set is small and complete. */
.ts-cardrow--wrap .ts-cardrow__track {
  flex-wrap: wrap;
  overflow: visible;
  scroll-snap-type: none;
}
/* min-width: 0, or the item cannot shrink below the min-content width of the
   card inside it — a 236px card in a 217px column pushed the page 3px sideways
   at 320px on gallery-display.html. A wrapped row shrinks; it does not scroll. */
.ts-cardrow--wrap .ts-cardrow__item { flex: 1 1 260px; min-width: 0; }
.ts-cardrow--wrap .ts-cardrow__nav { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ts-cardrow__track { scroll-behavior: auto; }
}


/* ============================================================================
   4. LIST — content lists only
   Activity, notifications, files, results. Settings rows stay .ts-stack.
   Menu rows stay .ts-menu. There are three list-shaped things already
   (contract §2.3); this is not a fourth pattern, it is the content one.
   ========================================================================= */
.ts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--ts-fs-ui);
}
.ts-list__item {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--ts-space) * 1.5);
  padding: calc(var(--ts-space) * 1.5) calc(var(--ts-space) * 2);
  position: relative;
}
/* Adjacent-sibling rule, so a list inside a .ts-card--flush never doubles the
   card's own border at the top or bottom. Same approach as .ts-stack__item. */
.ts-list__item + .ts-list__item { border-top: 1px solid var(--ts-grey-light); }

.ts-list__lead { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.ts-list__lead .ts-icon { color: var(--ts-grey-text); margin-top: 2px; }

.ts-list__body { flex: 1 1 auto; min-width: 0; }
.ts-list__title {
  margin: 0;
  font-size: var(--ts-fs-ui);
  font-weight: var(--ts-fw-bold);
  line-height: 1.4;
  color: var(--ts-ink);
}
.ts-list__title a { color: inherit; text-decoration: none; }
.ts-list__title a:hover { color: var(--ts-purple); text-decoration: underline; text-underline-offset: 3px; }
.ts-list__text {
  margin: 2px 0 0;
  font-size: var(--ts-fs-ui);
  color: var(--ts-grey-text);
  max-width: 72ch;
}
.ts-list__meta {
  display: flex;
  align-items: center;
  gap: var(--ts-space);
  flex-wrap: wrap;
  margin: 4px 0 0;                       /* the global p rule would add 16px below */
  font-family: var(--ts-mono);
  font-size: var(--ts-fs-ui-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ts-grey-text);
}
.ts-list__end {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--ts-space);
  margin-left: auto;
}

/* A row whose whole surface responds. The row still contains one real link or
   button — the hover wash is feedback, never the affordance. */
.ts-list__item--action { transition: background var(--ts-dur-fast) var(--ts-ease); }
.ts-list__item--action:hover { background: var(--ts-violet-50); }
.ts-list__item--action:focus-within { background: var(--ts-violet-50); }

/* Unread: a left rule and a bold title, not a coloured dot. Pair it with
   .ts-visually-hidden "Unread" so the state is spoken, not only seen
   (docs/06-accessibility.md §4). */
.ts-list__item.is-unread { box-shadow: inset 3px 0 0 var(--ts-violet); background: var(--ts-violet-50); }

/* Row actions appear on hover and focus. focus-within is what keeps them
   reachable by keyboard — opacity alone would hide a live tab stop. */
.ts-list__rowactions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--ts-dur-fast) var(--ts-ease); }
.ts-list__item:hover .ts-list__rowactions,
.ts-list__item:focus-within .ts-list__rowactions { opacity: 1; }

/* Density: a results list scanned by the hundred */
.ts-list--compact .ts-list__item { padding: var(--ts-space) calc(var(--ts-space) * 2); min-height: var(--ts-row-h-compact); }
/* Standing alone rather than inside a card — no side padding to fight */
.ts-list--plain .ts-list__item { padding-left: 0; padding-right: 0; }

/* ── List on black ──────────────────────────────────────────────────────── */
.ts-list--dark .ts-list__item + .ts-list__item { border-color: var(--ts-hairline-dark); }
.ts-list--dark .ts-list__title { color: var(--ts-on-dark-1); }
.ts-list--dark .ts-list__title a:hover { color: var(--ts-violet-300); }
.ts-list--dark .ts-list__text { color: var(--ts-on-dark-2); }
.ts-list--dark .ts-list__meta { color: var(--ts-on-dark-3); }
.ts-list--dark .ts-list__lead .ts-icon { color: var(--ts-on-dark-2); }
.ts-list--dark .ts-list__item--action:hover,
.ts-list--dark .ts-list__item--action:focus-within { background: var(--ts-wash-dark); }
.ts-list--dark .ts-list__item.is-unread { box-shadow: inset 3px 0 0 var(--ts-violet-300); background: var(--ts-wash-dark); }
.ts-list--dark :focus-visible { outline-color: var(--ts-focus-dark); }


/* ============================================================================
   5. AVATAR — extensions to .ts-avatar (home: ts-app-shell.css)
   The base is 32px, deep purple, white initials, and assumes a <button>.
   Sizes come from the tokens; 32px stays the default so the topbar is
   unchanged by this file.
   ========================================================================= */

/* The base sets cursor:pointer for the topbar button. Most avatars are not
   controls, so the default flips and the interactive elements take it back. */
.ts-avatar { cursor: default; }
a.ts-avatar, button.ts-avatar { cursor: pointer; }

.ts-avatar--xs { width: var(--ts-avatar-xs); height: var(--ts-avatar-xs); font-size: 10px; }
.ts-avatar--sm { width: var(--ts-avatar-sm); height: var(--ts-avatar-sm); font-size: var(--ts-fs-ui-sm); }
.ts-avatar--md { width: var(--ts-avatar-md); height: var(--ts-avatar-md); font-size: var(--ts-fs-ui); }
.ts-avatar--lg { width: var(--ts-avatar-lg); height: var(--ts-avatar-lg); font-size: var(--ts-fs-section); }
/* --ts-fs-page, not --ts-fs-h3: both are 20px, but h3 is a document-scale
   token and these components live inside .ts-shell (rule 2). */
.ts-avatar--xl { width: var(--ts-avatar-xl); height: var(--ts-avatar-xl); font-size: var(--ts-fs-page); }

/* Photo. object-fit stops a non-square upload from stretching a face. */
.ts-avatar__img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Quiet — a system actor, an unassigned slot, a de-emphasised row.
   Ink on grey-card is 16.4:1. */
.ts-avatar--quiet { background: var(--ts-grey-card); color: var(--ts-ink); }

/* On black the deep-purple disc is 1.9:1 against the ground — foundations §1
   says never pair those. The disc becomes a neutral wash with a hairline ring;
   the initials do the identifying at 15.7:1, which is what 1.4.11 actually
   asks of this component. */
.ts-avatar--dark {
  background: var(--ts-wash-dark);
  color: var(--ts-on-dark-1);
  box-shadow: inset 0 0 0 1px var(--ts-hairline-dark);
}

/* ── Presence ──────────────────────────────────────────────────────────────
   Session state on a person, and never colour alone: solid = signed in,
   ring = idle, hollow = signed out. The row must also carry the word, in
   .ts-visually-hidden at minimum. */
.ts-avatar--presence { position: relative; overflow: visible; }
.ts-avatar__presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ts-white);
  background: var(--ts-grey-mid);
}
.ts-avatar__presence--active { background: var(--ts-success); }
.ts-avatar__presence--idle   { background: var(--ts-white); box-shadow: inset 0 0 0 2px var(--ts-warning-ink); }
.ts-avatar__presence--out    { background: var(--ts-white); box-shadow: inset 0 0 0 1px var(--ts-grey-mid); }
.ts-avatar--dark .ts-avatar__presence { border-color: var(--ts-black); }
.ts-avatar--dark .ts-avatar__presence--idle,
.ts-avatar--dark .ts-avatar__presence--out { background: var(--ts-black); }
.ts-avatar--dark .ts-avatar__presence--out { box-shadow: inset 0 0 0 1px var(--ts-on-dark-3); }

/* ── Stack — several people on one row ─────────────────────────────────────
   The ring is the surface colour, so the discs read as separate. The stack
   carries one aria-label naming everybody; the individual avatars are
   aria-hidden, because eight "PR" announcements are noise. */
.ts-avatar-stack { display: inline-flex; align-items: center; }
.ts-avatar-stack > * { box-shadow: 0 0 0 2px var(--ts-white); }
.ts-avatar-stack > * + * { margin-left: -8px; }
.ts-avatar-stack__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ts-avatar-sm);
  height: var(--ts-avatar-sm);
  border-radius: 50%;
  background: var(--ts-grey-card);
  color: var(--ts-grey-text);
  font-family: var(--ts-mono);
  font-size: var(--ts-fs-ui-sm);
  font-variant-numeric: tabular-nums;
}
/* Both shadows in one declaration: the outer ring separates the discs, the
   inset hairline is .ts-avatar--dark's own edge and would otherwise be
   overwritten by this rule. */
.ts-avatar-stack--dark > * { box-shadow: 0 0 0 2px var(--ts-black), inset 0 0 0 1px var(--ts-hairline-dark); }
.ts-avatar-stack--dark .ts-avatar-stack__more { background: var(--ts-wash-dark); color: var(--ts-on-dark-2); }


/* ============================================================================
   6. BADGE TONES — extensions to .ts-badge (home: ts-app-shell.css)
   .ts-badge is a COUNT attached to a nav row or control. It is not a status
   label — that is .ts-pill — and not a product label, which is .ts-tag.
   See docs/00-build-contract.md §2.2 before adding anything here.

   Every tone below is a solid fill whose ground clears 3:1 on white AND on
   black, so one badge works on both surfaces:
     violet #9137FF   5.0:1 white text · ground 4.2:1 on black
     error-ink        6.4:1 white text · ground 3.3:1 on black
     warning-ink      5.9:1 white text · ground 3.6:1 on black
     success-ink      5.3:1 white text · ground 4.2:1 on black
   ========================================================================= */
.ts-badge--neutral  { background: var(--ts-grey-card);   color: var(--ts-grey-text); }  /* 6.1:1 */
.ts-badge--critical { background: var(--ts-error-ink);   color: var(--ts-white); }
.ts-badge--warning  { background: var(--ts-warning-ink); color: var(--ts-white); }
.ts-badge--success  { background: var(--ts-success-ink); color: var(--ts-white); }
/* .ts-badge--count already exists in ts-app-shell.css: the neutral tone for a
   dark ground. Do not add a second dark neutral. */
.ts-badge--quiet    { background: var(--ts-wash-dark);   color: var(--ts-on-dark-1); }

/* A badge glued to the control it counts. The control needs position:relative
   and the count needs a text equivalent in the control's aria-label — a
   floating "3" is not a label. */
.ts-badge--pinned {
  position: absolute;
  top: -4px;
  right: -4px;
  box-shadow: 0 0 0 2px var(--ts-white);
}
.ts-badge--pinned-dark { box-shadow: 0 0 0 2px var(--ts-black); }


/* ============================================================================
   7. SKELETON — first paint only, and it does not shimmer (contract §7.9)
   A looping shimmer breaks "nothing loops" (01 §4) and, unlike a submit
   spinner, nothing the user did caused it. Static --ts-grey-card blocks at
   the real row height, so the layout does not jump when the data lands.

   .ts-skel is the group standing in for one row or card. The grey shapes are
   its elements, and they are aria-hidden — the announcement comes from one
   role="status" on the region, not from thirty boxes.
   ========================================================================= */
.ts-skel {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--ts-space) * 1.5);
  padding: calc(var(--ts-space) * 1.5) calc(var(--ts-space) * 2);
}
.ts-skel + .ts-skel { border-top: 1px solid var(--ts-grey-light); }
.ts-skel__col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--ts-space); }

.ts-skel__line,
.ts-skel__title,
.ts-skel__block,
.ts-skel__avatar {
  display: block;
  background: var(--ts-grey-card);
  border-radius: var(--ts-radius-chip);
}
.ts-skel__line   { height: 12px; width: 100%; }
.ts-skel__title  { height: 16px; width: 40%; }
.ts-skel__block  { height: 64px; width: 100%; border-radius: var(--ts-radius-ui); }
.ts-skel__avatar { width: var(--ts-avatar-md); height: var(--ts-avatar-md); border-radius: 50%; flex: 0 0 auto; }
.ts-skel__avatar--sm { width: var(--ts-avatar-sm); height: var(--ts-avatar-sm); }

/* Widths, because an inline style attribute cannot ship under our CSP. */
.ts-skel__line--short { width: 30%; }
.ts-skel__line--half  { width: 50%; }
.ts-skel__line--long  { width: 80%; }

/* One skeleton row at the real table row height, so nothing reflows */
.ts-skel--row { align-items: center; min-height: var(--ts-row-h); }

.ts-skel--dark .ts-skel__line,
.ts-skel--dark .ts-skel__title,
.ts-skel--dark .ts-skel__block,
.ts-skel--dark .ts-skel__avatar { background: var(--ts-wash-dark); }
.ts-skel--dark + .ts-skel--dark { border-color: var(--ts-hairline-dark); }


/* ============================================================================
   8. PROGRESS — a task advancing toward completion
   Contract §7.11: track, fill, role="progressbar" with aria-valuenow/min/max,
   AND a visible number. A bar alone is unreadable in greyscale and silent to
   a screen reader. No stripes, no animated fill, no width transition — the
   number is the payload and it should not have to be chased.

   The fill's width is set by ts-display.js FROM the aria values on the track,
   so the drawn bar and the spoken value cannot disagree. It is never authored
   in markup: a style attribute would need CSP unsafe-inline (07 §3). With
   JavaScript off the bar sits at zero and the number is still on screen.
   ========================================================================= */
.ts-progress { margin-bottom: calc(var(--ts-space) * 2); }

.ts-progress__head {
  display: flex;
  align-items: baseline;
  gap: var(--ts-space);
  margin-bottom: var(--ts-space);
}
.ts-progress__label { flex: 1 1 auto; min-width: 0; font-size: var(--ts-fs-ui); color: var(--ts-ink); }
.ts-progress__value {
  flex: 0 0 auto;
  font-family: var(--ts-mono);
  font-size: var(--ts-fs-ui);
  font-variant-numeric: tabular-nums;
  font-weight: var(--ts-fw-bold);
  color: var(--ts-ink);
}

.ts-progress__track {
  display: flex;
  width: 100%;
  height: 8px;
  background: var(--ts-track);
  border-radius: var(--ts-radius-pill);
  overflow: hidden;
}
.ts-progress__fill {
  width: 0;                              /* ts-display.js writes the real width */
  height: 100%;
  background: var(--ts-purple);          /* 9.7:1 against the track */
  border-radius: inherit;
}

.ts-progress__note {
  margin: var(--ts-space) 0 0;
  font-size: var(--ts-fs-ui-sm);
  color: var(--ts-grey-text);
}

.ts-progress--sm .ts-progress__track { height: 4px; }
.ts-progress--lg .ts-progress__track { height: 12px; }

/* Tones. Inks, not the raw status colours — #E0443C is 1.9:1 against the
   track and would read as a smudge. */
.ts-progress--warning  .ts-progress__fill { background: var(--ts-warning-ink); }  /* 5.1:1 on track */
.ts-progress--critical .ts-progress__fill { background: var(--ts-error-ink); }    /* 5.5:1 on track */
.ts-progress--success  .ts-progress__fill { background: var(--ts-success-ink); }  /* 4.3:1 on track */

/* Split: several segments in one track. Colour cannot be the only signal, so
   a split bar MUST carry the breakdown as text in .ts-progress__note, and the
   last segment before the empty remainder gets a hatch. */
.ts-progress--split .ts-progress__fill { border-radius: 0; }
.ts-progress--split .ts-progress__fill:first-child { border-radius: var(--ts-radius-pill) 0 0 var(--ts-radius-pill); }

/* ── Progress on black ───────────────────────────────────────────────────── */
.ts-progress--dark .ts-progress__label,
.ts-progress--dark .ts-progress__value { color: var(--ts-on-dark-1); }
.ts-progress--dark .ts-progress__note  { color: var(--ts-on-dark-3); }
.ts-progress--dark .ts-progress__track { background: var(--ts-track-dark); }
.ts-progress--dark .ts-progress__fill  { background: var(--ts-violet-300); }   /* 6.0:1 on track */

/* Hatch last, and scoped to --split, so it survives a --split --dark bar.
   A texture only means anything next to another segment. */
.ts-progress--split .ts-progress__fill--hatch {
  background: repeating-linear-gradient(
    45deg,
    var(--ts-violet-800) 0 4px,
    var(--ts-violet-400) 4px 8px
  );
}
.ts-progress--split.ts-progress--dark .ts-progress__fill--hatch {
  background: repeating-linear-gradient(
    45deg,
    var(--ts-violet-200) 0 4px,
    var(--ts-violet-400) 4px 8px
  );
}


/* ============================================================================
   9. METER — a measured value inside a fixed range
   Not the same thing as progress. Progress is a task getting done and it will
   reach 100%. A meter is a reading — seats used, coverage, headroom — and
   100% is often the thing you are trying to avoid.

   Drawn as ticks rather than a bar so the value survives greyscale by COUNT.
   ts-display.js fills the ticks from the aria values on the scale.
   ========================================================================= */
.ts-meter { margin-bottom: calc(var(--ts-space) * 2); }

.ts-meter__head {
  display: flex;
  align-items: baseline;
  gap: var(--ts-space);
  margin-bottom: var(--ts-space);
}
.ts-meter__label { flex: 1 1 auto; min-width: 0; font-size: var(--ts-fs-ui); }
.ts-meter__value {
  flex: 0 0 auto;
  font-family: var(--ts-mono);
  font-size: var(--ts-fs-ui);
  font-variant-numeric: tabular-nums;
  font-weight: var(--ts-fw-bold);
}

.ts-meter__scale { display: flex; gap: 3px; }
.ts-meter__tick {
  flex: 1 1 0;
  height: 12px;
  background: var(--ts-grey-light);
  border-radius: 2px;
}
.ts-meter__tick.is-on { background: var(--ts-purple); }        /* 8.9:1 against an off tick */

.ts-meter__note { margin: var(--ts-space) 0 0; font-size: var(--ts-fs-ui-sm); color: var(--ts-grey-text); }

.ts-meter--warning  .ts-meter__tick.is-on { background: var(--ts-warning-ink); }
.ts-meter--critical .ts-meter__tick.is-on { background: var(--ts-error-ink); }

.ts-meter--dark .ts-meter__tick { background: var(--ts-track-dark); }
.ts-meter--dark .ts-meter__tick.is-on { background: var(--ts-violet-300); }
.ts-meter--dark .ts-meter__note { color: var(--ts-on-dark-3); }


/* ============================================================================
   10. SPINNER — permitted, because the user asked for it
   Follows .ts-btn__spinner (home: ts-portal.css) and reuses its @keyframes,
   so a standalone spinner and a button spinner never drift apart. Under
   prefers-reduced-motion it slows to a 2s cycle; it does not stop, because a
   frozen spinner reads as a hung request (contract §7.9).

   Use a spinner for something the user started. Use .ts-skel for first paint.
   ========================================================================= */
.ts-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ts-grey-light);
  border-top-color: var(--ts-purple);
  border-radius: 50%;
  animation: ts-spin 700ms linear infinite;
}
.ts-spinner--sm { width: 14px; height: 14px; }
.ts-spinner--lg { width: 24px; height: 24px; border-width: 3px; }
.ts-spinner--inline { vertical-align: -3px; }
.ts-spinner--dark { border-color: var(--ts-hairline-dark); border-top-color: var(--ts-violet-300); }

/* Waiting on a whole region — a card body, a panel. Pairs with the region's
   role="status", never on its own. */
.ts-spinner-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ts-space) * 1.5);
  padding: calc(var(--ts-space) * 5) calc(var(--ts-space) * 2);
  font-size: var(--ts-fs-ui);
  color: var(--ts-grey-text);
}

@media (prefers-reduced-motion: reduce) {
  .ts-spinner { animation-duration: 2s; }
}


/* ============================================================================
   11. RESPONSIVE
   Rule 11: 200% zoom and a 320px viewport with no horizontal PAGE scroll.
   The card row scrolls inside its own track, which is the point of it.
   ========================================================================= */
@media (max-width: 620px) {
  .ts-card__head,
  .ts-card__body { padding: calc(var(--ts-space) * 1.5); }
  .ts-list__item { padding-left: calc(var(--ts-space) * 1.5); padding-right: calc(var(--ts-space) * 1.5); }
  /* Row actions have no hover on touch, so they are always on */
  .ts-list__rowactions { opacity: 1; }
  .ts-list__end { margin-left: 0; }
  .ts-progress__head,
  .ts-meter__head { flex-wrap: wrap; }
}
