:root {
  --paper: #f3efe6;
  --ink: #14264e;
  --accent: #005cff;
  --accent-soft: #2c74ff;
  --panel: #fffdf7;
  --line: rgba(20, 38, 78, 0.14);
  --soft: rgba(0, 92, 255, 0.08);
  --soft-strong: rgba(0, 92, 255, 0.14);
  --radius: 0.6rem;
  --success: #1d7a43;
  --warn: #9a6b11;
  --danger: #9b2b2b;
  /* WCAG 2.1 AA minimum touch target — tablet-first operator surface. */
  --touch: 44px;

  /* Control band geometry */
  --band-gap: 0.5rem;
  --strip-pad: 0.8rem 1rem;
  --expand-pad: 0.6rem 1rem;

  /* Status colors */
  --status-pending: #8899AA;
  --status-generating: #F0A500;
  --status-ready: #1DB954;
  --status-failed: #E53E3E;

  /* Table */
  --cluster-header-bg: rgba(20, 38, 78, 0.04);
  --row-hover: rgba(20, 38, 78, 0.03);
  --row-selected: rgba(0, 92, 255, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(0, 92, 255, 0.10), transparent 20rem),
    linear-gradient(180deg, #f8f5ed 0%, var(--paper) 100%);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Touch-target baseline (≥ --touch) ────────────────────
 * Applies a single floor to every primary interactive control.
 * Later rules may add padding/typography but must not shrink below
 * --touch. Tune --touch in :root to scale the whole surface. */
.slug-btn,
.url-btn,
.url-input,
.advanced-grid input {
  min-height: var(--touch);
}

.advanced summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

.chip span,
.seg-opt span {
  min-height: var(--touch);
  box-sizing: border-box;
}

.seg-opt span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Swatch keeps its 24px visual circle but the label expands to --touch
 * so the tap hit-area meets WCAG without resizing the swatch art. */
.swatch {
  min-width: var(--touch);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Studio layout ──────────────────────────────────── */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0.9rem;
  align-items: start;
  margin-bottom: 0.75rem;
}

/* ── Control band ───────────────────────────────────── */
.control-band {
  display: flex;
  flex-direction: column;
  gap: var(--band-gap);
}

/* ── Strip ──────────────────────────────────────────── */
.strip {
  position: relative;
  background: #fff;
  border: 1px solid rgba(20, 38, 78, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 38, 78, 0.06);
}

/* Left accent line — lights up on hover/focus */
.strip::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: transparent;
  transition: background 150ms;
  z-index: 1;
}
.strip:hover::before,
.strip:has(input:focus-visible)::before {
  background: var(--accent);
}

/* ── Strip heading (panel title) ──────────────────────── */
.strip-heading {
  padding: 0.65rem 1rem 0.5rem;
  border-bottom: 1px solid rgba(20, 38, 78, 0.06);
}

.strip-heading-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0;
}

.strip-heading-copy {
  font-size: 0.68rem;
  color: rgba(20, 38, 78, 0.45);
  margin: 0.15rem 0 0;
  line-height: 1.35;
}

.seg--compact {
  font-size: 0.75rem;
}

/* ── Tier 1: Hero zone (logo cards + shape) ──────────── */
.tier-hero {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(20, 38, 78, 0.06);
}

.tier-hero-grid {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.tier-hero-logos {
  flex: 1;
  min-width: 0;
}

.tier-hero-shape {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 1rem;
  border-left: 1px solid rgba(20, 38, 78, 0.08);
}


/* ── Shape swatches (visual icons) ───────────────────── */
.shape-swatches {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
}

.shape-swatch {
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.shape-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shape-swatch-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms, box-shadow 150ms;
}

.shape-swatch:hover .shape-swatch-art {
  border-color: var(--accent-soft);
}

.shape-swatch input:checked + .shape-swatch-art {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

.shape-swatch-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(20, 38, 78, 0.55);
}

/* ── Logo variant cards ──────────────────────────────── */
.logo-variants {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.logo-variant-card {
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.logo-variant-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.logo-variant-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--logo-bg, #fffdf7);
  transition: border-color 150ms, box-shadow 150ms;
  overflow: hidden;
}

.logo-variant-art img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  object-position: center;
}

.logo-variant-art--light {
  border-color: var(--line);
}

.logo-variant-card:hover .logo-variant-art {
  border-color: var(--accent-soft);
}

.logo-variant-card input:checked + .logo-variant-art {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

.logo-variant-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: rgba(20, 38, 78, 0.55);
  max-width: 80px;
  line-height: 1.2;
}

/* Background per variant — ensures contrast for all logo colors */
.logo-variant-art--nimbis       { --logo-bg: #fffdf7; }
.logo-variant-art--blue         { --logo-bg: #f0f4ff; }
.logo-variant-art--white-on-blue { --logo-bg: #14264E; }
.logo-variant-art--white        { --logo-bg: #14264E; }
.logo-variant-art--black        { --logo-bg: #f0f4ff; }
.logo-variant-art--navy         { --logo-bg: #f0f4ff; }
.logo-variant-art--none         { --logo-bg: rgba(20, 38, 78, 0.04); }

/* QR color pairing indicator — thin bottom accent bar */
.logo-variant-art[style*="--logo-pair"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 4px;
  right: 4px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--logo-pair);
}

/* White pair needs a subtle outline to be visible */
.logo-variant-art--nimbis::after {
  box-shadow: inset 0 0 0 0.5px rgba(20, 38, 78, 0.15);
}

.logo-none-x {
  font-size: 1.4rem;
  color: rgba(20, 38, 78, 0.25);
  font-weight: 300;
}

/* Dim state for poor-contrast combos */
.logo-variant-card--dim .logo-variant-art {
  opacity: 0.3;
}

.logo-variant-card--dim .logo-variant-label {
  text-decoration: line-through;
  opacity: 0.4;
}

/* ── Tier 2 & 3: Disclosure sections ─────────────────── */
.tier-customize,
.tier-advanced {
  border-top: 1px solid rgba(20, 38, 78, 0.06);
}

.tier-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(20, 38, 78, 0.45);
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

.tier-summary::-webkit-details-marker {
  display: none;
}

.tier-summary::before {
  content: '\25B8';
  font-size: 0.6rem;
  margin-right: 0.5rem;
  transition: transform 150ms;
}

details[open] > .tier-summary::before {
  transform: rotate(90deg);
}

.tier-customize[open],
.tier-advanced[open] {
  padding-bottom: 0.5rem;
}

.tier-customize .paired-grid,
.tier-advanced .paired-grid {
  padding-top: 0;
}

/* ── Paired-row grid: left swatches, right controls ── */
.paired-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem 1rem 0.65rem;
}

.paired-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
}

.paired-row > .channel {
  flex: 1 1 0;
  min-width: 0;
}

/* Explicit [hidden] overrides — flex display would otherwise win */
.paired-row[hidden],
.channel[hidden] {
  display: none;
}

.paired-row--triple > .channel {
  flex: 1 1 0;
}

.paired-row:not(:first-child) {
  border-top: 1px solid rgba(20, 38, 78, 0.05);
}

/* ── Channel: control on top, label below ──────────── */
.channel-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: var(--strip-pad);
}

.channel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.channel--wide {
  flex: 1;
}

.channel-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(20, 38, 78, 0.45);
  white-space: nowrap;
}

.channel-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(20, 38, 78, 0.35);
}

/* ── Logo swatches (visual variant picker) ─────────── */
.logo-swatches {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.35rem;
}

.logo-swatch {
  cursor: pointer;
  position: relative;
}

.logo-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.logo-swatch-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  font-size: 0.7rem;
  font-weight: 700;
  transition: border-color 150ms, box-shadow 150ms;
}

.logo-swatch input:checked + .logo-swatch-art {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

.logo-swatch:hover .logo-swatch-art {
  border-color: var(--accent-soft);
}

.logo-swatch.is-disabled {
  cursor: not-allowed;
}

.logo-swatch.is-disabled .logo-swatch-art {
  opacity: 0.45;
  filter: grayscale(0.2);
  box-shadow: none;
}

/* Variant art styles */
.logo-swatch--none {
  background: rgba(20, 38, 78, 0.06);
  color: rgba(20, 38, 78, 0.4);
  font-size: 0.6rem;
  font-weight: 600;
}

.logo-swatch--auto {
  background: linear-gradient(135deg, #f0f0f0, #e0e8f5);
  color: var(--accent);
}

.logo-swatch--nimbis {
  background: linear-gradient(135deg, #14264E 0 52%, #005CFF 52% 100%);
  color: #FFFFFF;
}

.logo-swatch--blue {
  background: #fff;
  color: #005CFF;
}

.logo-swatch--white {
  background: #14264E;
  color: #fff;
}

.logo-swatch--wblue {
  background: #005CFF;
  color: #fff;
}

.expand-toggle-row {
  display: flex;
  justify-content: flex-end;
  padding: 0 1rem 0.35rem;
}

/* ── QR color swatches (visual tiles with finder pattern) ── */
.qr-color-swatches {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.35rem;
}

.qr-color-swatch {
  cursor: pointer;
  position: relative;
}

.qr-color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.qr-color-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--qr-bg);
  color: var(--qr-fg);
  transition: border-color 150ms, box-shadow 150ms;
}

.qr-color-art--light {
  border-color: var(--line);
}

.qr-color-swatch:hover .qr-color-art {
  border-color: var(--accent-soft);
}

.qr-color-swatch input:checked + .qr-color-art {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

/* Shared variant expand bar */
.variant-expand-bar {
  border-top: 1px solid rgba(0, 92, 255, 0.12);
}

/* ── "+ variants" toggle button ─────────────────────── */
.expand-toggle {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  margin-left: auto;
}

.expand-toggle:hover {
  text-decoration: underline;
}

.expand-toggle.is-open {
  color: rgba(20, 38, 78, 0.5);
}

/* ── Strip expand (variant zone — blue tint) ────────── */
.strip-expand {
  padding: var(--expand-pad);
  background: var(--soft);
  border-top: 1px solid rgba(0, 92, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.strip-expand[hidden] {
  display: none;
}

.expand-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: rgba(20, 38, 78, 0.45);
  white-space: nowrap;
  min-width: 6.5rem;
  flex-shrink: 0;
}

/* Halo disclosure — vanity feature, tucked away */
.halo-disclosure {
  border-top: 1px solid rgba(20, 38, 78, 0.05);
}

.halo-disclosure > summary {
  cursor: pointer;
  list-style: none;
}

.halo-disclosure > summary::-webkit-details-marker {
  display: none;
}

.halo-disclosure > summary .seg-label::after {
  content: ' \25B8';
  font-size: 0.65rem;
}

.halo-disclosure[open] > summary .seg-label::after {
  content: ' \25BE';
}

/* Rows inside halo disclosure — consistent padding */
.seg-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
  border-top: 1px solid rgba(20, 38, 78, 0.05);
}

.seg-row:first-child {
  border-top: none;
}

.seg-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(20, 38, 78, 0.5);
  white-space: nowrap;
  min-width: 4rem;
  flex-shrink: 0;
}

/* Shell */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* Header bar */
.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.bar-title {
  font-size: 1.1rem;
  margin: 0;
  white-space: nowrap;
}

.slug-toggles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.slug-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
}

.slug-btn-code {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.slug-btn-dest {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(20, 38, 78, 0.5);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slug-btn:hover { border-color: var(--accent); }
.slug-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.slug-btn.active .slug-btn-dest {
  color: rgba(255, 255, 255, 0.7);
}

/* URL disclosure — collapsed by default for repeat operators */
.url-disclosure {
  margin-bottom: 0.25rem;
}

.url-disclosure-trigger {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.3rem 0;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
}

.url-disclosure-trigger:hover {
  text-decoration: underline;
}

/* URL input row */
.url-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
  margin-bottom: 0.25rem;
}

.url-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  background: #fff;
}

.url-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.url-btn {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 100ms;
}

.url-btn:hover { opacity: 0.88; }

.url-btn--secondary {
  background: transparent;
  color: var(--accent);
}

.url-btn--secondary:hover { background: var(--soft); }

.url-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.url-btn--ghost:hover {
  background: rgba(20, 38, 78, 0.04);
}

/* Slug info line */
.slug-info {
  font-size: 0.75rem;
  color: rgba(20,38,78,0.55);
  margin-bottom: 0.75rem;
  min-height: 1.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(20, 38, 78, 0.55);
}

.export-summary {
  font-size: 0.8rem;
  color: rgba(20, 38, 78, 0.66);
  margin-bottom: 0.9rem;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0.35rem 0.75rem;
  font-size: 0.77rem;
  font-weight: 600;
  transition: background 100ms, border-color 100ms, color 100ms;
}

.chip input:checked + span {
  background: var(--soft);
  border-color: rgba(0, 92, 255, 0.35);
  color: var(--accent);
}

/* Color swatches */
.swatch-group {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.swatch {
  display: block;
  cursor: pointer;
  position: relative;
}

.swatch input { position: absolute; opacity: 0; pointer-events: none; }

.swatch span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--sw);
  border: 2px solid var(--ring, transparent);
  transition: box-shadow 100ms, transform 100ms;
}

.swatch:hover span { transform: scale(1.12); }

.swatch input:checked + span {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

/* Segmented toggles — understated, not shouty */
.seg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  padding: 2px;
  display: inline-flex;
  gap: 2px;
  background: rgba(20, 38, 78, 0.04);
  min-inline-size: 0;
}

.seg-opt {
  cursor: pointer;
  margin: 0;
  position: relative;
}

.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }

.seg-opt span {
  display: block;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(20, 38, 78, 0.6);
  border-radius: calc(var(--radius) - 2px);
  transition: background 120ms, color 120ms, box-shadow 120ms;
  white-space: nowrap;
}

.seg-opt:hover span {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.seg-opt input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 38, 78, 0.12);
}

/* Logo toggle */
.logo-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.logo-toggle input {
  accent-color: var(--accent);
}

.logo-variant-seg {
  margin-top: 0.6rem;
}

.cfg-label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Stepper control (replaces full-width sliders) ──── */
.cfg-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.cfg-stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  min-height: var(--touch);
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 100ms;
  user-select: none;
  padding: 0;
}

.cfg-stepper-btn:hover {
  background: var(--soft);
}

.cfg-stepper-btn:active {
  background: var(--soft-strong);
}

.cfg-val {
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
  text-align: center;
  padding: 0 0.25rem;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Result area */
.preview-frame {
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(0,92,255,0.03));
  display: grid;
  place-items: center;
  padding: 0.75rem;
  min-height: 200px;
}

/* Dark preview for white/transparent QR compositions */
.preview-frame--dark {
  background:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #333;
  border-color: rgba(255, 255, 255, 0.15);
}

.preview-frame--dark .preview-empty {
  color: rgba(255, 255, 255, 0.5);
}

.preview-frame img {
  max-width: 100%;
  max-height: 50vh;
}

.preview-empty {
  color: rgba(20,38,78,0.45);
  font-size: 0.85rem;
}

.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(20,38,78,0.5);
}

.meta-value {
  font-size: 0.8rem;
  word-break: break-all;
}

/* ── Preview bar ────────────────────────────────────── */
.preview-bar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: sticky;
  top: 1rem;
}

.preview-card {
  background: #fff;
  border: 1px solid rgba(20, 38, 78, 0.08);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(20, 38, 78, 0.06);
}

.preview-card--hero {
  border-color: rgba(0, 92, 255, 0.25);
}

.preview-card--variant {
  cursor: pointer;
  transition: border-color 100ms;
}

.preview-card--variant:hover {
  border-color: var(--accent);
}

.preview-card--variant.has-result {
  border-color: rgba(0, 92, 255, 0.3);
}

.preview-frame--compact {
  min-height: 120px;
}

/* ── Hero card layout ───────────────────────────────── */
.btn-generate-hero {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  cursor: pointer;
  min-height: var(--touch);
  margin-top: 0.5rem;
  transition: opacity 100ms;
}

.btn-generate-hero:hover { opacity: 0.88; }
.btn-generate-hero:disabled { opacity: 0.4; cursor: wait; }

.hero-status {
  display: block;
  font-size: 0.78rem;
  color: rgba(20, 38, 78, 0.6);
  padding: 0.4rem 0;
}

/* ── Hero resolved asset line ─────────────────────── */
.hero-asset-line {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0;
  border-top: 1px solid rgba(20, 38, 78, 0.06);
}

.hero-asset-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
}

.hero-asset-badges strong {
  color: var(--ink);
}

.hero-asset-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 92, 255, 0.08);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-asset-path {
  font-size: 0.62rem;
  font-family: monospace;
  color: rgba(20, 38, 78, 0.4);
  word-break: break-all;
  line-height: 1.3;
}

.hero-naming {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.4rem;
}

.hero-export {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(20, 38, 78, 0.08);
  margin-top: 0.25rem;
}

.hero-export[hidden] {
  display: none;
}

.hero-export-name {
  display: grid;
  gap: 0.2rem;
  font-weight: 600;
  font-size: 0.75rem;
  color: rgba(20, 38, 78, 0.55);
}

.hero-export-name input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  background: #fff;
  min-height: var(--touch);
}

.hero-export-preview {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: monospace;
  word-break: break-all;
  color: rgba(20, 38, 78, 0.7);
}

.hero-export-note {
  font-size: 0.68rem;
  color: rgba(20, 38, 78, 0.45);
}

/* ── Hero details (collapsed by default) ────────────── */
.hero-details {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.hero-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(20, 38, 78, 0.45);
  padding: 0.3rem 0;
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

.hero-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.6rem;
  padding: 0.4rem 0;
}

.export-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-export-hero {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: var(--touch);
  transition: opacity 100ms;
}

.btn-export-hero:hover { opacity: 0.88; }
.btn-export-hero:disabled { opacity: 0.4; cursor: not-allowed; }

.hero-export select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.78rem;
  background: #fff;
  min-height: var(--touch);
}



/* ── Export config panel ────────────────────────────── */
.export-panel {
  background: #fff;
  border: 1px solid rgba(20, 38, 78, 0.08);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(20, 38, 78, 0.06);
}

.export-panel .channel-row {
  align-items: flex-end;
}

.export-input {
  width: 100%;
  min-width: 120px;
  max-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  background: #fff;
  min-height: var(--touch);
}

.export-canonical {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: monospace;
  word-break: break-all;
  color: rgba(20, 38, 78, 0.65);
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

.export-select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.78rem;
  background: #fff;
  min-height: var(--touch);
}

.export-panel .btn-generate-hero {
  white-space: nowrap;
}

.export-panel .btn-export-hero {
  white-space: nowrap;
}

/* ── Variant controls toolbar ───────────────────────── */
.variant-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid rgba(20, 38, 78, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(20, 38, 78, 0.06);
  margin-bottom: 0.5rem;
}

.vc-left, .vc-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vc-select-all {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.vc-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.variant-controls select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.78rem;
  background: #fff;
  min-height: var(--touch);
}

/* ── Results table ──────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-select   { width: 44px; }
.col-identity { /* flex via min-width */ }
.col-spec     { width: 160px; }
.col-action   { width: 96px; }

.results-table th {
  padding: 0.5rem 0.55rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(20, 38, 78, 0.55);
  border-bottom: 1px solid var(--line);
}

.results-table td {
  padding: 0.6rem 0.55rem;
  border-top: 1px solid rgba(20, 38, 78, 0.06);
  text-align: left;
  vertical-align: top;
}

/* ── Cluster styling ────────────────────────────────── */
.cluster-header td {
  background: var(--cluster-header-bg);
  padding: 0.5rem 0.75rem;
  border-top: none;
}

.cluster-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cluster-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cluster-label strong {
  font-size: 0.78rem;
}

.cluster-summary {
  font-size: 0.72rem;
  color: rgba(20, 38, 78, 0.55);
}

.cluster-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.cluster-generate {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  transition: border-color 100ms, background 100ms;
}

.cluster-generate:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.cluster-toggle {
  border: none;
  background: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  color: rgba(20, 38, 78, 0.55);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}

/* Cluster left-border color band — set inline via JS */
.variant-row .col-select {
  border-left: 3px solid transparent;
}

/* Cluster collapse */
.cluster[data-collapsed="true"] .variant-row {
  display: none;
}

/* ── Status dot ─────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
}

[data-status="pending"] .status-dot {
  background: transparent;
  border: 2px solid var(--status-pending);
}
[data-status="generating"] .status-dot {
  background: var(--status-generating);
  animation: pulse 1s infinite;
}
[data-status="ready"] .status-dot,
[data-status="success"] .status-dot {
  background: var(--status-ready);
}
[data-status="failed"] .status-dot {
  background: var(--status-failed);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* spec-inline hidden at desktop, shown when col-spec hides */
.spec-inline { display: none; }

/* ── Variant row ────────────────────────────────────── */
.variant-row .col-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.variant-label {
  font-size: 0.84rem;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.canonical-name {
  font-size: 0.72rem;
  color: rgba(20, 38, 78, 0.55);
  font-family: monospace;
  word-break: break-word;
}

.error-hint {
  font-size: 0.72rem;
  color: var(--status-failed);
}

.variant-row[data-status="ready"],
.variant-row[data-status="success"] {
  cursor: pointer;
}

.variant-row[data-status="ready"]:hover,
.variant-row[data-status="success"]:hover {
  background: var(--row-hover);
}

.variant-row:has(input[type="checkbox"]:checked) {
  background: var(--row-selected);
}

/* ── Action buttons ─────────────────────────────────── */
.action-btn {
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 100ms;
}

.action-btn:hover { opacity: 0.88; }

.action-btn--generate {
  background: var(--accent);
  color: #fff;
}

.action-btn--download {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
  min-width: 44px;
}

.action-btn--retry {
  background: rgba(154, 107, 17, 0.12);
  color: var(--warn);
}

.action-btn--cancel {
  background: transparent;
  border: 1px solid var(--line);
  color: rgba(20, 38, 78, 0.55);
}

/* ── Spec chip (inside table) ───────────────────────── */
.spec-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 38, 78, 0.06);
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.25rem;
  margin-bottom: 0.2rem;
}

.spec-chip--feature {
  background: rgba(0, 92, 255, 0.1);
  color: var(--accent);
}

/* Advanced options */
.advanced {
  font-size: 0.8rem;
  color: rgba(20,38,78,0.65);
}

.advanced summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.4rem 0;
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.advanced-grid label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

.advanced-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font: inherit;
}

/* ── Responsive ─────────────────────────────────────── */

/* Landscape tablet (1024-1180px) */
@media (max-width: 1180px) {
  .shell { padding: 0.85rem 0.85rem 1.5rem; }
  .studio { grid-template-columns: minmax(0, 1fr) 240px; gap: 0.75rem; }
  .strip-label, .expand-label { min-width: 5.5rem; }
}

/* Portrait tablet (768-1024px) — key rotation breakpoint */
@media (max-width: 1024px) {
  .studio { grid-template-columns: 1fr; }
  .preview-bar {
    position: static;
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
  }
  .preview-card { flex: 0 0 220px; }
  .preview-card--hero { flex: 0 0 260px; }
}

/* Narrow tablet / embed (< 900px) */
@media (max-width: 900px) {
  .col-spec { display: none; }
  .spec-inline { display: block; }
  .variant-controls { flex-direction: column; align-items: stretch; }
}

/* Phone / tight embed (< 768px) */
@media (max-width: 768px) {
  .col-select { display: none; }
  .preview-card--variant { display: none; }
  .expand-label { min-width: unset; }
  .bar, .url-row { flex-direction: column; align-items: stretch; }
  .paired-row { flex-direction: column; gap: 0.4rem; }
}

/* Small phone (< 640px) */
@media (max-width: 640px) {
  .advanced-grid { grid-template-columns: 1fr; }
}
