/* ---- selectable rows -------------------------------------------------------
 * The whole reason this module exists is that the reference workbook's
 * assignment sheet had a header, a formula, and ZERO rows. The control was
 * designed and could not be sustained by hand.
 *
 * So multi-select is the primary path, not a later convenience: the entire row
 * is the checkbox target, not a 16px box beside it. This screen is used
 * one-handed, standing up, next to a van. */
.pick { display: grid; gap: var(--space-2); }
.pick__row { display: grid; grid-template-columns: auto 1fr auto;
  gap: var(--space-3); align-items: center;
  padding: var(--space-3); min-block-size: var(--target-min);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  cursor: pointer; }
.pick__row:hover { border-color: var(--color-border-strong); }
.pick__row:has(input:checked) { border-color: var(--color-accent);
  box-shadow: inset var(--border-width-accent) 0 0 var(--color-accent); }
.pick__row:has(input:focus-visible) {
  outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: var(--focus-ring-offset); }
/* A real checkbox, sized up. The OS draws its glyph, which is why the tokens
 * set `color-scheme` — without it a dark page draws a light checkbox. */
.pick__box { inline-size: 1.25rem; block-size: 1.25rem; flex: none;
  accent-color: var(--color-accent); margin: 0; }
.pick__main { min-inline-size: 0; display: grid; gap: var(--space-1); }
.pick__title { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.pick__meta { font-size: var(--text-sm); color: var(--color-text-muted);
  overflow-wrap: anywhere; }
.pick__end { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.pick__row--disabled { opacity: 0.55; cursor: not-allowed; }

/* At phone width the badge and the row action drop below the text instead of
 * squeezing it into three wrapped lines. The name is what you are scanning for;
 * it gets the width. */
@media (max-width: 30rem) {
  .pick__row { grid-template-columns: auto 1fr; row-gap: var(--space-2); }
  .pick__end { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
}

/* ---- the selection bar -----------------------------------------------------
 * Sticky to the BOTTOM, not the top: on a phone held one-handed the bottom of
 * the screen is the only part the thumb reaches without regripping. */
.selbar { position: sticky; inset-block-end: 0; z-index: var(--z-sticky);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  margin-block-start: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-inverse); color: var(--color-text-inverse);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.selbar__count { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.selbar__spacer { margin-inline-start: auto; }
.selbar .btn--ghost { color: var(--color-text-inverse); }
.selbar .btn--ghost:hover { background: rgb(255 255 255 / 0.12); }
/* On a phone the bar wraps rather than stacking: the count takes its own line,
 * the two actions share the next. Stacking all three made it 173px tall — a
 * fifth of the screen, permanently covering the list it acts on. */
@media (max-width: 30rem) {
  .selbar { flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
  .selbar__count { flex: 1 0 100%; }
  .selbar__spacer { display: none; }
  .selbar .btn { flex: 1 1 auto; }
}

/* ---- out-for badge --------------------------------------------------------
 * How long a thing has been gone is the whole point of the still-out screen, so
 * it is a figure with weight, not a muted afterthought. */
.out-for { display: grid; gap: 0; text-align: end; flex: none; }
.out-for__n { font-size: var(--text-lg); font-weight: var(--weight-semibold);
  line-height: var(--leading-tight); font-variant-numeric: tabular-nums; }
.out-for__u { font-size: var(--text-xs); color: var(--color-text-muted); }
.out-for--long .out-for__n { color: var(--color-danger); }

.group { display: grid; gap: var(--space-2); }
.group__head { display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--space-2) var(--space-3); }
.group__title { margin: 0; font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  border-inline-start: var(--border-width-accent) solid var(--color-accent);
  padding-inline-start: var(--space-3); }
.group__meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.group__action { margin-inline-start: auto; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.form-grid { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }

.amount { display: flex; align-items: stretch; }
.amount .field__control { border-start-end-radius: 0; border-end-end-radius: 0;
  font-variant-numeric: tabular-nums; text-align: end; }
.amount__cur { flex: none; min-block-size: var(--target-min);
  padding-inline: var(--space-3); font: inherit; font-size: var(--text-sm);
  color: var(--color-text); background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-strong); border-inline-start: 0;
  border-start-end-radius: var(--radius-md); border-end-end-radius: var(--radius-md);
  cursor: pointer; }
.amount__cur:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: var(--focus-ring-offset); position: relative; z-index: 1; }

.qty { inline-size: 4.5rem; min-block-size: var(--target-min);
  padding-inline: var(--space-2); font: inherit;
  font-variant-numeric: tabular-nums; text-align: end;
  color: var(--color-text); background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.qty:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: var(--focus-ring-offset); }
.qty[aria-invalid="true"] { border-color: var(--color-danger); }

.name-link { background: none; border: 0; padding: 0; font: inherit;
  color: var(--color-accent); text-align: start; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.name-link:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: var(--focus-ring-offset); border-radius: var(--radius-sm); }

.i-table { inline-size: 100%; border-collapse: collapse; }
.i-table th, .i-table td { text-align: start; padding: var(--space-2) var(--space-3);
  border-block-end: 1px solid var(--color-border); vertical-align: middle; }
.i-table th { font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--color-text-muted); white-space: nowrap; }
.i-table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--color-surface-raised);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); }

.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; }
.filters .field { inline-size: auto; min-inline-size: 9rem; flex: 1 1 9rem; }
.filters select.field__control { min-block-size: var(--target-min); }

.detail-list { display: grid; gap: var(--space-3); margin: 0; }
.detail-list dt { font-size: var(--text-xs); color: var(--color-text-muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }

.tone-neutral  { color: var(--color-tone-neutral); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.desktop-only { display: none; }
@media (min-width: 48rem) { .phone-only { display: none; } }

.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }

.proto { background: var(--color-surface-inverse); color: var(--color-text-inverse);
  font-size: var(--text-xs); padding: var(--space-2) var(--space-4); text-align: center;
  display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; align-items: center; }
.proto button { background: none; border: 1px solid currentcolor; color: inherit;
  border-radius: var(--radius-sm); font-size: var(--text-xs);
  padding: 2px var(--space-2); cursor: pointer; }
/* The instrument for EPIC-006's actual open question: "if the flow is slower
 * than a text message to a colleague, it fails the same way the sheet did".
 * Counting interactions is the only way to answer that by clicking rather than
 * by arguing. */
.proto__taps { font-variant-numeric: tabular-nums; border: 1px solid currentcolor;
  border-radius: var(--radius-full); padding: 2px var(--space-3); }
.proto__taps b { font-weight: var(--weight-bold); }
