/* The cell (src/choice_cell.rs; docs/decisions.md, 3 Nov 2026, "The shared pieces of choices…", (2)):
   one picker on both sites. Closed, a box at the roster's states: given here bold in ink on the
   field's rim, from above or a default grey on a quieter rim, not chosen a dashed muted rim. Round,
   as a control resting on the shell is (the corners rule). */
.choice-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  height: var(--cell-height);
  padding: 0 var(--space-2);
  margin: 0;
  border: var(--hairline) solid var(--color-field-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--text-quiet);
  color: var(--color-ink);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
}

.choice-cell:focus-visible {
  outline: var(--focus-width) solid var(--color-ink);
  outline-offset: var(--focus-offset);
}

.cell-given {
  font-weight: var(--weight-strong);
}

.cell-above {
  border-color: var(--color-line-later);
  color: var(--color-muted);
}

.cell-not-chosen {
  border-style: dashed;
  border-color: var(--color-muted);
  color: var(--color-muted);
}

/* The orders site's cell grows rather than cuts: a split's parts wrap onto a second line where its
   place is narrow (a phone's row), each name whole. */
.cell-large {
  height: auto;
  min-height: var(--cell-height-large);
  padding: 0 var(--space-3);
  font-size: var(--text-control);
}

.cell-full {
  display: flex;
  width: 100%;
}

/* Read only: the value in place, no rim and no chevron, its reason in its title and read out. */
.cell-fixed {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

/* **A cell's names are never cut** (choices 3b-2's verification, D1, the building session's call):
   two values whose drawings match are told apart only by their words ("Crest 1987", "Crest 2027"),
   so the cell is as wide as its words and a sheet's column grows to hold it; its title says them too. */
.cell-face {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

/* A mono word beside a value: "default" on the cell, the landing's tag in the list. */
.cell-note {
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* A split, closed: each value's drawing, name and count, and what is left in a dashed rim. The names
   stay, whole (two patches that differ only in their words are the same drawing at 18 px). */
.cell-face-split {
  gap: var(--space-3);
}

.cell-large .cell-face-split {
  flex-wrap: wrap;
  row-gap: var(--space-1);
  padding-block: var(--space-1);
}

.cell-part {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.cell-part-name {
  font-weight: var(--weight-regular);
}

.cell-count {
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-strong);
}

.cell-part-left {
  padding: 0 var(--space-1);
  border: var(--hairline) dashed var(--color-muted);
  color: var(--color-muted);
}

.cell-chevron {
  flex: none;
  width: var(--space-3);
  height: var(--space-3);
  fill: none;
  stroke: var(--color-meta);
  stroke-width: var(--line-small-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- the list: a popover in the top layer, placed under its cell from its box ---- */
.cell-list {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  width: max-content;
  min-width: var(--cell-list-width);
  max-width: min(calc(100vw - var(--space-8)), calc(var(--cell-list-width) * 1.6));
  max-height: var(--cell-list-height);
  overflow-y: auto;
  padding: var(--space-1) var(--space-2);
  border: var(--hairline) solid var(--color-field-line);
  border-radius: var(--radius-box);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
  font-size: var(--text-control-small);
}

.cell-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-meta);
}

.cell-options {
  display: grid;
}

.cell-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  color: var(--color-ink);
  text-align: left;
  cursor: pointer;
}

.cell-option:hover,
.cell-option:focus-visible {
  background: var(--color-line-panel);
  outline: none;
}

.cell-option:focus-visible {
  box-shadow: inset 0 0 0 var(--focus-width) var(--color-ink);
}

.cell-option[aria-pressed="true"] {
  background: var(--color-line-panel);
  font-weight: var(--weight-strong);
}

.cell-option-words {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: var(--leading-section);
}

.cell-option-note {
  font-size: var(--text-meta);
  font-weight: var(--weight-regular);
  color: var(--color-meta);
}

.cell-check {
  font-weight: var(--weight-strong);
}

/* The foot: every way a row stops being one value, words that act, under a hairline. */
.cell-foot {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-2) var(--space-1);
  border-top: var(--hairline) solid var(--color-line);
}

.cell-foot-act {
  justify-self: start;
  padding: var(--space-1) 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--color-ink);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
  cursor: pointer;
}

.cell-foot-act:focus-visible {
  outline: var(--focus-width) solid var(--color-ink);
  outline-offset: var(--focus-offset);
}

.cell-foot-act[disabled] {
  color: var(--color-disabled-fill);
  cursor: default;
}

.cell-foot-refused {
  display: grid;
}

.cell-foot-why {
  font-size: var(--text-meta);
  color: var(--color-meta);
}

/* ---- a split: a column of steppers ---- */
.cell-steps {
  display: grid;
  padding: 0 var(--space-2) var(--space-1);
}

.cell-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: calc(var(--cell-stepper) + var(--space-3));
  border-bottom: var(--hairline) solid var(--color-line);
}

.cell-step-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-step-down,
.cell-step-up {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--cell-stepper);
  height: var(--cell-stepper);
  padding: 0;
  border: var(--hairline) solid var(--color-field-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font: inherit;
  line-height: 1;
  color: var(--color-ink);
  cursor: pointer;
}

.cell-step-down:focus-visible,
.cell-step-up:focus-visible {
  outline: var(--focus-width) solid var(--color-ink);
  outline-offset: var(--focus-offset);
}

.cell-step-down[aria-disabled="true"],
.cell-step-up[aria-disabled="true"] {
  border-color: var(--color-line);
  color: var(--color-disabled-fill);
  cursor: default;
}

.cell-step-count {
  width: var(--cell-stepper-count);
  text-align: center;
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
}

.cell-step-left {
  color: var(--color-muted);
}

.cell-step-left .cell-step-count {
  /* Level with the counts above, which sit between their two steppers. */
  margin-right: calc(var(--cell-stepper) + var(--space-2));
}

.cell-steps-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--cell-stepper-large);
}

.cell-steps-of {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-meta);
}

/* ---- the orders site's list: larger rows and steppers ---- */
.cell-list-large {
  font-size: var(--text-control);
}

.cell-list-large .cell-step-down,
.cell-list-large .cell-step-up {
  width: var(--cell-stepper-large);
  height: var(--cell-stepper-large);
  font-size: var(--text-lead);
}

.cell-list-large .cell-step {
  min-height: calc(var(--cell-stepper-large) + var(--space-3));
}

.cell-list-large .cell-step-left .cell-step-count {
  margin-right: calc(var(--cell-stepper-large) + var(--space-2));
}

/* ---- the phone's sheet: the same list from the bottom, the whole width ---- */
.cell-sheet {
  inset: auto 0 0 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 80vh;
  padding: var(--space-2) var(--space-4) var(--space-4);
  border-width: var(--hairline) 0 0;
  border-radius: var(--radius-cell-sheet) var(--radius-cell-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
}

.cell-sheet::backdrop {
  background: var(--color-overlay);
}

.cell-sheet-handle {
  display: block;
  width: var(--cell-sheet-handle);
  height: var(--cell-sheet-handle-height);
  margin: 0 auto var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-line-later);
}

.cell-sheet .cell-list-head {
  padding: 0 0 var(--space-2);
  border-bottom: var(--hairline) solid var(--color-line);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-strong);
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-ink);
}

.cell-sheet .cell-list-head .cell-foot-act {
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
}

.cell-sheet .cell-option {
  min-height: var(--cell-sheet-row);
  padding: var(--space-1) 0;
  border-bottom: var(--hairline) solid var(--color-line);
  border-radius: 0;
}

.cell-sheet .cell-foot {
  padding: var(--space-2) 0 0;
  border-top: 0;
}

.cell-sheet .cell-steps {
  padding: 0;
}
