/*
 * Ported from shy_dye's original app/assets/stylesheets/application.css
 * during the Rails-engine migration into shy_hub.
 *
 * Deliberately DROPPED: the global element resets (body/h1-h4/p/a) and the
 * whole nav/flash chrome system (.nav*, .flash*, .main) -- those assumed
 * this stylesheet owned the entire page; shy_hub's own layout +
 * Shared::SidebarComponent + Shared::FlashComponent own that chrome now, and
 * this file (like every engine's own stylesheet) is pulled in globally via
 * `stylesheet_link_tag :all` -- an element-level rule like `body {}` here
 * would leak into every other page in the app.
 *
 * Palette: this engine's original variable names are kept as thin
 * aliases onto shy_hub's shared `--shy-*` design tokens (defined in the
 * host's app/assets/stylesheets/application.css). Every rule below still
 * says `var(--surface)`, `var(--primary)`, etc. -- they now resolve to
 * the shared system and pick up its light/dark switch for free. Change
 * colors there, not here.
 *
 * The domain-coded status/phase chips (.badge-*, .run-chip--*,
 * .run-phase-date-pill--*, .recipe-status-*, the mix-sheet button, the
 * water banner) keep their light pastel fills as `var(--chip-<hue>-*,
 * <light hex>)` fallbacks; the `--chip-*` custom props are defined only
 * under dark mode (both blocks just below) to remap them to legible
 * translucent tints there.
 */
/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg:              var(--shy-bg);
  --surface:         var(--shy-surface);
  --surface-alt:     var(--shy-surface-alt);
  --surface-sunken:  var(--shy-surface-sunken);
  --border:          var(--shy-border);
  --border-strong:   var(--shy-border-strong);

  --text:            var(--shy-text);
  --text-muted:      var(--shy-text-muted);
  --text-light:      var(--shy-text-faint);

  --primary:         var(--shy-brand);
  --primary-hover:   var(--shy-brand-hover);
  --primary-light:   var(--shy-brand-tint);

  --danger:          var(--shy-danger);
  --danger-light:    var(--shy-danger-tint);
  --success:         var(--shy-success);
  --success-light:   var(--shy-success-tint);
  --warning:         var(--shy-warning);
  --warning-light:   var(--shy-warning-tint);

  --radius-sm:  var(--shy-radius-sm);
  --radius:     var(--shy-radius);
  --radius-lg:  var(--shy-radius-lg);

  --shadow-sm:  var(--shy-shadow-sm);
  --shadow:     var(--shy-shadow);
  --shadow-md:  var(--shy-shadow-md);

  --font: var(--shy-font);
}

/* Dark-mode remap for the domain-coded status/phase chips (badges, run
   chips, phase-date pills, recipe-status pills, the mix-sheet button, the
   water banner). The chip rules use `var(--chip-<hue>-*, <light hex>)`, so
   light mode is unchanged and dark mode picks these translucent tints up.
   Defined for BOTH OS-dark and the forced toggle -- keep the two lists
   identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chip-amber-bg:  rgba(230, 180, 103, 0.16); --chip-amber-fg:  #e8be7f; --chip-amber-bd:  rgba(230, 180, 103, 0.5);
    --chip-purple-bg: rgba(167, 139, 250, 0.16); --chip-purple-fg: #c9bcf9; --chip-purple-bd: rgba(167, 139, 250, 0.5);
    --chip-blue-bg:   rgba(125, 183, 247, 0.16); --chip-blue-fg:   #a6cbf7; --chip-blue-bd:   rgba(125, 183, 247, 0.5);
    --chip-green-bg:  rgba(111, 211, 153, 0.15); --chip-green-fg:  #82ddaa; --chip-green-bd:  rgba(111, 211, 153, 0.45);
    --chip-pink-bg:   rgba(244, 143, 190, 0.16); --chip-pink-fg:   #f4aed0; --chip-pink-bd:   rgba(244, 143, 190, 0.5);
    --chip-grey-bg:   rgba(148, 163, 184, 0.15); --chip-grey-fg:   #c3cdda; --chip-grey-bd:   rgba(148, 163, 184, 0.45);
    --chip-orange-bg: rgba(251, 146, 60, 0.15);  --chip-orange-fg: #fbb072; --chip-orange-bd: rgba(251, 146, 60, 0.5);
  }
}

:root[data-theme="dark"] {
  --chip-amber-bg:  rgba(230, 180, 103, 0.16); --chip-amber-fg:  #e8be7f; --chip-amber-bd:  rgba(230, 180, 103, 0.5);
  --chip-purple-bg: rgba(167, 139, 250, 0.16); --chip-purple-fg: #c9bcf9; --chip-purple-bd: rgba(167, 139, 250, 0.5);
  --chip-blue-bg:   rgba(125, 183, 247, 0.16); --chip-blue-fg:   #a6cbf7; --chip-blue-bd:   rgba(125, 183, 247, 0.5);
  --chip-green-bg:  rgba(111, 211, 153, 0.15); --chip-green-fg:  #82ddaa; --chip-green-bd:  rgba(111, 211, 153, 0.45);
  --chip-pink-bg:   rgba(244, 143, 190, 0.16); --chip-pink-fg:   #f4aed0; --chip-pink-bd:   rgba(244, 143, 190, 0.5);
  --chip-grey-bg:   rgba(148, 163, 184, 0.15); --chip-grey-fg:   #c3cdda; --chip-grey-bd:   rgba(148, 163, 184, 0.45);
  --chip-orange-bg: rgba(251, 146, 60, 0.15);  --chip-orange-fg: #fbb072; --chip-orange-bd: rgba(251, 146, 60, 0.5);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; flex-shrink: 0; max-width: 100%; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-header h2, .card-header h3 { margin: 0; }

.card-body { padding: 1.25rem; }

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.1s;
}
.recipe-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.recipe-card-body { padding: 1.25rem; flex: 1; }
.recipe-card-body h2 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.recipe-card-body h2 a { color: var(--text); }
.recipe-card-body h2 a:hover { color: var(--primary); text-decoration: none; }
.recipe-card-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0; }

.recipe-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.recipe-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Recipe filter bar ────────────────────────────────────────── */
.recipe-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.recipe-search-form { display: flex; gap: 0.5rem; }
.recipe-search-input { max-width: 28rem; }

.tag-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.tag-pill:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.tag-pill-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tag-pill-active:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

/* ── Tag checkbox group (recipe form) ────────────────────────── */
.tag-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.tag-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.tag-checkbox-label input[type="checkbox"] { margin: 0; }

/* ── Color picker input ───────────────────────────────────────── */
.color-picker-input {
  width: 3rem;
  height: 2.5rem;
  padding: 0.15rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.recipe-card-actions {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--surface-alt);
}
.data-table th:last-child { text-align: right; }

.data-table td {
  padding: 0.7rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-alt); }

.data-table td:last-child { text-align: right; white-space: nowrap; }
.data-table .td-right { text-align: right; }

.data-table tfoot td {
  font-weight: 600;
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: var(--surface-alt);
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: var(--shy-brand-contrast);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--shy-brand-contrast); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border-strong);
}
.btn-danger:hover { background: var(--danger-light); border-color: var(--danger); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-alt); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.825rem; }
.btn-lg { padding: 0.65rem 1.5rem; font-size: 1rem; }

/* button_to renders a form — reset its default margins */
.btn-form { display: inline; margin: 0; }
.btn-form .btn { font-size: inherit; }

/* Shown to staff (non-admins) where an editor would see a save form. */
.dye-viewonly-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  margin: 0;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-stack { max-width: 36rem; }

.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.925rem;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}
.form-control::placeholder { color: var(--text-light); }

.form-control-sm { padding: 0.35rem 0.6rem; font-size: 0.875rem; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 4rem; }

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 8rem; }

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  background: var(--surface);
}
.form-section-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.form-section-header h3 { margin: 0; font-size: 0.95rem; }
.form-section-body { padding: 1.25rem; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.5rem; }

/* Error block */
.form-errors {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.form-errors strong { display: block; margin-bottom: 0.4rem; color: var(--danger); }
.form-errors ul { margin: 0; padding-left: 1.25rem; }
.form-errors li { color: var(--danger); }

/* ── Nested form rows (colors, recipe applications) ─────────────── */
.nested-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.nested-row:last-child { border-bottom: none; }

.nested-row-header {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}
.badge-neutral  { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge-top      { background: var(--chip-blue-bg, #e0f2fe); color: var(--chip-blue-fg, #0369a1); }
.badge-bottom   { background: var(--chip-pink-bg, #fce7f3); color: var(--chip-pink-fg, #9d174d); }
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }

/* ── Color swatch ───────────────────────────────────────────────── */
.color-swatch {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.15);
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Stat row (batch summary) ───────────────────────────────────── */
.dye-stat-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.dye-stat-item { }
.dye-stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.dye-stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* The same stats as a bordered table, two columns wide: it sits beside the
   diagram. The bucket count gets a row of its own, which pairs the two
   per-bucket measurements that follow it (citric acid, water). Cell borders
   are drawn on each cell's top/left and pulled 1px up and left, so they land
   on the outer border instead of doubling it. */
.dye-stat-row.dye-stat-row--table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  max-width: 28rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.dye-stat-row.dye-stat-row--table .dye-stat-item {
  margin: -1px 0 0 -1px;
  padding: 0.65rem 0.5rem;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  text-align: center;
}
.dye-stat-row.dye-stat-row--table .dye-stat-item--wide { grid-column: 1 / -1; }
@media print {
  .dye-stat-row.dye-stat-row--table { border-color: #000; background: none; }
  .dye-stat-row.dye-stat-row--table .dye-stat-item { border-color: #000; padding: 0.3rem 0.75rem; color: #000; }
  .dye-stat-row.dye-stat-row--table .dye-stat-label { color: #000; }
}

/* ── Color bucket card (calculate + log show) ───────────────────── */
.bucket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.bucket-header {
  padding: 0.875rem 1.25rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.bucket-header h2, .bucket-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.bucket-meta { color: var(--text-muted); font-size: 0.85rem; }
.bucket-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bucket-tag-tonal {
  background: var(--chip-green-bg, #e8f4e8);
  color: var(--chip-green-fg, #2d6a2d);
  border: 1px solid var(--chip-green-bd, #a8d5a8);
}

.bucket-water {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  background: var(--chip-green-bg, #f0fdf4);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.bucket-water strong { color: var(--primary); }
.bucket-split-badge {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  align-self: center;
}

/* ── Mix targets + weighing tolerance ──────────────────────────── */
.mix-target { font-weight: 600; }
.mix-tolerance {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
}
.mix-tolerance-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

/* ── Floor form (dye log entry — big inputs) ────────────────────── */
.floor-form .form-control {
  font-size: 1.1rem;
  padding: 0.6rem 0.875rem;
}

.floor-bucket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.floor-bucket-header {
  padding: 1rem 1.25rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.floor-bucket-header h3 { margin: 0; }

.floor-powder-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}
.floor-powder-row:last-child { border-bottom: none; }

.floor-powder-name { flex: 1; font-weight: 600; font-size: 1rem; min-width: 8rem; }

.floor-grams-input {
  width: 7rem;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}
.floor-grams-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}

/* ── Proportion warning ─────────────────────────────────────────── */
.proportion-warning { color: var(--warning); font-weight: 600; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state p { font-size: 1rem; margin-bottom: 1.25rem; }

/* ── Detail row (label + value pairs) ───────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: 0.5rem; }
.detail-item { display: flex; gap: 0.75rem; align-items: baseline; font-size: 0.9rem; }
.detail-label { font-weight: 600; width: 10rem; flex-shrink: 0; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Section divider ─────────────────────────────────────────────── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.75rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Print (floor sheet) ────────────────────────────────────────── */
@media print {
  /* @page moved to the host stylesheet -- it cannot be scoped to .engine-dye
     and so applied to every page in the app from here. The host default now
     carries these exact margins, so dye's printed sheets are unchanged. */

  .nav, .page-header-actions, .flash-container, .btn, .no-print { display: none !important; }
  body { background: white; font-size: 11pt; color: #000; }
  .main { padding: 0; max-width: none; }

  /* ── Dye sheet: compact bucket cards ── */
  .bucket-card {
    break-inside: avoid;
    border: 1px solid #999;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.6rem;
  }
  .bucket-header {
    padding: 0 0 0.2rem;
    border-bottom: 1px solid #ccc;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
  }
  .bucket-header h3 { font-size: 10.5pt; margin: 0; }
  .bucket-meta { font-size: 9pt; }
  .bucket-water { font-size: 9pt; gap: 0.75rem; padding: 0.2rem 0; }
  .bucket-split-badge {
    background: #fff !important;
    color: #000 !important;
    border: 1.25pt solid #000;
    border-radius: 3pt;
    font-size: 10pt;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
  }
  .bucket-tag, .bucket-tag-tonal { font-size: 8pt; padding: 0.1rem 0.3rem; }

  .data-table { font-size: 9pt; }
  .mix-tolerance { font-size: 8pt; }
  .mix-tolerance-note { font-size: 7.5pt; }
  .data-table th, .data-table td { padding: 0.2rem 0.4rem; }

  /* ── Stat row compact ── */
  .dye-stat-row { margin-bottom: 0.75rem !important; gap: 1.5rem; }
  .dye-stat-value { font-size: 1.4rem; }
  .dye-stat-label { font-size: 8pt; }

  /* ── Recipe notes box ── */
  .recipe-notes-print { font-size: 9pt; line-height: 1.5; margin-bottom: 0.75rem; }

  /* ── Recipe print layout: diagram right, steps 2-col left ── */
  .print-recipe-layout {
    display: flex;
    flex-direction: row-reverse;   /* diagram on right, steps on left */
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
  }
  .print-recipe-diagram {
    flex: 0 0 42%;
    max-width: 42%;
  }
  .print-recipe-steps {
    flex: 1;
    min-width: 0;
  }
  .print-recipe-steps .step-list {
    display: block;             /* grid on screen; columns below needs block */
    columns: 2;
    column-fill: auto;          /* fill left column first, overflow to right */
    column-gap: 0.75rem;
  }
  .print-recipe-steps .step-list-section {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }
  .print-recipe-steps .step-list-section-title {
    break-after: avoid;
    -webkit-column-break-after: avoid;
  }

  /* ── Diagram compact ── */
  .recipe-diagram { margin-bottom: 0.75rem; }
  .diagram-side-box { min-height: 60px; }
  .diagram-color-name { font-size: 8.5pt; }
  .diagram-section-sub, .diagram-section-pct { font-size: 7.5pt; }

  .section-title { font-size: 9pt; margin: 0.5rem 0 0.4rem; letter-spacing: 0.08em; }

  /* ── Recipe show: compact app cards ── */
  .app-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: 0.4rem;
  }
  .app-card {
    break-inside: avoid;
    border: 1px solid #999;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0;
  }
  .app-card-header { padding: 0 0 0.2rem; border-bottom: 1px solid #ccc; margin-bottom: 0.2rem; gap: 0.25rem; }
  .app-card-placements { gap: 0; }
  .app-card-placement-row { font-size: 8pt; gap: 0.25rem; }
  .app-card-side-label { font-size: 7.5pt; }
  .app-card-proportion { font-size: 8.5pt; }
  .app-card-color { padding: 0.15rem 0; gap: 0.3rem; }
  .app-card-color-name { font-size: 9.5pt; font-weight: 600; }
  .app-card-wog { font-size: 8pt; }
  .app-card-formula { gap: 0.2rem; margin-top: 0.2rem; }
  .app-card-powder { font-size: 8pt; gap: 0.25rem; }
  .app-card-powder-ratio { font-size: 7.5pt; }
  .color-swatch { width: 0.6rem; height: 0.6rem; }

  a { color: inherit; text-decoration: none; }
}

/* ── Toggle switch ──────────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 2.75rem; height: 1.5rem; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 1rem;
  cursor: pointer; transition: background 0.2s;
}
.toggle-track::before {
  content: ""; position: absolute;
  width: 1.1rem; height: 1.1rem;
  left: 0.2rem; top: 50%; transform: translateY(-50%);
  background: white; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::before { transform: translate(1.25rem, -50%); }

/* ── Recipe section (inline color builder) ──────────────────────── */
.app-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.app-section-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
}
.app-section-top input[type="text"] { flex: 1; min-width: 0; }
.app-section-color {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
}
.app-color-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.powder-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: nowrap;
}
.powder-row select {
  flex: 1;
  min-width: 0;
}
.powder-row input {
  width: 4.5rem;
  flex-shrink: 0;
}

/* ── Recipe palette + layout builder ──────────────────────────── */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.palette-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
}
.palette-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.palette-name-input { font-weight: 600; flex: 1; min-width: 0; }
.palette-remove { color: var(--danger); flex-shrink: 0; }

.layout-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.layout-add-row select { width: auto; min-width: 8rem; }

.layout-sides {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.layout-side { flex: 1; min-width: 14rem; }
.layout-side-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.layout-chip-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 3.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem;
}
.layout-chip {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab;
  overflow: hidden;
}
.chip-hill-bar {
  display: none;
  background: linear-gradient(to bottom, #7a5230, #5c3d1e);
  color: rgba(255,255,255,0.9);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 2px 2px 0 0 / 6px 6px 0 0;
}
.layout-chip.has-hill-before .chip-hill-bar { display: block; }
.chip-main-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
}
.chip-hill-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem;
  line-height: 1;
  color: var(--text-light);
  flex-shrink: 0;
  transition: color 0.15s;
}
.chip-hill-toggle:hover { color: #7a5230; }
.layout-chip.has-hill-before .chip-hill-toggle { color: #7a5230; }
.layout-chip.is-dragging { opacity: 0.4; }
.layout-chip.is-undyed {
  background: repeating-linear-gradient(
    -45deg,
    #f5f0e8,
    #f5f0e8 4px,
    #e8e0d0 4px,
    #e8e0d0 8px
  );
  border-style: dashed;
  color: #8a7d6a;
}
.layout-chip.is-spacer {
  background: repeating-linear-gradient(
    90deg,
    #e8edf5,
    #e8edf5 4px,
    #d0d8e8 4px,
    #d0d8e8 8px
  );
  border-style: dashed;
  color: #5a6a8a;
}
.layout-chip-handle { color: var(--text-light); flex-shrink: 0; }
.layout-chip-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-hover);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.layout-chip-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.layout-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 0.1rem 0.3rem;
  flex-shrink: 0;
}
.layout-chip-remove:hover { color: var(--danger); }

/* ── Recipe show: application cards ────────────────────────────── */
.app-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
}
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.app-card-placements {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.app-card-placement-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.875rem;
}
.app-card-side-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 3.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.app-card-side-items {
  color: var(--text);
  font-weight: 500;
}
.app-card-proportion {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}
.app-card-color {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.app-card-color-name {
  font-size: 1rem;
  font-weight: 500;
}
.app-card-wog {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.app-card-formula {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.app-card-powder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.app-card-powder-swatch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}
.app-card-powder-ratio {
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Badge extra statuses ───────────────────────────────────────── */
.badge-planned   { background: var(--chip-blue-bg, #dbeafe); color: var(--chip-blue-fg, #1e40af); }
.badge-mixing    { background: var(--chip-amber-bg, #fef3c7); color: var(--chip-amber-fg, #92400e); }
.badge-dyeing    { background: var(--chip-purple-bg, #ede9fe); color: var(--chip-purple-fg, #5b21b6); }
.badge-drop      { background: var(--chip-green-bg, #d1fae5); color: var(--chip-green-fg, #065f46); }
.badge-complete  { background: var(--chip-green-bg, #dcfce7); color: var(--chip-green-fg, #14532d); }
.badge-cancelled { background: var(--chip-grey-bg, #f3f4f6); color: var(--chip-grey-fg, #6b7280); }

/* ── Calendar ───────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-weekday-header {
  background: var(--surface);
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-cell {
  background: var(--bg);
  min-height: 7rem;
  padding: 0.35rem 0.4rem;
  position: relative;
}
.cal-cell.cal-other-month { background: var(--surface); }
.cal-cell.cal-today { background: var(--warning-light); }
.cal-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.cal-cell.cal-today .cal-day-num {
  background: var(--primary);
  color: #fff;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}
.cal-add-btn {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-light);
  text-decoration: none;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.cal-cell:hover .cal-add-btn,
.cal-week-day:hover .cal-add-btn { opacity: 1; }
.cal-add-btn:hover { background: var(--border); color: var(--text); }

/* Week view */
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-week-day {
  background: var(--bg);
  min-height: 12rem;
  padding: 0.5rem;
}
.cal-week-day.cal-today { background: var(--warning-light); }
.cal-week-day.cal-other-month { background: var(--surface); }
.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.cal-day-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Run chips on calendar */
.run-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.2rem;
  text-decoration: none;
  font-size: 0.72rem;
  line-height: 1.3;
  border-left: 3px solid transparent;
}
/* Phase-based chip colors */
.run-chip--mix     { background: var(--chip-amber-bg, #fef3c7); border-color: var(--chip-amber-bd, #f59e0b); color: var(--chip-amber-fg, #78350f); }
.run-chip--dye     { background: var(--chip-purple-bg, #ede9fe); border-color: var(--chip-purple-bd, #8b5cf6); color: var(--chip-purple-fg, #4c1d95); }
.run-chip--overdye { background: var(--chip-orange-bg, #fff7ed); border-color: var(--chip-orange-bd, #f97316); color: var(--chip-orange-fg, #7c2d12); }
/* Cancelled overrides phase color */
.run-chip--cancelled { background: var(--chip-grey-bg, #f3f4f6) !important; border-color: var(--chip-grey-bd, #9ca3af) !important; color: var(--chip-grey-fg, #6b7280) !important; text-decoration: line-through; }
.run-chip-phase { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.75; white-space: nowrap; flex-shrink: 0; }
.run-chip-name  { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-chip[draggable="true"] { cursor: grab; }
.run-chip.is-dragging { opacity: 0.4; }

/* Mix Sheet shortcut link in calendar day header */
.cal-mix-sheet-btn {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--chip-amber-bg, #fef3c7);
  color: var(--chip-amber-fg, #78350f);
  border: 1px solid var(--chip-amber-bd, #f59e0b);
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
}

/* Daily mix page */
.daily-mix-default-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--chip-amber-bg, #fef9c3);
  color: var(--chip-amber-fg, #854d0e);
  border: 1px solid var(--chip-amber-bd, #fde047);
  border-radius: 3px;
  vertical-align: middle;
}
/* The mix page prints as its own section of the daily Mix Sheet. */
.dye-print-only { display: none; }
@media print { .dye-print-only { display: block; } }
.daily-mix-recipe-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* Phase date pills (show page header + planning block) */
.run-phase-dates { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.phase-date-row  { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.25rem; }
.run-phase-date-pill {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  border: 1px solid transparent;
}
.run-phase-date-pill--mix     { background: var(--chip-amber-bg, #fef3c7); border-color: var(--chip-amber-bd, #f59e0b); color: var(--chip-amber-fg, #78350f); }
.run-phase-date-pill--dye     { background: var(--chip-purple-bg, #ede9fe); border-color: var(--chip-purple-bd, #8b5cf6); color: var(--chip-purple-fg, #4c1d95); }
.run-phase-date-pill--overdye { background: var(--chip-orange-bg, #fff7ed); border-color: var(--chip-orange-bd, #f97316); color: var(--chip-orange-fg, #7c2d12); }

/* Hint text under form fields */
.form-hint { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.cal-cell.drag-over, .cal-week-day.drag-over {
  background: var(--chip-blue-bg, #eff6ff);
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
}

/* ── Phase timeline ─────────────────────────────────────────────── */
.phase-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.phase-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.phase-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  opacity: 0.6;
}
.phase-block.phase-active {
  opacity: 1;
  border-color: var(--primary);
  background: var(--bg);
}
.phase-block.phase-done {
  opacity: 1;
  background: var(--bg);
}
.phase-block-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.phase-number-wrap {
  flex-shrink: 0;
}
.phase-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.phase-block.phase-active .phase-number {
  background: var(--primary);
  color: #fff;
}
.phase-block.phase-done .phase-number {
  background: #22c55e;
  color: #fff;
}
.phase-block-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}
.phase-edit-link {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  white-space: nowrap;
}
.phase-edit-link:hover { background: var(--primary); color: #fff; }
.phase-operator {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.phase-notes {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.phase-mix-summary {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.phase-color-row {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: 6px;
}
.phase-color-name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.phase-powders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.phase-powder-chip {
  font-size: 0.75rem;
  background: var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  color: var(--text-muted);
}
.cancelled-notice {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
}
.btn-group {
  display: flex;
  gap: 0;
}
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }

/* ── Print layout (hidden on screen) ────────────────────────────── */
.print-recipe-layout { display: none; }

/* ── Recipe diagram ─────────────────────────────────────────────── */
.recipe-diagram {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  max-width: 600px;
}
.diagram-tonal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
}
.diagram-tonal-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}
.diagram-tonal-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  text-align: center;
}
.diagram-tonal-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.diagram-sides {
  display: flex;
  gap: 1.25rem;
}

.diagram-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.diagram-side-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
}

.diagram-side-box {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  /* A real pan is 12.88" by 20.88", and the sections run down its LONG
     side, so the box is portrait: 12.88 across, 20.88 tall. It keeps that
     shape at any width instead of a fixed height. */
  aspect-ratio: 12.88 / 20.88;
}

.diagram-section {
  /* flex-grow comes from inline style; basis=0 so grow controls the full height */
  flex-basis: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-strong);
  text-align: center;
  gap: 0.1rem;
  overflow: hidden;
  min-height: 0;
}

.diagram-section:last-child { border-bottom: none; }
.diagram-hill {
  flex: 0 0 1.75rem;
  background: linear-gradient(to bottom, #8B5E3C 0%, #6B4423 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.diagram-hill::before {
  content: '';
  position: absolute;
  inset: 0 -20% auto;
  height: 150%;
  top: -75%;
  background: rgba(0,0,0,0.15);
  border-radius: 50%;
}
.diagram-hill span {
  position: relative;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
}
.diagram-section.is-undyed {
  background: repeating-linear-gradient(
    -45deg,
    #f5f0e8,
    #f5f0e8 5px,
    #e8e0d0 5px,
    #e8e0d0 10px
  );
  color: #8a7d6a;
}
.diagram-section.is-spacer {
  background: repeating-linear-gradient(
    90deg,
    #e8edf5,
    #e8edf5 5px,
    #d0d8e8 5px,
    #d0d8e8 10px
  );
  color: #5a6a8a;
}

.diagram-color-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.2;
}

.diagram-section-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.diagram-section-pct {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
  margin-top: 0.1rem;
}

.diagram-section-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-light);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Recipe status ───────────────────────────────────────────────── */
.recipe-status-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.recipe-status-badge--experimental { background: var(--chip-amber-bg, #fef3c7); border-color: var(--chip-amber-bd, #f59e0b); color: var(--chip-amber-fg, #78350f); }
.recipe-status-badge--retired       { background: var(--chip-grey-bg, #f3f4f6); border-color: var(--chip-grey-bd, #9ca3af); color: var(--chip-grey-fg, #4b5563); }

/* Mute experimental/retired cards slightly */
.recipe-card--experimental { opacity: 0.85; }
.recipe-card--retired      { opacity: 0.7; }
.recipe-card--retired .recipe-card-body h2 a { text-decoration: line-through; color: var(--text-muted); }

/* Status filter pills */
.recipe-status-pill--experimental { border-color: var(--chip-amber-bd, #f59e0b); color: var(--chip-amber-fg, #78350f); }
.recipe-status-pill--retired      { border-color: var(--chip-grey-bd, #9ca3af); color: var(--chip-grey-fg, #4b5563); }
.recipe-status-pill--experimental.tag-pill-active { background: var(--chip-amber-bg, #fef3c7); border-color: var(--chip-amber-bd, #f59e0b); }
.recipe-status-pill--retired.tag-pill-active      { background: var(--chip-grey-bg, #f3f4f6); border-color: var(--chip-grey-bd, #9ca3af); }

/* ── Dye Techniques ─────────────────────────────────────────────── */

/* Technique list (index) */
.technique-list { display: flex; flex-direction: column; gap: 0.75rem; }
.technique-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.technique-card-check { display: flex; align-items: center; flex-shrink: 0; padding-top: 0.1rem; }
.technique-card-check input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary); }
.technique-card-body { flex: 1; }
.technique-card-body h2 { margin: 0 0 0.25rem; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.technique-card-summary { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.technique-card-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.technique-category-pill { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 20px; padding: 0.1rem 0.5rem; }
.technique-list-header { display: flex; align-items: center; padding: 0.5rem 0 0.25rem; }
.technique-select-all-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.technique-select-all-label input[type="checkbox"] { accent-color: var(--primary); }
.technique-category-group { margin-bottom: 1.5rem; }
.technique-category-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0 0.4rem; border-bottom: 1px solid var(--border); margin-bottom: 0.5rem; }
.technique-category-name { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.bulk-action-bar { display: flex; align-items: center; gap: 0.75rem; background: var(--primary-light); border: 1px solid var(--primary); border-radius: var(--radius); padding: 0.6rem 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.bulk-action-count { font-size: 0.875rem; font-weight: 600; color: var(--primary-hover); white-space: nowrap; }
.bulk-category-input { flex: 1; min-width: 10rem; max-width: 18rem; height: 2rem; padding: 0.25rem 0.6rem; font-size: 0.875rem; }

/* Technique checkbox grid on recipe form */
.technique-checkbox-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.technique-checkbox-card {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  background: var(--bg);
  transition: border-color 0.1s, background 0.1s;
}
.technique-checkbox-card input[type="checkbox"] { display: none; }
.technique-checkbox-card:hover { border-color: var(--primary); }
.technique-checkbox-card.is-checked {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-weight: 600;
}
.technique-checkbox-name {}

/* Short-form preview below the checkbox grid */
.technique-preview-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.technique-preview-item {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.technique-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.technique-preview-text p { margin: 0.25rem 0 0; color: var(--text-muted); line-height: 1.5; }
.technique-preview-text p:first-child { margin-top: 0; }

/* Technique display on show/dye-step pages */
.technique-display-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.technique-display-item {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.technique-display-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.technique-display-name { font-size: 0.95rem; }
.technique-display-short p { margin: 0.25rem 0 0; color: var(--text-muted); line-height: 1.5; }
.technique-display-short p:first-child { margin-top: 0; }

/* Full instructions link */
.technique-full-link { font-size: 0.8rem; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.technique-full-link:hover { text-decoration: underline; }

/* Technique show page */
.technique-short-block {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.technique-short-text p { margin: 0.25rem 0 0; line-height: 1.6; }
.technique-short-text p:first-child { margin-top: 0; }
.technique-rich-body { max-width: 52rem; line-height: 1.7; }
.technique-rich-body :is(h1,h2,h3) { margin: 1.25rem 0 0.5rem; }
.technique-rich-body p { margin: 0.5rem 0; }
.technique-rich-body ul, .technique-rich-body ol { padding-left: 1.5rem; margin: 0.5rem 0; }

/* ── Dye step two-column layout ─────────────────────────────────── */
.dye-step-recipe-grid {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.dye-step-diagram-col  { flex: 1 1 50%; min-width: 0; }
.dye-step-techniques-col { flex: 1 1 50%; min-width: 0; }

/* ── Dye step layout: diagram | stats, then the steps full width ── */
.ds-top {
  display: grid;
  /* The diagram keeps half: any less and a pan-shaped box is too small to read. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.ds-top-diagram, .ds-top-side { min-width: 0; }
/* The stats sit level with the middle of the diagram, not its top edge. */
.ds-top-side { align-self: center; }
.ds-top-side .dye-stat-row { margin-bottom: 0 !important; }
.ds-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
/* Phones: everything stacks. Screen only: a printed sheet is narrow too,
   and keeps its columns. */
@media screen and (max-width: 640px) {
  .ds-top, .ds-steps { grid-template-columns: minmax(0, 1fr); }
  .ds-top-side .dye-stat-row { max-width: none; }
}

@media print {
  .no-print { display: none !important; }
  .recipe-diagram { break-inside: avoid; }
  .diagram-side-box { border-color: #000; }
  .diagram-section { border-bottom-color: #000; }
  /* Browsers drop backgrounds when printing, and the hill is nothing BUT a
     background, so on paper it's drawn as two rules instead. Text is pinned
     to black: printed from a dark-mode browser it would come out near-white. */
  /* margin-top: -1px sits the top rule over the section above's own 1px
     border — otherwise the two stack into a line thicker than the bottom one. */
  .diagram-hill { background: none; border-top: 2px solid #000; border-bottom: 2px solid #000; margin-top: -1px; }
  .diagram-hill::before { display: none; }
  .diagram-hill span { color: #000; }
  .diagram-color-name { color: #000; }

  /* Two-column recipe grid on dye step */
  .dye-step-recipe-grid {
    display: flex !important;
    gap: 1rem;
    align-items: flex-start;
    break-inside: avoid;
  }
  .dye-step-diagram-col  { flex: 0 0 48%; max-width: 48%; }
  .dye-step-techniques-col { flex: 0 0 48%; max-width: 48%; }

  /* Keep both grids' columns in print, tighter. */
  .ds-top { gap: 0.75rem; margin-bottom: 0.75rem; }
  .ds-steps { gap: 1.25rem; margin-bottom: 0; }
  .step-list-section { break-inside: avoid; }

  /* Compact diagram for print */
  .diagram-side-box { min-height: 0; }
  .diagram-section { padding: 0.2rem 0.4rem; }
  .diagram-color-name { font-size: 8pt; }
  .diagram-section-sub, .diagram-section-pct { font-size: 7pt; }

  /* Technique display in print */
  .technique-display-item { margin-bottom: 0.5rem; padding-bottom: 0.5rem; }
  .technique-display-short { font-size: 8pt; }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main { padding: 1.25rem 1rem 3rem; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .dye-stat-row { gap: 1rem; }
  .nav { padding: 0 1rem; }
  h1 { font-size: 1.4rem; }
  .hide-mobile { display: none; }
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .powder-row input { width: 3.5rem; }
  .app-section-top { flex-wrap: wrap; }
  .app-section-top input[type="text"] { flex-basis: 100%; order: -1; }
  .cal-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-cell { min-height: 4rem; padding: 0.2rem; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-week-day { min-height: 5rem; }
  .run-chip-status { display: none; }
  .btn-group { flex-wrap: wrap; }
}

/* ── Run history (recipe show) ───────────────────────────────────── */
.run-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.run-history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.run-history-item--cancelled { opacity: 0.6; }
.run-history-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.run-history-date {
  font-weight: 600;
  font-size: 0.9rem;
}
.run-history-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.run-history-notes {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.run-history-link {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  align-self: flex-start;
}
.run-history-link:hover { text-decoration: underline; }

/* ── Calendar context tabs ───────────────────────────────────────── */
.cal-context-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.cal-context-tab {
  padding: 0.35rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cal-context-tab:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border-strong);
}
.cal-context-tab.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cal-context-tab.drop-target {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
  transform: scale(1.06);
  transition: transform 0.1s;
}

/* ── Calendar "today" view ──────────────────────────────────────── */
.cal-today-date {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.today-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  max-width: 44rem;
}

.today-runs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.today-runs .run-chip {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.today-actions-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.today-empty {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

/* ── Run type toggle (scheduling form) ───────────────────────────── */
.run-type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}
.run-type-option {
  display: flex;
  align-items: center;
  padding: 0.45rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.run-type-option:last-child { border-right: none; }
.run-type-option input[type="radio"] { display: none; }
.run-type-option:hover { background: var(--surface-alt); color: var(--text); }
.run-type-option.is-active {
  background: var(--primary);
  color: #fff;
}

/* ── Lab chip modifier ───────────────────────────────────────────── */
.run-chip--lab {
  opacity: 0.85;
}
.run-chip-type-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0,0,0,0.18);
  color: #fff;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Mix sheet / header run-type badge ───────────────────────────── */
.run-type-header-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  vertical-align: middle;
  margin-left: 0.4rem;
}
.run-type-header-badge--production {
  background: var(--primary-light);
  color: var(--primary-hover);
}
.run-type-header-badge--lab {
  background: var(--chip-purple-bg, #ede9fe);
  color: var(--chip-purple-fg, #5b21b6);
}

/* ── Step builder — two-column layout ────────────────────────────── */
.step-builder-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  min-height: 18rem;
}

/* Sidebar */
.step-sidebar {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}
/* Phones: technique search above the steps, not beside them -- side by
   side left the steps a sliver of a column with buttons cut off. */
@media (max-width: 640px) {
  .step-builder-layout { flex-direction: column; align-items: stretch; }
  .step-sidebar { width: auto; position: static; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--border); }
  .step-section-header { flex-wrap: wrap; gap: 0.4rem; }
}
.step-sidebar-search {
  padding: 0.6rem 0.6rem 0.4rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.step-search-input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}
.step-search-input:focus { border-color: var(--primary); }

/* Category accordion */
.tech-category { border-bottom: 1px solid var(--border); }
.tech-category-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  transition: background 0.1s;
}
.tech-category-header:hover { background: var(--surface-alt, var(--border)); }
.tech-category-caret {
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform 0.15s;
  display: inline-block;
}
.tech-category:not(.is-open) .tech-category-caret { transform: rotate(-90deg); }
.tech-category-title { flex: 1; }
.tech-category-count {
  font-size: 0.72rem;
  opacity: 0.55;
  font-weight: 400;
}
.tech-category-body { display: none; padding: 0.25rem 0; }
.tech-category.is-open .tech-category-body { display: block; }

/* Technique items */
.tech-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0.4rem;
}
.tech-btn {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.3rem 0.2rem;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
  line-height: 1.3;
}
.tech-btn:hover {
  background: var(--primary-light, #e8f0fe);
  color: var(--primary);
}
.tech-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
  color: var(--border);
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s, transform 0.1s;
  border-radius: var(--radius-sm);
}
.tech-fav-btn:hover { color: #f59e0b; transform: scale(1.2); }
.tech-fav-btn.is-favorite { color: #f59e0b; }

/* Step main area */
.step-main {
  flex: 1;
  min-width: 0;
  padding: 0.75rem;
}
.step-active-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  transition: background 0.2s, border-color 0.2s;
}
.step-active-hint.is-flash {
  background: var(--chip-amber-bg, #fef9c3);
  border-color: var(--chip-amber-bd, #f59e0b);
}

/* Section blocks */
.step-section-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.step-section-block.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light, rgba(34,85,34,0.12));
}
.step-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.6rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.step-section-label { font-weight: 600; font-size: 0.875rem; }
.step-edit-btn { transition: color 0.1s; }
.step-edit-btn.is-editing { color: var(--primary); font-weight: 600; }
.step-copy-select { height: 1.75rem; font-size: 0.78rem; padding: 0 0.4rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; max-width: 10rem; }

/* Step rows */
.step-row-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem;
  min-height: 1.5rem;
}
.step-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: default;
}
.step-drag-handle {
  cursor: grab;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  flex-shrink: 0;
  user-select: none;
}
.step-drag-handle:active { cursor: grabbing; }
.step-row.is-dragging { opacity: 0.4; }
.step-row.drag-above { border-top: 2px solid var(--primary); }
.step-row.is-sub-step {
  margin-left: 1.5rem;
  border-left: 3px solid var(--primary);
}
.step-row-fields {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  flex-wrap: wrap;
}
.step-technique-select {
  flex: 0 0 auto;
  min-width: 8rem;
  max-width: 12rem;
  font-size: 0.82rem;
  padding: 0.25rem 0.4rem;
  height: auto;
}
.step-label-input {
  flex: 1;
  min-width: 8rem;
  font-size: 0.82rem;
  padding: 0.25rem 0.4rem;
  height: auto;
}
.step-color-input {
  flex: 0 0 7rem;
  font-size: 0.82rem;
  padding: 0.25rem 0.4rem;
  height: auto;
}
.step-sub-btn {
  font-size: 0.85rem;
  opacity: 0.3;
  padding: 0.15rem 0.4rem;
  flex-shrink: 0;
  transition: opacity 0.1s, color 0.1s;
}
.step-sub-btn.is-active { opacity: 1; color: var(--primary); }
.step-remove-btn { flex-shrink: 0; padding: 0.15rem 0.35rem; }

/* ── Step list display (show + dye step) ─────────────────────────── */
/* Sections sit side by side on screen -- a two-sided recipe is two short
   lists, and stacking them wasted the whole right half of the page. Falls to
   one column under ~40rem. Print overrides this back to `block` so its own
   `columns: 2` still applies; multi-column has no effect on a grid. */
/* The steps read like a small program: a fixed sequence, numbered lines,
   one level of nesting. So they're set as one -- monospace, a line-number
   gutter and a recessed panel, instead of a table of ruled rows. Sections
   sit side by side across the width (a two-sided recipe is two short lists)
   and fall to one column under about 40rem.

   Print overrides all of this: it resets the panel and the font, because the
   sheet has to keep fitting on one page and its own `columns: 2` has no
   effect on a grid. */
.step-list {
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: 0.25rem 2.5rem;
  align-items: start;

  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.65;
}
.step-list-section { margin-bottom: 0.5rem; min-width: 0; }
.step-list-section-title {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}
.step-list-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.12rem 0;
  border-bottom: none;
  font-size: inherit;
  line-height: inherit;
}
.step-list-row.is-sub-step { padding-left: 1.25rem; }
.step-list-num {
  min-width: 2.25rem;
  flex-shrink: 0;
  text-align: right;
  font-weight: 400;
  font-size: inherit;
  color: var(--text-muted);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.step-list-body { flex: 1; min-width: 0; }
.step-list-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.step-list-link:hover { border-bottom-color: currentColor; }
/* The colour a step pours reads as the one piece of data on the line --
   given the weight a string literal gets in a code listing. */
.step-list-color {
  color: var(--success);
  font-size: inherit;
}
.step-list-color.is-unresolved { color: var(--warning); font-style: italic; }

@media print {
  .step-list {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
  }
  .step-list-section-title { font-size: 0.75rem; letter-spacing: 0.06em; border-bottom: none; }
  .step-list-row { border-bottom: 1px solid var(--border); padding: 0.3rem 0; gap: 0.5rem; }
  .step-list-row:last-child { border-bottom: none; }
  .step-list-num { min-width: 2rem; text-align: left; font-weight: 600; opacity: 1; }
  .step-list-color { color: var(--text-muted); }
}

/* ── Recipe version history ─────────────────────────────────────── */
.version-timeline { display: flex; flex-direction: column; gap: 0.75rem; }

.version-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.version-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.version-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.version-event {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}
.version-event--create { background: var(--success-light); color: var(--success); }
.version-event--update { background: var(--warning-light); color: var(--warning); }
.version-event--destroy { background: var(--danger-light);  color: var(--danger);  }

.version-timestamp { font-size: 0.875rem; color: var(--text-muted); }
.version-who { font-size: 0.875rem; color: var(--text-muted); }

.version-summary {
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.875rem;
}

.version-summary-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.version-summary-pill--experimental { background: var(--warning-light); color: var(--warning); border-color: transparent; }
.version-summary-pill--retired      { background: var(--danger-light);  color: var(--danger);  border-color: transparent; }

.version-summary-item {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.version-summary-item::before { content: "·"; margin-right: 0.4rem; }

/* Detail panel — hidden by default, toggled via .is-open */
.version-detail { display: none; padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
.version-card.is-open .version-detail { display: block; }
.version-card.is-open .version-toggle-btn { color: var(--primary); }

.version-detail-section { margin-bottom: 0.9rem; }
.version-detail-section:last-child { margin-bottom: 0; }
.version-detail-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.version-detail-value { font-size: 0.875rem; }

.version-detail-row {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.version-detail-row:last-child { border-bottom: none; }

.version-detail-side  { font-weight: 600; min-width: 3.5rem; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.version-detail-type  { min-width: 4rem; color: var(--text-muted); font-size: 0.8rem; }
.version-detail-color { flex: 1; }

.version-detail-steps-section { margin-bottom: 0.5rem; }
.version-detail-steps-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.version-step-num { font-weight: 600; min-width: 1.5rem; color: var(--text-muted); font-size: 0.8rem; }

/* ── Drop stats (run phase 4) ────────────────────────────────────── */
.dye-drop-grid { margin-bottom: 1rem; }
.dye-drop-grid .data-table td:last-child { text-align: left; }
.dye-drop-grid .data-table th:last-child { text-align: left; }
.dye-drop-grid .form-control { max-width: 9rem; }
.dye-drop-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.dye-drop-chip {
  display: inline-flex;
  gap: 0.3rem;
  align-items: baseline;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  white-space: nowrap;
}
.dye-drop-chip strong { color: var(--text); font-weight: 600; }
.dye-drop-chip--batch { color: var(--text); font-weight: 600; }

/* ── Explore ─────────────────────────────────────────────────────── */
.dye-explore-filter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.dye-explore-filter-label {
  min-width: 5.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.dye-explore-help { margin: 0 0 1.5rem; max-width: 48rem; }
.dye-explore-group { margin-bottom: 2rem; }
.dye-explore-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}
.dye-explore-count { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.dye-explore-scroll { overflow-x: auto; }
.dye-explore-table { min-width: 52rem; }
.dye-explore-table td { vertical-align: top; }
.dye-explore-table td:last-child { text-align: left; }
.dye-explore-table th:last-child { text-align: left; }
.dye-explore-table .dye-drop-summary { margin-top: 0; }
.dye-explore-name { font-weight: 600; color: var(--text); text-decoration: none; }
.dye-explore-name:hover { text-decoration: underline; }
.dye-explore-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ── Shopify product (recipe show page + recipe cards) ──────────── */
.dye-shopify-card { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; max-width: 32rem; }
.dye-shopify-gallery { width: 100%; }
.dye-shopify-main { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.dye-shopify-body { min-width: 0; }
.dye-shopify-title { display: flex; flex-direction: column; margin-bottom: 0.5rem; font-weight: 600; }
.dye-shopify-title .form-hint { margin: 0; font-weight: 400; }
.dye-shopify-description { font-size: 0.9rem; line-height: 1.6; color: var(--text-muted); }
.dye-shopify-description p { margin: 0 0 0.5rem; }
.dye-shopify-description p:last-child { margin-bottom: 0; }

.dye-recipe-card-image { display: block; overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.dye-recipe-card-image img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

/* Card footer: name on the left, Schedule Run on the right. margin-top:auto
   pins it to the bottom when a neighbouring card in the row is taller. */
.dye-recipe-card-footer { margin-top: auto; padding: 0.85rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.dye-recipe-card-footer .btn { flex-shrink: 0; }
.dye-recipe-card-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.dye-recipe-card-title h2 { font-size: 1.1rem; margin: 0; }
.dye-recipe-card-title h2 a { color: var(--text); }
.dye-recipe-card-title h2 a:hover { color: var(--primary); text-decoration: none; }
.recipe-card--retired .dye-recipe-card-title h2 a { text-decoration: line-through; color: var(--text-muted); }

/* Two cards across on a phone is ~170px each: stack the name over a
   full-width Schedule Run rather than squeezing them onto one line. */
@media (max-width: 640px) {
  .dye-recipe-card-footer { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0.6rem 0.7rem 0.7rem; }
  .dye-recipe-card-footer .btn { justify-content: center; text-align: center; }
  .dye-recipe-card-title h2 { font-size: 0.95rem; overflow-wrap: anywhere; }
}

/* Recipe page gallery thumbnails (dye--shopify-gallery). */
.dye-shopify-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr)); gap: 0.4rem; margin-top: 0.5rem; }
.dye-shopify-thumb { display: block; padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); background: none; cursor: pointer; overflow: hidden; line-height: 0; }
.dye-shopify-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; opacity: 0.65; transition: opacity 0.15s; }
.dye-shopify-thumb:hover img, .dye-shopify-thumb[aria-pressed="true"] img { opacity: 1; }
.dye-shopify-thumb[aria-pressed="true"] { border-color: var(--primary); }
.dye-shopify-thumb:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Recipe page top: shop product left, diagram right ──────────── */
.dye-recipe-top { display: grid; gap: 1.5rem; align-items: start; margin-bottom: 1.75rem; }
.dye-recipe-top .recipe-diagram { margin-bottom: 0; }
/* Wide enough for a 26rem card beside the diagram (which caps at 600px)
   once the sidebar has taken its share. Below that, they stack. */
@media (min-width: 1100px) {
  .dye-recipe-top--split { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); }
}

/* ── Read more (dye/shared/_read_more) ──────────────────────────── */
.dye-readmore:not([data-expanded]) .dye-readmore-full,
.dye-readmore[data-expanded] .dye-readmore-excerpt { display: none; }
.dye-readmore-toggle { margin-top: 0.35rem; padding: 0; border: 0; background: none; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--primary); cursor: pointer; }
.dye-readmore-toggle:hover { text-decoration: underline; }
.dye-recipe-notes { margin-top: 0.25rem; font-size: 0.9rem; line-height: 1.6; color: var(--text-muted); }
/* pre-wrap on the TEXT only: on the wrapper it would also keep the
   template's indentation between the excerpt, full text and button. */
.dye-recipe-notes:not(.dye-readmore), .dye-recipe-notes .dye-readmore-full { white-space: pre-wrap; }
@media print {
  .dye-readmore .dye-readmore-full { display: block !important; }
  .dye-readmore .dye-readmore-excerpt, .dye-readmore-toggle { display: none !important; }
}

/* ── Dye methods (shared instruction sets) ──────────────────────── */
/* .step-list-color.is-unresolved lives with the rest of the step list. */

.method-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.9rem;
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  font-size: 0.9rem;
}

.method-warning {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.9rem;
  border: 1px solid var(--warning, #b8860b);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--warning, #b8860b) 10%, transparent);
  font-size: 0.9rem;
}
.method-warning ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.dye-method-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 860px) {
  .dye-method-columns { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}

.dye-method-card {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
}
.dye-method-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.dye-method-card h3 a { color: inherit; text-decoration: none; }
.dye-method-card h3 a:hover { text-decoration: underline; }
.dye-method-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.dye-method-meta { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.dye-method-recipes { list-style: none; margin: 0; padding: 0; }
.dye-method-recipes li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.dye-method-recipes li:last-child { border-bottom: none; }

.dye-badge-muted {
  background: var(--surface-alt, var(--surface));
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.dye-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

/* ── Copy / paste steps ─────────────────────────────────────────── */
.step-list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.step-list-head .section-title { flex: 1 1 auto; }

.step-copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
}
.step-copy-btn:hover { color: var(--text); border-color: var(--border); background: var(--surface-alt); }
.step-copy-btn:focus-visible { outline: 2px solid var(--primary, var(--text)); outline-offset: 2px; }
.step-copy-btn svg { width: 1.05rem; height: 1.05rem; }
.step-copy-btn .step-copy-done { display: none; }
.step-copy-btn.is-copied { color: var(--success); }
.step-copy-btn.is-copied .step-copy-icon { display: none; }
.step-copy-btn.is-copied .step-copy-done { display: block; }
.step-copy-btn.is-failed { color: var(--danger); }

.step-paste { margin: 0 1rem 1rem; }
.step-paste > summary {
  cursor: pointer; font-size: 0.88rem; font-weight: 600;
  color: var(--text-muted); padding: 0.35rem 0;
}
.step-paste > summary:hover { color: var(--text); }
.step-paste-body {
  padding: 0.6rem 0 0;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.step-paste-body textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85rem; }
.step-paste-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.step-paste-result { font-size: 0.83rem; color: var(--success, var(--text-muted)); }
.step-paste-result.is-error { color: var(--danger); }

/* ── Recipe tutorial video ──────────────────────────────────────── */

.dye-recipe-video { max-width: 48rem; margin: 1.5rem 0; }
.dye-recipe-video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius, 6px);
  overflow: hidden;
}
.dye-recipe-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.dye-recipe-video__link { margin: 0.4rem 0 0; font-size: 0.85rem; }
.dye-recipe-video__url { display: none; }
@media print {
  .dye-recipe-video { margin: 0.5rem 0; }
  .dye-recipe-video__link a { display: none; }
  .dye-recipe-video__url { display: inline; }
}

/* The product photo doubles as the tutorial's play button. */
.dye-video-trigger {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
}
.dye-video-trigger__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  padding-left: 0.2rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  transform: translate(-50%, -50%);
  transition: background 0.15s, transform 0.15s;
}
.dye-video-trigger:hover .dye-video-trigger__play,
.dye-video-trigger:focus-visible .dye-video-trigger__play {
  background: var(--primary);
  transform: translate(-50%, -50%) scale(1.08);
}
.dye-video-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Portrait: the tutorials are YouTube Shorts. The frame's width is worked out
   from the viewport height so the whole 9:16 player fits on screen. */
.dye-video-dialog {
  width: fit-content;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 10px);
  background: var(--surface);
  color: var(--text);
}
.dye-video-dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
/* Lock the page behind an open player. The document is what scrolls (the
   shell has no inner scroller), so html is the one to freeze. */
html:has(.dye-video-dialog[open]) { overflow: hidden; }
.dye-video-dialog { overscroll-behavior: contain; }
.dye-video-dialog__frame {
  position: relative;
  width: min(calc(100vw - 3.5rem), calc((100vh - 7rem) * 9 / 16));
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: var(--radius, 6px);
  overflow: hidden;
}
.dye-video-dialog__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.dye-video-dialog__frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.dye-video-dialog__frame [hidden] { display: none; }
.dye-video-dialog__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
}
.dye-video-dialog__bar span { flex: 1; min-width: 0; }
.dye-video-dialog__bar a { font-size: 0.85rem; font-weight: 400; }
/* Dye → Videos: the camera's landscape clips. */
.dye-video-dialog--wide .dye-video-dialog__frame {
  width: min(calc(100vw - 3.5rem), calc((100vh - 8rem) * 16 / 9));
  aspect-ratio: 16 / 9;
}

/* ── Photos (the Pending page) ──────────────────────────────────── */
.dye-photo-intro { max-width: 44rem; margin-top: 0.35rem; }
.dye-photo-h2 { font-size: 1.1rem; margin: 0 0 0.25rem; }
.dye-photo-h3 { font-size: 1rem; margin: 0; }
.dye-photo-upload { padding: 1rem; margin-bottom: 1.5rem; }
.dye-photo-upload-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.dye-photo-upload-row .form-control { flex: 1 1 16rem; }
.dye-photo-upload-status:empty { display: none; }
.dye-photo-upload-status { margin: 0.75rem 0 0.25rem; font-weight: 600; }
.dye-photo-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.25rem 1rem; font-size: 0.8rem; }
.dye-photo-progress li { display: flex; align-items: center; gap: 0.5rem; }
.dye-photo-progress li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dye-photo-progress progress { width: 5rem; }
.dye-photo-progress li[data-state="done"] { color: var(--shy-success); }
.dye-photo-progress li[data-state="failed"] { color: var(--shy-danger); }

.dye-photo-shoot { display: block; margin-bottom: 2rem; }
.dye-photo-shoot-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  border-bottom: 1px solid var(--shy-border); padding-bottom: 0.5rem; margin-bottom: 1rem; scroll-margin-top: 5rem; }
.dye-photo-working { color: var(--shy-text-muted); }
.dye-photo-alert { background: var(--shy-danger-tint); color: var(--shy-danger); border-radius: var(--shy-radius-sm); padding: 0.4rem 0.6rem; }
.dye-photo-flag { background: var(--shy-warning-tint); color: var(--shy-text); border-left: 3px solid var(--shy-warning);
  border-radius: var(--shy-radius-sm); padding: 0.4rem 0.6rem; margin: 0.5rem 0; font-size: 0.875rem; }

.dye-photo-sitting { background: var(--shy-surface); border: 1px solid var(--shy-border); border-radius: var(--shy-radius);
  padding: 1rem; margin-bottom: 1rem; scroll-margin-top: 5rem; }
.dye-photo-sitting.is-flagged { border-color: var(--shy-warning); }
.dye-photo-sitting-header { margin-bottom: 0.75rem; }
.dye-photo-fields { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.dye-photo-fields .form-label { display: flex; flex-direction: column; gap: 0.25rem; flex: 1 1 14rem; max-width: 24rem; }

.dye-photo-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.75rem; }
.dye-photo-tile { display: flex; flex-direction: column; gap: 0.35rem; }
.dye-photo-preview { margin: 0; }
.dye-photo-preview img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--shy-radius-sm);
  background: var(--shy-surface-sunken); }
.dye-photo-preview figcaption { font-size: 0.75rem; margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dye-photo-tile-form { display: flex; gap: 0.35rem; }
.dye-photo-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.dye-photo-discard { margin-left: auto; }
.dye-photo-loose { margin-bottom: 1rem; }
.dye-photo-loose .dye-photo-h3 { margin-bottom: 0.5rem; }
.dye-photo-approved-frame { display: block; }
.dye-photo-approved { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.dye-photo-approved li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.dye-photo-approved .dye-photo-alert { flex-basis: 100%; margin: 0; }
.dye-photo-h3 .form-hint { display: inline; font-weight: normal; }

/* ── Photos: a colorway's cards, and the fine-tune screen ───────── */
.dye-photo-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; }
.dye-photo-card { display: flex; flex-direction: column; gap: 0.4rem; scroll-margin-top: 5rem; }
.dye-photo-card .dye-photo-preview img,
.dye-photo-card-blank { aspect-ratio: 1; object-fit: cover; }
.dye-photo-card-blank { width: 100%; border-radius: var(--shy-radius-sm); background: var(--shy-surface-sunken); }
.dye-photo-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; white-space: normal; font-size: 0.85rem; }

.dye-crop { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.dye-crop-stage { flex: 1 1 20rem; max-width: 34rem; }
.dye-crop-viewport { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: var(--shy-radius);
  background: var(--shy-surface-sunken); cursor: grab; touch-action: none; outline-offset: 3px; }
.dye-crop-viewport:active { cursor: grabbing; }
.dye-crop-viewport img { position: absolute; max-width: none; user-select: none; pointer-events: none; }
.dye-crop-controls { flex: 1 1 16rem; display: flex; flex-direction: column; gap: 1rem; max-width: 22rem; }
.dye-crop-controls .form-label { display: flex; flex-direction: column; gap: 0.35rem; }
.dye-crop-range { width: 100%; }
.dye-crop-turns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.dye-crop-now img { width: 9rem; aspect-ratio: 1; }
.dye-photo-links { margin: 0.5rem 0 0; font-size: 0.875rem; }

/* ── Photos: replacing single photos ──────────────────────────── */
.dye-photo-card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: flex-start; }
.dye-photo-single { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.dye-photo-single-button { position: relative; cursor: pointer; }
/* The real file input fills its button, invisibly, so the whole button opens the picker. */
.dye-photo-single-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dye-photo-single-input:disabled { cursor: progress; }
.dye-photo-single .dye-photo-upload-status { margin: 0; font-size: 0.8rem; }
.dye-photo-single-progress { grid-template-columns: 1fr; }
.dye-photo-single-progress li span { display: none; }
.dye-photo-layout { display: flex; align-items: flex-end; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.dye-photo-layout .form-label { display: flex; flex-direction: column; gap: 0.25rem; }
.dye-photo-library .dye-photo-cards { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.dye-photo-panels { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; scroll-margin-top: 5rem; }
.dye-photo-panels [aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.dye-crop-stage .dye-crop-viewport { margin-inline: auto; }

/* ── Shopify sends ─────────────────────────────────────────────── */
.dye-shopify-preview .data-table { width: 100%; margin-bottom: 1rem; }
.dye-shopify-note-row td { border-top: none; padding-top: 0; }
.dye-shopify-note-row .form-label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: normal; }
.dye-shopify-log { margin: 1rem 0; padding-left: 1.25rem; display: grid; gap: 0.35rem; }
.dye-shopify-log .is-failed { color: var(--shy-danger); }
.dye-mono { font-family: var(--shy-font-mono); font-size: 0.8rem; }

/* Videos (Dye → Videos): the card dock's videos, with a frame, what was
   said, and a colorway picker each. */
.dye-dock-status { margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.dye-videos { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.75rem; }
.dye-video { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 0.75rem;
  border: 1px solid var(--shy-border); border-radius: var(--shy-radius); background: var(--shy-surface); }
.dye-video-poster { aspect-ratio: 16 / 9; border-radius: var(--shy-radius-sm); overflow: hidden; background: var(--shy-surface-sunken); }
.dye-video-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.dye-video-poster { display: block; width: 100%; padding: 0; border: 0; font: inherit; color: inherit; }
.dye-video-poster .dye-video-trigger__play { width: 2.75rem; height: 2.75rem; }
.dye-video-body { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.dye-video-body p { margin: 0; }
.dye-video-title strong { overflow-wrap: anywhere; }
.dye-video-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.dye-video-form select { max-width: 22rem; }
@media (max-width: 640px) {
  .dye-video { grid-template-columns: 1fr; }
}

/* Prep in CapCut (prep_jobs/index): every filed clip by colorway, then run,
   to tick; the bar to queue them; the prep jobs below. */
.dye-prep-search { margin: 0 0 1rem; max-width: 24rem; }
.dye-prep-form { margin: 0 0 1.75rem; }
.dye-prep-tick { width: 1.15rem; height: 1.15rem; flex: none; margin: 0; accent-color: var(--shy-brand); cursor: pointer; }
.dye-prep-colorway { margin: 0 0 0.75rem; border: 1px solid var(--shy-border); border-radius: var(--shy-radius); background: var(--shy-surface); }
.dye-prep-colorway > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; padding: 0.7rem 0.9rem; cursor: pointer; }
.dye-prep-colorway__name { font-weight: 600; }
.dye-prep-colorway[open] > summary { border-bottom: 1px solid var(--shy-border); }
.dye-prep-run { padding: 0.7rem 0.9rem; }
.dye-prep-run + .dye-prep-run { border-top: 1px dashed var(--shy-border); }
.dye-prep-run__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; margin: 0 0 0.6rem; cursor: pointer; }
.dye-prep-clips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; }
.dye-prep-clip { position: relative; display: flex; flex-direction: column; gap: 0.35rem; padding: 0.4rem; cursor: pointer;
  border: 1px solid var(--shy-border); border-radius: var(--shy-radius-sm); background: var(--shy-surface-alt); }
.dye-prep-clip:has(input:checked) { border-color: var(--shy-brand); background: var(--shy-brand-tint); }
.dye-prep-clip .dye-prep-tick { position: absolute; top: 0.7rem; left: 0.7rem; z-index: 1; }
.dye-prep-clip__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; font-size: 0.9rem; }
.dye-prep-clip__meta .form-hint { flex-basis: 100%; overflow-wrap: anywhere; }
.dye-prep-bar { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem 1rem;
  padding: 0.75rem 0; border-top: 1px solid var(--shy-border); background: var(--shy-bg); }
.dye-prep-bar__count { color: var(--shy-text-muted); font-size: 0.9rem; }
.dye-prep-jobs { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.75rem; }
.dye-prep-job { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.75rem 0.9rem;
  border: 1px solid var(--shy-border); border-radius: var(--shy-radius); background: var(--shy-surface); }
.dye-prep-job p { margin: 0; overflow-wrap: anywhere; }
.dye-prep-job__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }
.dye-prep-job__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
@media (max-width: 640px) {
  .dye-prep-clips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dye-prep-run, .dye-prep-colorway > summary { padding-left: 0.7rem; padding-right: 0.7rem; }
}

/* Prep in CapCut's version gate: the workstation header and a test run's report. */
.dye-prep-workstation { margin: 0 0 1rem; }
.dye-prep-workstation .dye-dock-status { margin-bottom: 0.25rem; }
.dye-prep-workstation p { overflow-wrap: anywhere; }
.dye-test-report { margin: 0 0 1.5rem; padding: 0.75rem; max-height: 32rem; overflow: auto;
  font-family: var(--shy-font-mono); font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere;
  border: 1px solid var(--shy-border); border-radius: var(--shy-radius); background: var(--shy-surface-sunken); }

/* Dye → Settings: the Prep in CapCut video logo (a white wordmark, so on the nav's dark colour). */
.dye-studio-logo { max-width: 24rem; margin: 0.25rem 0 0.5rem; padding: 0.75rem; border-radius: var(--shy-radius); background: var(--shy-nav-bg); }
.dye-studio-logo img { display: block; width: 100%; height: auto; }
