/* Controls: button, link, field, select, check, radio, switch, segmented control, tick tile, tabs. One rule set per control. */

/* Button. A bare .btn has the quiet look; a rank class replaces ground, border, text and lip.
   A label stays on one line: a row of buttons that does not fit wraps, the label never does. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control, var(--control-md));
  padding: 0 var(--control-pad);
  border: 2px solid var(--color-stone);
  border-radius: var(--radius-control);
  background: var(--color-card);
  color: var(--color-ink);
  box-shadow: 0 var(--lip) 0 var(--color-lip);
  font: var(--weight-strong) var(--text-body, var(--text-md))/var(--leading-snug) var(--font-body);
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--motion-ease), background-color var(--motion-fast);
}
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: var(--color-paper); }
}
/* Pressed: the button sinks onto its lip. */
.btn:active { transform: translateY(var(--lip)); box-shadow: none; }
/* Primary: the one main action of a card, dialog or region. */
.btn--primary {
  background: var(--color-frame);
  border-color: var(--color-frame);
  color: var(--color-on-frame);
  box-shadow: 0 var(--lip) 0 var(--color-frame-night);
}
@media (hover: hover) {
  .btn--primary:hover:not(:disabled) { background: var(--color-frame-deep); border-color: var(--color-frame-deep); }
}
/* Dead: flat grey, no outline, no lip, so it is never taken for a live quiet button. */
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--color-off);
  border-color: var(--color-off);
  color: var(--color-off-ink);
  box-shadow: none;
  transform: none;
  text-decoration: none;
  cursor: not-allowed;
}

/* Icon button: a round quiet button holding one glyph or icon; no lip. Dialog close, slot remove, row tools. */
.btn--icon {
  width: var(--control, var(--control-md));
  min-width: var(--control, var(--control-md));
  height: var(--control, var(--control-md));
  flex: none;
  padding: 0;
  border-radius: var(--radius-pill);
  box-shadow: none;
  font-size: var(--text-glyph-sm);
  line-height: 1;
}
.btn--icon > .icon { width: 22px; height: 22px; }
.btn--icon:active { transform: none; background: var(--color-frame-wash); }

/* Secondary: a real second action. White with a blue outline and a blue lip. */
.btn--secondary {
  background: var(--color-card);
  border-color: var(--color-frame);
  color: var(--color-frame-deep);
  box-shadow: 0 var(--lip) 0 var(--color-frame);
}
@media (hover: hover) {
  .btn--secondary:hover:not(:disabled) { background: var(--color-frame-wash); }
}

/* Text: underlined deep-blue words in a full-height row, no ground and no lip. Low-weight actions. */
.btn--text {
  padding: 0 var(--space-2);
  background: transparent;
  border-color: transparent;
  color: var(--color-frame-deep);
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
@media (hover: hover) {
  .btn--text:hover:not(:disabled) { background: var(--color-frame-wash); }
}
.btn--text:active { transform: none; background: var(--color-frame-line); }

/* Danger: underlined brick words, no ground and no lip; always set apart from the other actions. */
.btn--danger {
  padding: 0 var(--space-2);
  background: transparent;
  border-color: transparent;
  color: var(--color-danger);
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
@media (hover: hover) {
  .btn--danger:hover:not(:disabled) { background: var(--color-paper); }
}
.btn--danger:active { transform: none; background: var(--color-edge); }
/* Round danger button (remove a person from a list): a white disc with a brick line and a brick glyph. */
.btn--icon.btn--danger { padding: 0; text-decoration: none; }
.btn--icon.btn--danger:not(:disabled) { background: var(--color-card); border-color: var(--color-danger); }

/* Good: a good state that still opens something (Budget pick). The tick comes from the markup. */
.btn--good {
  background: var(--color-ok-wash);
  border-color: var(--color-ok-wash);
  color: var(--color-ok);
  box-shadow: 0 var(--lip) 0 var(--color-ok-lip);
}
@media (hover: hover) {
  .btn--good:hover:not(:disabled) { background: var(--color-ok-wash-hover); }
}

/* Saved: a quiet button whose label is a state ("In your Recipe Box") leads with a green tick; still live, so it keeps its outline and lip. */
.btn.is-saved::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--color-ok);
  -webkit-mask: var(--icon-check) center / 20px no-repeat;
  mask: var(--icon-check) center / 20px no-repeat;
}

/* Large: the one main action of a screen or dialog. */
.btn--lg { min-height: var(--control-lg); padding: 0 28px; font-weight: var(--weight-bold); }
.btn--block { width: 100%; }

/* Busy: waiting on the network. A ring turns before the unchanged label, and the button keeps its rank.
   The script also disables it, which is what stops a second press. */
.btn.is-busy { cursor: progress; }
.btn.is-busy::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-pill);
  animation: btn-busy 0.8s linear infinite;
}
.btn--primary.is-busy:disabled {
  background: var(--color-frame);
  border-color: var(--color-frame);
  color: var(--color-on-frame);
  box-shadow: 0 var(--lip) 0 var(--color-frame-night);
}
@keyframes btn-busy { to { transform: rotate(1turn); } }

/* Snug: full height, smaller words and padding, for buttons that share a row two by two. */
.btn.btn--snug { padding: 0 10px; font-size: var(--text-sm); }

/* A row of buttons: they share the width; a label never breaks, so a button that does not fit starts the next line.
   Phones hold two to a row at most. */
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.btn-row > * { flex: 1 1 0; min-width: max-content; }
@media (max-width: 640px) {
  .btn-row > * { flex-basis: calc(50% - var(--space-2)); }
}

/* Small: staff rows and the buttons inside a toast. */
.btn--sm { min-height: var(--control-sm); padding: 0 14px; font-size: var(--text-sm); }
/* On a blue or night ground: a white outline, no fill and no lip. */
.btn--on-frame {
  background: transparent;
  border-color: var(--color-on-frame-line);
  color: var(--color-on-frame);
  box-shadow: none;
}
@media (hover: hover) {
  .btn--on-frame:hover:not(:disabled) { background: var(--color-on-frame-press); }
}
.btn--on-frame:active { transform: none; background: var(--color-on-frame-press); }
.btn--on-frame:focus-visible { outline-color: var(--color-on-frame); }
/* Primary on a blue ground: a white card button with deep blue words and the night lip. */
.btn--primary.btn--on-frame {
  background: var(--color-card);
  border-color: var(--color-card);
  color: var(--color-frame-deep);
  box-shadow: 0 var(--lip) 0 var(--color-frame-night);
}
@media (hover: hover) {
  .btn--primary.btn--on-frame:hover:not(:disabled) { background: var(--color-paper); border-color: var(--color-paper); }
}
.btn--primary.btn--on-frame:active { transform: translateY(var(--lip)); box-shadow: none; background: var(--color-paper); }

/* Link: underlined deep-blue words; hover lays a pale blue wash behind them. */
.link {
  color: var(--color-frame-deep);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
@media (hover: hover) {
  .link:hover { color: var(--color-frame-night); background: var(--color-frame-wash); }
}
/* A link that stands alone on its line: a full 48px target. A button drawn as a link drops its button chrome. */
.link--row {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--control-md); font-weight: var(--weight-strong);
}
button.link { padding: 0 var(--space-1); background: none; border: 0; font: inherit; font-weight: var(--weight-strong); cursor: pointer; }

/* Read-only staff (attribute set by applyViewerMode): controls go flat grey with no outline or lip; a field keeps a thin grey line so a form still reads as a form.
   !important: a rank class or state rule must not win over the off look. */
.admin-panel.viewer-mode [data-viewer-disabled] { cursor: not-allowed !important; }
.admin-panel.viewer-mode button[data-viewer-disabled] { background: var(--color-off); border-color: var(--color-off); color: var(--color-off-ink) !important; box-shadow: none; transform: none; text-decoration: none !important; }
/* A staff field that is switched off, for a read-only role or for everyone, has one look. The border keeps its width
   in the ground's colour, so the field does not shrink; the thin line is an outline drawn on its outer edge. */
.admin-panel :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea):is(:disabled, [data-viewer-disabled]) { background: var(--color-off) !important; border-color: var(--color-off) !important; color: var(--color-off-ink) !important; cursor: not-allowed !important; }
.admin-panel :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea):is(:disabled, [data-viewer-disabled]):not(:focus-visible) { outline: 1px solid var(--color-off-line); outline-offset: -1px; }
/* An example in a switched-off field is slanted, so it is not taken for a saved value. */
.admin-panel :is(input, textarea):is(:disabled, [data-viewer-disabled])::placeholder { color: var(--color-off-ink); font-style: italic; }
/* Chrome fades a disabled select to 70%; the off look is the whole signal. */
select:disabled { opacity: 1; }
.admin-panel.viewer-mode a[data-viewer-disabled] { color: var(--color-off-ink); text-decoration: none; }

/* Check box: every native checkbox but the two switches. min-width and min-height win over the old inline 16px sizes. */
input[type="checkbox"]:where(:not(#showFinishedCohorts, #largePrintToggle)), input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-block;
  flex: none;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  border: 2px solid var(--color-field-line);
  border-radius: var(--radius-check);
  background: var(--color-card);
  cursor: pointer;
  transition: background-color var(--motion-fast), border-color var(--motion-fast);
}
input[type="checkbox"]:where(:not(#showFinishedCohorts, #largePrintToggle)):checked { background: var(--color-frame); border-color: var(--color-frame); }
/* The tick: a 6 by 12px corner turned 45deg. */
input[type="checkbox"]:where(:not(#showFinishedCohorts, #largePrintToggle)):checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 6px;
  height: 12px;
  border: solid var(--color-on-frame);
  border-width: 0 3px 3px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
/* Radio: round, a 14px dot when chosen. */
input[type="radio"] { border-radius: var(--radius-pill); }
input[type="radio"]:checked { border-color: var(--color-frame); background: radial-gradient(circle, var(--color-frame) 0 7px, var(--color-card) 7.5px); }
@media (hover: hover) {
  input[type="checkbox"]:where(:not(#showFinishedCohorts, #largePrintToggle)):hover:not(:disabled, :checked, [data-viewer-disabled]), input[type="radio"]:hover:not(:disabled, [data-viewer-disabled]) { border-color: var(--color-frame); }
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled { background: var(--color-off); border-color: var(--color-off-line); cursor: not-allowed; }
input[type="checkbox"]:where(:not(#showFinishedCohorts, #largePrintToggle)):is(:disabled, [data-viewer-disabled]):checked::after { border-color: var(--color-off-ink); }
input[type="radio"]:is(:disabled, [data-viewer-disabled]):checked { background: radial-gradient(circle, var(--color-off-ink) 0 7px, var(--color-off) 7.5px); }

/* Switch: a checkbox whose change applies at once. The white tick shows on the track's left half when on. */
#showFinishedCohorts, #largePrintToggle {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-block;
  flex: none;
  width: 52px;
  height: 32px;
  min-width: 52px;
  min-height: 32px;
  margin: 0;
  vertical-align: middle;
  border: 2px solid var(--color-off-line);
  border-radius: var(--radius-pill);
  background: var(--color-off);
  cursor: pointer;
  transition: background-color var(--motion-fast), border-color var(--motion-fast);
}
#showFinishedCohorts::before, #largePrintToggle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--color-stone);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  transition: transform var(--motion-fast) var(--motion-ease);
}
#showFinishedCohorts:checked, #largePrintToggle:checked { background: var(--color-frame); border-color: var(--color-frame); }
#showFinishedCohorts:checked::before, #largePrintToggle:checked::before { transform: translateX(20px); }
#showFinishedCohorts:checked::after, #largePrintToggle:checked::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 4px;
  width: 6px;
  height: 12px;
  border: solid var(--color-on-frame);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

/* Text field, and the fields that keep their own names: .select, the recipe editors' fields and the editor form rows.
   On a touch screen 10-base keeps it at 16px at least; .input--lg is above that already.
   background-color, not the shorthand: the select chevron below is a background image. */
.input, .select, .edit-recipe-input, .edit-recipe-textarea, .step-editor-input,
.form-row > :is(input:not([type="checkbox"], [type="radio"]), select, textarea) {
  min-height: var(--control, var(--control-md));
  padding: 0 var(--field-pad);
  border: 2px solid var(--color-field-line);
  border-radius: var(--radius-control);
  background-color: var(--color-card);
  color: var(--color-ink);
  font: var(--weight-regular) var(--text-body, var(--text-md))/var(--leading-snug) var(--font-body);
  transition: border-color var(--motion-fast);
}
textarea.input { display: block; width: 100%; padding: var(--space-3) var(--field-pad); line-height: var(--leading-body); resize: vertical; }
:is(.input, .edit-recipe-input, .edit-recipe-textarea, .step-editor-input, .form-row > :is(input, textarea), .ingredient-row input)::placeholder { color: var(--color-ink-soft); opacity: 1; }
@media (hover: hover) {
  .input:hover:not(:disabled) { border-color: var(--color-frame); }
}
.input:focus { border-color: var(--color-frame); }
/* After focus, so a field in error stays brick while it is being corrected. */
.input[aria-invalid="true"] { border-color: var(--color-danger); }
.input--lg { min-height: var(--control-lg); font-size: var(--text-lg); }
.input--num { text-align: right; font-variant-numeric: tabular-nums; }

/* Status line under a field that is not an error: the words carry the meaning, .is-ok colours them. */
/* Help under a label: what to put in the field, in the meta size. */
.field__help { margin: 0 0 6px; color: var(--color-ink-soft); font: var(--weight-regular) var(--text-meta, var(--text-sm))/var(--leading-body) var(--font-body); text-wrap: pretty; }
.field__status { margin-top: var(--space-2); font: var(--weight-strong) var(--text-body, var(--text-md))/var(--leading-body) var(--font-body); color: var(--color-ink); }
.field__status:empty { margin-top: 0; }
.field__status.is-ok { color: var(--color-ok); }

/* Error line under a field: brick words after the alert icon. Its control carries aria-invalid="true".
   The slot stays in the page while empty (it is a live region), so it only loses its room. */
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--color-danger);
  font: var(--weight-regular) var(--text-body, var(--text-md))/var(--leading-body) var(--font-body);
}
.field__error:empty { margin-top: 0; }
.field__error:not(:empty)::before {
  content: "";
  flex: none;
  width: 20px;
  height: calc(1em * var(--leading-body));
  background: currentColor;
  -webkit-mask: var(--icon-alert) center / 20px no-repeat;
  mask: var(--icon-alert) center / 20px no-repeat;
}

/* Tabs: second-level places inside a screen. Words on one rule; the current one is bold on a 4px bar.
   The row is always a flex row: scripts show it by writing display:flex inline. */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--color-rule); }
.tabs__tab {
  min-height: var(--control, var(--control-md));
  margin-bottom: -2px;
  padding: 0 var(--field-pad);
  border: 0;
  border-bottom: 4px solid transparent;
  background: transparent;
  color: var(--color-ink-soft);
  font: var(--weight-strong) var(--text-body, var(--text-md))/var(--leading-snug) var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
@media (hover: hover) {
  .tabs__tab:hover:not(.active, [aria-selected="true"]) { color: var(--color-frame-night); border-bottom-color: var(--color-rule); }
}
.tabs__tab:is(.active, [aria-selected="true"]) { color: var(--color-frame-night); font-weight: var(--weight-bold); border-bottom-color: var(--color-frame); }
/* Phones: the same tabs two by two, so every tab stays on screen; the current one is a pale blue box with a blue outline. */
@media (max-width: 640px) {
  .tabs { gap: var(--space-2); border-bottom: 0; }
  .tabs__tab {
    flex: 0 0 calc(50% - var(--space-1));
    min-height: var(--control-md);
    margin-bottom: 0;
    padding: 0 var(--space-3);
    border: 2px solid var(--color-rule);
    border-radius: var(--radius-control);
    background: var(--color-card);
    text-align: left;
    white-space: normal;
  }
  .tabs__tab:is(.active, [aria-selected="true"]) { background: var(--color-frame-wash); border-color: var(--color-frame); }
}

/* Editor form rows: one field per row, the field full width, a textarea at least 120px and resized only up and down. */
.form-row {
  margin-bottom: 1rem;
}
.form-row :is(input:not([type="checkbox"], [type="radio"]), select, textarea) { width: 100%; }
.form-row textarea { min-height: 120px; resize: vertical; }

/* Ingredient lines are a dense grid of long names: the field outline, with text size and room set in the editor rules. */
.ingredient-row :is(input:not([type="checkbox"]), select) {
  min-height: var(--control, var(--control-md));
  border: 2px solid var(--color-field-line);
  border-radius: var(--radius-control);
  background-color: var(--color-card);
  color: var(--color-ink);
  font-family: var(--font-body);
  transition: border-color var(--motion-fast);
}
/* Textarea: room above and below the first line. */
.edit-recipe-textarea, .step-editor-input, .form-row textarea { padding: var(--space-3) var(--field-pad); line-height: var(--leading-body); }
/* Select: no native arrow; a chevron in two gradients sits in the 40px right padding. */
.select, .form-row select, .ingredient-row select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-frame-deep) 50%), linear-gradient(135deg, var(--color-frame-deep) 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 15px) 52%;
  background-size: 7px 7px;
  background-repeat: no-repeat;
  cursor: pointer;
}
@media (hover: hover) {
  :is(.select, .edit-recipe-input, .edit-recipe-textarea, .step-editor-input, .form-row > :is(input, select, textarea), .ingredient-row :is(input, select)):hover:not(:disabled, [type="checkbox"], [type="radio"]) { border-color: var(--color-frame); }
}
:is(.select, .edit-recipe-input, .edit-recipe-textarea, .step-editor-input, .form-row > :is(input, select, textarea), .ingredient-row :is(input, select)):focus:not([type="checkbox"], [type="radio"]) { border-color: var(--color-frame); }
:is(.select, .edit-recipe-input, .edit-recipe-textarea, .step-editor-input, .form-row > :is(input, select, textarea), .ingredient-row :is(input, select)):disabled:not([type="checkbox"], [type="radio"]) { background-color: var(--color-off); border-color: var(--color-off-line); color: var(--color-off-ink); cursor: not-allowed; }
/* Ingredient line checks: a name that will not price, and one to look at again. */
.ingredient-row .ing-error { border-color: var(--color-danger); }
.ingredient-row .ing-warn { border-color: var(--color-warn); }
/* A finder select moved off its first (default) answer shows the same "chosen" marks as a segment:
   a heavier blue outline, a bar inside its foot, bold dark text. Read from the chosen option, so no script keeps it. */
.finder .select:has(> option:checked:not(:first-child)) {
  border: 3px solid var(--color-frame);
  color: var(--color-frame-night);
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-chosen);
}

/* Field label: sentence case, 6px above its control. */
.field__label, .form-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--color-ink);
  font: var(--weight-strong) var(--text-body, var(--text-md))/var(--leading-snug) var(--font-body);
  text-transform: none;
  letter-spacing: normal;
}

/* Segmented control: the options are the control, no track. Chosen = blue outline, a 4px bar under the word, bold dark blue on pale blue. */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
@media (max-width: 640px) {
  .seg { display: grid; width: 100%; }
}
.seg__opt {
  min-height: var(--control, var(--control-md));
  margin: 0;
  padding: 0 18px;
  border: 2px solid var(--color-stone);
  border-radius: 0;
  background: var(--color-card);
  color: var(--color-ink);
  font: var(--weight-strong) var(--text-body, var(--text-md))/var(--leading-snug) var(--font-body);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--motion-fast);
}
/* Neighbours share one border line. */
.seg__opt + .seg__opt { margin-inline-start: -2px; }
.seg__opt:first-child { border-start-start-radius: var(--radius-control); border-end-start-radius: var(--radius-control); }
.seg__opt:last-child { border-start-end-radius: var(--radius-control); border-end-end-radius: var(--radius-control); }
@media (hover: hover) {
  .seg__opt:hover { background: var(--color-paper); }
}
.seg__opt:active { background: var(--color-frame-wash); }
/* Raised above its neighbours so the whole blue outline shows. */
.seg__opt:is(.is-on, [aria-selected="true"], [aria-pressed="true"]) {
  position: relative;
  z-index: 1;
  border-color: var(--color-frame);
  background: var(--color-frame-wash);
  color: var(--color-frame-night);
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-chosen);
}
/* Very narrow or much enlarged text: the options stack, so two long words never push the page sideways. */
@media (max-width: 15em) {
  .seg { grid-auto-flow: row; }
  .seg__opt + .seg__opt { margin-inline-start: 0; margin-block-start: -2px; }
  .seg__opt:first-child { border-radius: var(--radius-control) var(--radius-control) 0 0; }
  .seg__opt:last-child { border-radius: 0 0 var(--radius-control) var(--radius-control); }
  .seg--pick > .seg__opt + .seg__opt { margin-block-start: 0; }
}
/* A choice the user makes (Swap / Keep): both options plain until one is tapped. The chosen
   label carries its own tick glyph, so no tick is drawn here. Lipped like every live button. */
.seg--pick { gap: var(--space-2); }
.seg--pick > .seg__opt {
  margin-inline-start: 0;
  border-radius: var(--radius-control);
  box-shadow: 0 var(--lip) 0 var(--color-lip);
}
.seg--pick > .seg__opt:active { transform: translateY(var(--lip)); box-shadow: none; }
.seg--pick > .seg__opt[aria-pressed="true"] { box-shadow: var(--shadow-chosen), 0 var(--lip) 0 var(--color-frame-night); }

/* Disclosure: a 48px summary row in deep-blue 600 with a chevron that turns when open. */
.disclosure > summary, .ki-cost-note > summary {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: var(--control-md);
  color: var(--color-frame-deep);
  font-size: var(--text-md); font-weight: var(--weight-strong); line-height: var(--leading-snug);
  list-style: none; cursor: pointer;
}
:is(.disclosure, .ki-cost-note) > summary::-webkit-details-marker { display: none; }
:is(.disclosure, .ki-cost-note) > summary::after {
  content: ''; flex: none; width: 10px; height: 10px; margin: -5px 5px 0 auto;
  border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(45deg);
  transition: transform var(--motion-fast);
}
:is(.disclosure, .ki-cost-note)[open] > summary::after { margin-top: 5px; transform: rotate(-135deg); }
:is(.disclosure, .ki-cost-note) > summary:focus-visible { border-radius: var(--radius-control); }

/* Tick tiles: pick any number from many. The 24px box is drawn at the left; when on, the existing tick span covers it as a filled blue box. */
.pantry-chips, .tiles { display: grid; gap: var(--space-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 641px) {
  .pantry-chips, .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
/* A narrow or zoomed phone (200% text): one tile to a row, so long names keep whole words. */
@media (max-width: 21em) {
  .pantry-chips, .tiles { grid-template-columns: minmax(0, 1fr); }
}
.pantry-chip, .tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 12px 6px 46px;
  border: 2px solid var(--color-field-line);
  border-radius: var(--radius-control);
  background: var(--color-card);
  color: var(--color-ink);
  font: var(--weight-regular) var(--text-md)/1.25 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--motion-fast), border-color var(--motion-fast);
}
.pantry-chip::before, .tile::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  border: 2px solid var(--color-field-line);
  border-radius: var(--radius-tick);
  background: var(--color-card);
}
@media (hover: hover) {
  :is(.pantry-chip, .tile):hover { border-color: var(--color-frame); }
}
:is(.pantry-chip, .tile):active { background: var(--color-frame-wash); }
.pantry-chip[aria-pressed="true"] { border-color: var(--color-frame); background: var(--color-frame-wash); font-weight: var(--weight-strong); }
.pantry-chip[aria-pressed="true"]::before { border-color: var(--color-frame); background: var(--color-frame); }
.pantry-chip-tick {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  border-radius: var(--radius-tick);
  background: var(--color-frame);
  line-height: 24px;
  text-align: center;
  color: var(--color-on-frame);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
