/* ──────────────────────────────────────────────────────────────────────────
   RMCflow Design System — Renderer Studio
   The light theme of the RMCflow app: warm ivory ground with a paper grain,
   white cards with soft corners, pill chips and terracotta actions, Plex Sans
   for headings and body, Plex Mono for labels.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Typography (self-hosted fonts from /static/fonts/) ── */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-ext-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
}

/* ── Brand Tokens & Semantic Palette ── */
:root {
  color-scheme: light;
  --bg: #efece5;              /* warm ground */
  --bg-card: #ffffff;         /* white card lifted off the warm canvas */
  --bg-card-hover: #f4eee5;   /* warm hover surface */
  --bg-subtle: #faf7f2;       /* subtle ground, quiet chip fill */
  --surface-inset: #e9e4db;   /* recessed track, disabled action */
  --canvas-texture: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.5), transparent 65%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%238e8170' opacity='.045' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
  --border: #e7e0d5;          /* card edge, input hairline */
  --border-control: #e2d9cb;  /* chip / quiet-button boundary, a shade deeper */
  --border-soft: #efe8dd;     /* divider under a section header */
  --border-strong: #8f867b;   /* boundary that must be perceivable (3:1) */

  --text: #2b2926;            /* warm ink */
  --text-muted: #6b6459;      /* mono label, caption, subtitle */
  --text-control: #56504a;    /* label on a chip or quiet button */
  --ink: var(--text);
  --muted: var(--text-muted);
  --line: var(--border);
  --paper: var(--bg);
  --white: #ffffff;
  --soft: var(--bg-card-hover);

  --primary: #c23a12;         /* terracotta */
  --primary-hover: #8f2b0d;   /* maroon */
  --primary-contrast: #ffffff;
  --primary-bg: rgba(194, 58, 18, 0.08);
  --primary-gradient: linear-gradient(180deg, #c55335, #a83f22);
  --primary-gradient-hover: linear-gradient(180deg, #b84a2d, #96371d);
  --primary-shadow: 0 2px 6px rgba(168, 63, 34, 0.28), 0 10px 22px -12px rgba(168, 63, 34, 0.8);
  --primary-shadow-hover: 0 4px 10px rgba(168, 63, 34, 0.32), 0 16px 30px -14px rgba(168, 63, 34, 0.9);
  --accent: #ef7945;          /* ember */
  --accent-ember: #e04a1b;    /* brighter ember, non-text use only (3.45:1) */
  --maroon: #8f2b0d;
  --selection-bg: linear-gradient(180deg, #3a3733, #26241f); /* selected chip, ink action */
  --selection-text: #fdfbf8;

  --green: #35633f;           /* status success */
  --green-dark: #284c31;
  --green-bg: rgba(53, 99, 63, 0.09);
  --green-surface: #e6efe6;   /* solid selected-chip pair */
  --green-surface-border: #bcd7c1;
  --yellow: #6f5a24;          /* status caution */
  --yellow-bg: rgba(111, 90, 36, 0.11);
  --red: #a3172a;             /* status danger, distinct from terracotta */
  --red-bg: rgba(163, 23, 42, 0.08);
  --danger: var(--red);

  --label-surface: rgba(255, 255, 255, 0.9); /* tag sitting on a photo */
  --modal-backdrop: rgba(28, 22, 16, 0.45);
  --feedback-bg: #2b2926;
  --feedback-text: #f6f2ec;

  --control-radius: 10px;     /* inputs, primary action, icon buttons */
  --control-radius-sm: 8px;   /* small icon buttons, inset tiles */
  --card-radius: 18px;        /* cards, panels, dialogs */
  --card-radius-sm: 13px;     /* a card nested inside a card */
  --pill-radius: 999px;       /* chips, quiet buttons, badges, tabs */
  --radius: var(--control-radius-sm);

  --control-height: 44px;
  --control-padding-x: 12px;
  --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6459' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  /* The scale is half-pixel on purpose; 13.5px is its most used step. */
  --text-3xs: 10.5px;         /* mono tag, tracked caps */
  --text-2xs: 12.5px;         /* caption */
  --text-xs: 13.5px;          /* quiet button, chip */
  --text-sm: 14.5px;          /* input */
  --text-nav: 15px;           /* nav link, primary action */
  --text-base: 16px;

  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: var(--font-body);
  --font-label: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-mono: var(--font-label);

  /* Shadows are tinted warm brown, not ink. */
  --control-focus-ring: 0 0 0 3px rgba(194, 58, 18, 0.30);
  --shadow-inset: inset 0 1px 2px rgba(40, 30, 20, 0.09);
  --shadow-sm: 0 1px 2px rgba(40, 30, 20, 0.06), 0 6px 14px -8px rgba(40, 30, 20, 0.16);
  --shadow-md: 0 2px 4px rgba(40, 30, 20, 0.06), 0 12px 24px -14px rgba(40, 30, 20, 0.30);
  --shadow-lg: 0 4px 10px rgba(40, 30, 20, 0.10), 0 14px 26px -12px rgba(40, 30, 20, 0.40);
  --shadow-card: var(--shadow-sm), 0 26px 48px -22px rgba(40, 30, 20, 0.23);

  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  /* Three layers: a soft vignette, then the highlight and grain of --canvas-texture. */
  background-image: radial-gradient(112% 102% at 50% 34%, rgba(255, 255, 255, 0.68) 0%, rgba(255, 255, 255, 0.1) 44%, rgba(58, 44, 30, 0.04) 74%, rgba(48, 35, 22, 0.11) 100%), var(--canvas-texture);
  background-size: 100% 100%, 100% 100%, 180px 180px;
  background-attachment: fixed, fixed, fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; border: 0; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--control-focus-ring); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--primary); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 600; color: var(--text); }
h1 { font-size: 42px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; margin-top: 15px; }
h1 em { font-family: var(--font-display); font-style: normal; font-weight: 700; color: var(--primary); }
h2 { font-weight: 700; letter-spacing: -0.02em; font-size: 24px; }
h3 { font-size: 15px; font-weight: 600; }
svg { display: block; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 16px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 12px 16px;
  border-radius: var(--control-radius);
  background: var(--text);
  color: var(--bg-card);
}
.skip-link:focus { transform: none; }

/* ── Header ── */
.site-header {
  height: 72px;
  padding: 0 5.2%;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 40px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 5;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 44px;
}
.brand-lockup {
  height: 28px;
  width: auto;
  display: block;
}
nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
/* Destinations are pill tabs: a terracotta tint marks the current one. */
.nav-link {
  font-size: var(--text-nav);
  font-weight: 500;
  color: var(--text-muted);
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--pill-radius);
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--primary-bg); color: var(--primary); }
.nav-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-label-short { display: none; }
/* Short labels such as "Lab" would be narrower than a fingertip on phones and touch screens. */
@media (max-width: 640px), (pointer: coarse) {
  .nav-link { min-width: 44px; justify-content: center; }
}
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.local-badge {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.status-dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  display: inline-block;
  background: var(--green);
  flex-shrink: 0;
}
.status-dot.offline { background: var(--red); }
.status-dot.checking { background: var(--accent); }

/* ── Buttons ──
   Two shapes, on purpose: quiet, outline and dark buttons are pills; the
   primary action is a rounded rectangle with the terracotta gradient. */
.button {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  line-height: 1.35;
  font-weight: 500;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--pill-radius);
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease, filter .16s ease;
  white-space: nowrap;
}
.button:not(:disabled):active { transform: translateY(1px); }
.button-quiet {
  background: var(--bg-subtle);
  color: var(--text-control);
  border-color: var(--border-control);
}
.button-quiet:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text);
}
.button-outline {
  background: var(--bg-card);
  color: var(--text-control);
  border-color: var(--border-control);
  box-shadow: var(--shadow-sm);
}
.button-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--text-muted);
}
.button-dark {
  background: var(--selection-bg);
  color: var(--selection-text);
  box-shadow: var(--shadow-sm);
}
.button-dark:hover:not(:disabled) {
  filter: brightness(1.18);
  box-shadow: var(--shadow-md);
}
.button-primary {
  background: var(--primary-gradient);
  color: var(--primary-contrast);
  font-size: var(--text-nav);
  font-weight: 600;
  letter-spacing: -0.005em;
  min-height: 46px;
  padding: 0 17px;
  border-radius: var(--control-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.24) inset, var(--primary-shadow);
  justify-content: space-between;
}
.button-primary:hover:not(:disabled) {
  background: var(--primary-gradient-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  filter: saturate(1.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, var(--primary-shadow-hover);
}
.button-primary:not(:disabled):active { transform: translateY(0) scale(0.985); }
.button-primary:disabled {
  background: var(--surface-inset);
  color: var(--text-muted);
  border-color: var(--border);
  box-shadow: none;
  opacity: 1;
}
.button-full { width: 100%; }
.count {
  font-family: var(--font-label);
  background: var(--bg-card);
  border: 1px solid var(--border-control);
  border-radius: var(--pill-radius);
  min-width: 21px;
  padding: 0 5px;
  line-height: 19px;
  font-size: 10px;
  text-align: center;
}
.jobs-toggle { gap: 8px; }

/* ── Main Layout ── */
main {
  max-width: 1660px;
  margin: 0 auto;
  padding: 0 5.2%;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 44px 0 32px;
}
.eyebrow {
  font-family: var(--font-label);
  font-size: var(--text-3xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  line-height: 1.5;
  text-transform: uppercase;
}
.heading-description {
  max-width: 320px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 4px;
}
/* Collection and Studio are two views of one document; <html data-view> (set before first paint) shows one. */
html[data-view="collection"] [data-view="studio"],
html[data-view="studio"] [data-view="collection"] { display: none; }
.studio-view { padding-bottom: 60px; }
/* The Activity panel sits above both views here; other pages keep their own spacing. */
html[data-view] main > .jobs-panel { margin: 24px 0 0; }
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

/* ── Preview Panel ── */
.preview-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.panel-topline {
  min-height: 44px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-card);
}
.panel-topline .eyebrow { font-size: 10px; letter-spacing: 0.08em; }
.muted {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}
.preview {
  background: var(--bg-subtle);
  position: relative;
  min-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.empty-preview {
  background: radial-gradient(ellipse at 50% 55%, var(--bg-subtle), var(--surface-inset));
}
.canvas-empty {
  padding: 24px 20px 36px;
  text-align: center;
}
.room-illustration {
  width: 280px;
  height: 190px;
  margin: 0 auto 10px;
  color: #ad9e8d;
}
.canvas-empty .eyebrow { font-size: 10px; letter-spacing: 0.1em; color: var(--text-muted); }
.canvas-empty h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 10px 0 11px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.canvas-empty p:not(.eyebrow) {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-muted);
}
.text-link {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-top: 20px;
  color: var(--primary);
  border-bottom: 1px solid var(--primary);
  padding-bottom: 4px;
}
.text-link:hover { color: var(--primary-hover); border-bottom-color: var(--primary-hover); }
.trace-link { display: inline-block; width: fit-content; margin-top: 4px; color: var(--primary); font-size: 11px; line-height: 1.6; text-decoration: underline; text-underline-offset: 3px; }
.trace-link:hover { color: var(--primary-hover); }
.preview-room-image {
  width: 100%;
  max-height: 610px;
  object-fit: contain;
}
.preview-footer {
  min-height: 72px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.preview-footer > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.preview-footer strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-footer .muted { font-size: 11px; }
.preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.preview-actions .button { font-size: var(--text-2xs); padding: 6px 12px; }
.panel-topline #preview-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.view-mode { display: flex; flex: none; border: 1px solid var(--border-control); border-radius: var(--pill-radius); background: var(--bg-card); }
.view-mode button { min-height: 42px; padding: 0 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; border-radius: var(--pill-radius); background: transparent; color: var(--text-muted); }
.view-mode button[aria-pressed="true"] { background: var(--selection-bg); color: var(--selection-text); }
.view-mode button { color: var(--text-control); }
.view-mode button.is-busy::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent-ember); vertical-align: 1px; animation: view-mode-pulse 1.2s ease-in-out infinite; }
.view-mode button[aria-pressed="true"].is-busy::after { background: var(--accent); }
@keyframes view-mode-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .view-mode button.is-busy::after { animation: none; } }

/* Diorama: the Cycles picture and the baked model the vendored Three.js orbits; a waiting panel until they exist. */
.diorama { width: 100%; position: relative; }
.diorama:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.diorama-pending .pending-preview { padding-bottom: 40px; }
.d-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; padding: 10px 16px; border-top: 1px solid var(--border-soft); background: var(--bg-card); }
.d-caption { flex: 1 1 240px; margin: 0; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
.d-status { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.d-status-error { color: var(--primary-hover); }
.d-actions .button { font-size: var(--text-2xs); padding: 8px 14px; min-height: 36px; }
.diorama-rendered .preview-room-image { display: block; }
.d-model { position: relative; height: clamp(300px, 46vw, 600px); touch-action: none; cursor: grab; background: radial-gradient(ellipse at 50% 60%, var(--bg-card), var(--bg-subtle) 72%); }
.d-model:active { cursor: grabbing; }
.d-model canvas { display: block; width: 100%; height: 100%; }
.d-model .d-model-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.d-model.is-ready .d-model-still { display: none; }

/* ── Brief Panel & Forms ── */
.brief-panel {
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--bg-card);
  padding: 24px 22px 0;
  box-shadow: var(--shadow-card);
}
.step-number {
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.brief-heading h2 {
  font-size: 22px;
  margin-top: 10px;
  letter-spacing: -0.02em;
}
.brief-heading p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 20px;
}
form label {
  font-family: var(--font-label);
  font-size: var(--text-3xs);
  letter-spacing: 0.09em;
  font-weight: 500;
  display: block;
  margin: 16px 0 8px;
  line-height: 1.5;
  color: var(--text-muted);
  text-transform: uppercase;
}
.optional {
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  float: right;
  font-weight: 400;
}
input:not([type=range]), textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  min-height: var(--control-height);
  padding: 9px var(--control-padding-x);
  border-radius: var(--control-radius);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  transition: border-color .15s, box-shadow .15s;
}
textarea {
  line-height: 1.5;
  resize: vertical;
  min-height: 84px;
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
/* The native arrow gives way to the system chevron; rules that change a select's padding keep 26px clear on the right. */
select {
  padding-right: 30px;
  cursor: pointer;
  text-transform: capitalize;
  -webkit-appearance: none;
  appearance: none;
  background-image: var(--control-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}
.field-pair > div { min-width: 0; }
.field-pair select { max-width: 100%; }
.selected-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}
.selected-heading label { margin: 0; }
.selected-heading .muted { font-size: 11px; font-family: var(--font-label); }
.selected-products {
  margin-top: 9px;
  min-height: 52px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--control-radius);
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--bg-subtle);
}
.selected-products > p { font-size: 11px; }
.selected-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-control);
  border-radius: var(--pill-radius);
  padding: 0 0 0 11px;
  max-width: 100%;
  color: var(--text-control);
}
.selected-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selected-chip button {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 15px;
}
.selected-chip button:hover { color: var(--primary); }
.selected-chip.pending {
  background: var(--primary-bg);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--bg-card));
  color: var(--primary);
}
.advanced-options { margin: 16px 0; }
.advanced-options summary {
  min-height: 44px;
  align-items: center;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
}
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options[open] summary span { transform: rotate(45deg); }
.form-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}
.service-strip {
  border-top: 1px solid var(--border);
  margin: 20px -22px 0;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  /* The strip closes the card, so it follows the card's inner corners. */
  border-radius: 0 0 calc(var(--card-radius) - 1px) calc(var(--card-radius) - 1px);
}
.service-strip span { display: flex; align-items: center; gap: 6px; }
.service-strip .status-dot { height: 5px; width: 5px; }

/* ── Collection Section ── */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.section-heading h2 {
  margin-top: 6px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.section-count {
  font-family: var(--font-label);
  color: var(--text-muted);
  font-size: 11px;
  vertical-align: middle;
  letter-spacing: 0;
  margin-left: 8px;
}
.collection-section { padding: 0 0 60px; }
.designer-intro { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); margin: 0 0 36px; border: 1px solid var(--border); border-radius: 24px; overflow: hidden; background: var(--bg-subtle); box-shadow: var(--shadow-sm); }
.designer-intro-copy { padding: clamp(24px, 3.5vw, 48px); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 18px; }
.designer-intro h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 500; line-height: 1.15; }
.designer-intro-copy > p:not(.eyebrow) { max-width: 42ch; font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.designer-brand-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.designer-brand-actions .button { min-height: 44px; }
.designer-intro-copy > span { font-size: 9px; }
.designer-intro figure { min-width: 0; position: relative; margin: 0; background: var(--bg-card); min-height: 340px; }
.designer-intro figure img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.designer-intro figcaption { position: absolute; bottom: 14px; left: 16px; right: 16px; width: fit-content; max-width: calc(100% - 32px); padding: 7px 12px; background: var(--label-surface); border-radius: var(--pill-radius); font-size: 10px; color: var(--text-muted); }
.designer-card .product-image-button img { object-fit: contain; padding: 12px; mix-blend-mode: normal; }
.designer-card .product-info .muted { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 32px; }
.designer-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.designer-card-actions .generate-product { min-height: 44px; text-align: left; }
.designer-add { height: 44px; width: 44px; flex-shrink: 0; border: 1px solid var(--border-control); border-radius: var(--pill-radius); background: var(--bg-card); color: var(--text); font-size: 20px; }
.designer-add[aria-pressed="true"] { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.edition-note { margin-top: 9px; color: var(--text-muted); font-size: 10px; }
.piece-dialog { width: min(1500px, calc(100% - 32px)); height: calc(100dvh - 32px); max-width: none; max-height: none; padding: 0; overflow: hidden; border-radius: 24px; }
.piece-dialog iframe { width: 100%; height: 100%; border: 0; display: block; }
.piece-dialog .piece-dialog-close { position: absolute; top: 16px; right: 16px; z-index: 2; height: 44px; width: 44px; background: var(--bg-card); border: 1px solid var(--border-control); border-radius: var(--pill-radius); }
.piece-dialog::backdrop { backdrop-filter: blur(12px); }
@media (max-width: 680px) {
  .designer-intro { grid-template-columns: 1fr; border-radius: 18px; }
  .designer-intro figure { min-height: 230px; grid-row: 1; }
  .designer-intro-copy { gap: 14px; }
  .designer-intro-copy > span { font-size: 9px; }
  .designer-card-actions .generate-product { font-size: 10px; }
  .piece-dialog { width: 100%; height: 100dvh; margin: 0; border-radius: 0; }
  .piece-dialog-close { top: 11px; right: 10px; }
}
.collection-actions { display: flex; gap: 10px; align-items: center; }
.compose-link { gap: 14px; }
.pieces-link { margin-top: 10px; min-height: 44px; }
.collection-controls {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
  min-height: 48px;
}
/* Category filters are chips; the padding keeps their focus ring inside the scroll lane. */
.filter-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
  max-width: 75%;
  padding: 4px;
  margin: -4px;
}
.filter-tab {
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 44px;
  padding: 6px 13px;
  border: 1px solid var(--border-control);
  border-radius: var(--pill-radius);
  background: var(--bg-subtle);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-control);
  text-transform: capitalize;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.filter-tab:hover { background: var(--bg-card); color: var(--text); }
.filter-tab.active {
  background: var(--selection-bg);
  border-color: transparent;
  color: var(--selection-text);
  box-shadow: var(--shadow-sm);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: var(--control-height);
  padding: 0 6px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--bg-card);
  max-width: 220px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: var(--control-focus-ring); }
.search-box > span { font-size: 18px; }
.search-box input {
  background: transparent;
  border: 0;
  min-height: var(--control-height);
  padding: 6px;
  font-size: var(--text-xs);
}
.search-box input:focus { box-shadow: none; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 20px;
}
.product-card { min-width: 0; border-radius: var(--card-radius); }
.product-image-button {
  display: block;
  width: 100%;
  padding: 0;
  background: var(--bg-subtle);
  aspect-ratio: 1.2;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.product-image-button:hover { border-color: var(--border-control); box-shadow: var(--shadow-md); }
.product-card.selected .product-image-button {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), var(--shadow-md);
}
.product-image-button img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.selection-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: var(--label-surface);
  border: 1px solid var(--border-control);
  border-radius: var(--pill-radius);
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.selected .selection-check {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}
.product-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  color: #ad9e8d;
  gap: 14px;
}
.product-placeholder svg { width: 60px; height: 60px; opacity: .65; }
.product-placeholder > span {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 0.05em;
}
.product-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--label-surface);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: var(--pill-radius);
  font-family: var(--font-label);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.product-info { padding: 12px 0 0; }
.product-title-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}
.product-info h3 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.product-info .muted {
  font-size: 11px;
  display: block;
  margin: 3px 0 6px;
  text-transform: capitalize;
}
.generate-product {
  min-height: 44px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--primary);
  padding: 3px 0;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--primary);
  margin-top: 4px;
}
.generate-product:hover {
  color: var(--primary-hover);
  border-bottom-color: var(--primary-hover);
}
.product-card-error {
  font-size: 11px;
  color: var(--danger);
  line-height: 1.5;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.collection-empty {
  grid-column: 1 / -1;
  padding: 48px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--card-radius);
  background: var(--bg-card);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  margin: 0 5.2%;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-brand-link {
  display: inline-flex;
  align-items: center;
}
.footer-brand-lockup {
  height: 22px;
  width: auto;
  opacity: .9;
}
.site-footer p { font-size: 12px; color: var(--text-muted); }
.site-footer > span:last-child {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── History Section ── */
.history-section { padding-top: 35px; }
.history-section .section-heading h2 { font-size: 22px; }
.room-history {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 1px 8px;
}
.history-card {
  flex: 0 0 150px;
  text-align: left;
  padding: 0;
  background: transparent;
  border: 0;
  position: relative;
}
.history-thumb {
  aspect-ratio: 1.5;
  background: var(--bg-card-hover);
  border-radius: var(--card-radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-card.active .history-thumb {
  border: 2px solid var(--primary);
}
.history-card strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}
.history-card small {
  font-size: 10px;
  font-family: var(--font-label);
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
  text-transform: capitalize;
}
.revision-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--label-surface);
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
  padding: 2px 7px;
  font-family: var(--font-label);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--primary);
}

/* ── Error & Pending States ── */
.inline-error, .form-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.inline-error {
  padding: 14px 20px;
  border-top: 1px solid color-mix(in srgb, var(--red) 25%, var(--bg-card));
  background: var(--red-bg);
}
.form-error { margin: 12px 0; }
.room-pieces { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.room-piece { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 3px 12px 3px 3px; background: var(--bg-card); border: 1px solid var(--border-control); border-radius: var(--pill-radius); font-size: 12px; font-weight: 500; color: var(--text-control); }
.room-piece img { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.room-piece > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-piece small { flex: none; font-family: var(--font-label); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.room-piece.removed { color: var(--text-muted); border-style: dashed; padding-left: 12px; }
.room-check { margin: 0; padding: 10px 20px; font-size: 11px; line-height: 1.6; color: var(--text-muted); border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.room-pieces:not([hidden]) + .room-check { border-top: 0; padding-top: 0; }
.room-check[data-status="incomplete"] { color: var(--primary); }
.room-check[data-status="unavailable"] { color: var(--danger); }
.pending-preview { padding: 64px 28px; text-align: center; }
.pending-preview h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 16px 0 10px;
  color: var(--text);
}
.pending-preview p { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
}
.mini-spinner { width: 15px; height: 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Activity & Jobs Panel ── */
.jobs-panel {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 22px;
  margin-bottom: 24px;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
}
.jobs-panel h2 { font-size: 21px; }
.job-list { max-height: 320px; overflow: auto; }
.job-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.job-row strong { font-size: 12px; font-weight: 600; display: block; }
.job-row p { font-size: 11px; color: var(--text-muted); line-height: 1.6; overflow-wrap: anywhere; }
.job-status {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--pill-radius);
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
}
.job-status.failed { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 25%, var(--bg-card)); color: var(--danger); }
.job-mark { color: var(--green); text-align: center; font-weight: 600; }
.job-mark.failed { color: var(--danger); }
.icon-button {
  font: 300 24px var(--font-body);
  background: transparent;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  border-radius: var(--control-radius-sm);
}
.icon-button:hover { background: var(--bg-card-hover); color: var(--text); }

/* ── Dialogs ── */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--bg-card);
  padding: 28px;
  box-shadow: var(--shadow-lg), 0 30px 80px -18px rgba(40, 30, 20, 0.40);
  color: var(--text);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
}
.product-dialog { width: 480px; max-width: calc(100% - 28px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.dialog-heading h2 { font-size: 22px; margin-top: 6px; }
.dialog-description { font-size: 12px; line-height: 1.7; color: var(--text-muted); margin-top: 12px; }
.product-dialog .button-primary { margin-top: 20px; }
.swap-dialog { width: 1150px; max-width: calc(100% - 28px); }
.swap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  margin-top: 20px;
}
.swap-layout form > label:first-child { margin-top: 6px; }
.replacement-preview {
  margin-top: 12px;
  border-radius: var(--card-radius-sm);
  overflow: hidden;
  max-height: 155px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.replacement-preview img { width: 100%; height: 140px; object-fit: contain; }
.replacement-preview p { font-size: 11px; color: var(--text-muted); line-height: 1.7; padding: 14px; }
.source-selection { margin-top: 20px; }
.source-selection .eyebrow { font-size: 10px; }
.source-preview { margin-top: 8px; }
.source-preview img { display: block; }
/* Inline actions inside the dialog copy read as text, not chips. */
.source-selection .button, .object-scan-status .button { background: none; border-color: transparent; border-radius: var(--control-radius-sm); color: var(--primary); }
.source-selection .button:hover:not(:disabled), .object-scan-status .button:hover:not(:disabled) { background: none; color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.source-selection .button { padding: 6px 0; font-size: 12px; }
.source-selection .object-scan-error { color: var(--danger); }
.replacement-filters { gap: 12px; }
.replacement-filters > div { min-width: 0; }
.replacement-filters select { font-size: 12px; padding-left: 10px; padding-right: 26px; }
#replacement-filter-help, #replacement-count { margin-top: 7px; }
.swap-layout .button-primary { margin-top: 22px; }

/* ── Toasts ── */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 24px;
  z-index: 1000;
  width: min(370px, calc(100% - 40px));
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--feedback-bg);
  color: var(--feedback-text);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 13px 17px;
  border-radius: var(--control-radius);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast button {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  color: inherit;
  font-size: 18px;
  align-self: start;
  padding: 0 0 0 10px;
}
@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Compare Slider ── */
.compare-wrap { position: relative; width: 100%; line-height: 0; }
.compare-wrap > img { width: 100%; height: auto; }
.compare-original { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 50% 0 0); }
.compare-original img { width: 100%; height: 100%; object-fit: contain; }
.compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #ffffff;
  pointer-events: none;
}
.compare-line:after {
  content: '↔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: #ffffff;
  border-radius: 50%;
  color: var(--primary);
  font-size: 16px;
  display: grid;
  place-items: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.compare-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.compare-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  line-height: 1;
  background: var(--label-surface);
  padding: 5px 10px;
  border-radius: var(--pill-radius);
  border: 1px solid var(--border);
  color: var(--primary);
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 0.05em;
  pointer-events: none;
}
.compare-tag.edited { left: auto; right: 14px; }

/* ── Object Inspection & Scan Status ── */
.object-scan-status { margin-top: 9px; }
.object-scan-status p, .object-help {
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.object-scan-status .button {
  padding: 5px 0;
  font-size: 12px;
  justify-content: flex-start;
}
.object-scan-status .object-scan-error { color: var(--danger); }
.object-help { margin-top: 6px; }
#replace-product { text-transform: none; }

.swap-source-workspace { min-width: 0; margin: 0; }
.swap-source-image {
  position: relative;
  line-height: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--card-radius-sm);
  overflow: hidden;
}
.swap-source-image img { width: 100%; height: auto; max-height: none; }
.source-object-outline {
  position: absolute;
  border: 3px solid var(--primary);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
  z-index: 1;
  pointer-events: none;
}
.swap-source-workspace .form-note {
  font-size: 11px;
  text-align: left;
  line-height: 1.7;
  color: var(--text-muted);
  margin-top: 12px;
}

.selection-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.selection-actions .button { font-size: 12px; min-height: 28px; padding: 3px 10px; gap: 5px; }
@media (max-width: 640px), (pointer: coarse) {
  .selection-actions { gap: 4px; }
  .selection-actions .button { min-height: 44px; min-width: 44px; }
}
.selection-hint {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 5px;
}
.room-design-hint {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
  margin-top: 8px;
}
#room-form > .room-design-hint { grid-column: 1 / -1; }
#room-form > .selection-hint { grid-column: 1 / -1; }

.collection-controls .filter-tabs { flex: 1; min-width: 0; max-width: none; }
.collection-search { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.product-brand {
  display: block;
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.collection-search select {
  width: 165px;
  margin: 0;
  font-size: var(--text-xs);
  padding: 6px 30px 6px 12px;
}
.collection-results { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -12px 0 20px; min-height: 44px; }
html[data-view] .text-link, .pb-page .text-link { display: inline-flex; align-items: center; min-height: 44px; }
html[data-view] .button, html[data-view] .selection-actions .button { min-height: 44px; }

/* ── Responsive Media Queries ── */
@media (min-width: 1500px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr) 370px; }
  .preview { min-height: 490px; }
  .brief-panel { padding: 28px 26px 0; }
  .service-strip { margin-left: -26px; margin-right: -26px; }
  .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .room-illustration { width: 340px; height: 220px; }
  .canvas-empty { padding-top: 25px; }
  .preview-footer { min-height: 78px; }
}

/* Pill tabs are wider than plain links: tighten them, then drop the status badge, before the row wraps. */
@media (max-width: 1400px) {
  .site-header { gap: 28px; }
  .nav-link { padding: 0 14px; font-size: 14px; }
}
@media (max-width: 1280px) {
  .local-badge { display: none; }
}

@media (max-width: 1100px) {
  .site-header { gap: 28px; padding: 0 4%; }
  main { padding: 0 4%; }
  .header-right { gap: 15px; }
  .local-badge { display: none; }
  .studio-grid { grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
  .brief-panel { padding: 22px 18px 0; }
  .service-strip { margin-left: -18px; margin-right: -18px; }
  .preview { min-height: 440px; }
  .preview-footer { align-items: start; flex-direction: column; padding: 14px 18px; gap: 10px; }
  .preview-actions { width: 100%; justify-content: flex-end; }
  .preview-footer .muted { font-size: 10px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .collection-actions .button { font-size: var(--text-2xs); }
  .swap-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; }
  .panel-topline { padding: 0 16px; }
  .panel-topline .muted { font-size: 10px; }
}

@media (max-width: 800px) {
  .site-header { height: 64px; gap: 24px; }
  .nav-link { padding: 0 11px; font-size: 13.5px; }
  .brand-lockup { height: 24px; }
  .page-heading { margin: 30px 0 24px; gap: 18px; }
  h1 { font-size: 32px; letter-spacing: -0.02em; }
  h1 em { font-size: 32px; }
  .heading-description { font-size: 12px; max-width: 240px; }
  .eyebrow { font-size: 10px; }
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .brief-panel { padding: 22px 20px 0; }
  .brief-heading h2 { font-size: 22px; }
  .brief-heading p { margin-bottom: 18px; }
  #room-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
  #room-form > label, #room-form > input, #room-form > .field-pair, #room-form > textarea,
  #room-form > .selected-heading, #room-form > .selected-products, #room-form > .advanced-options,
  #room-form > .button, #room-form > .form-note, #room-form > .form-error {
    grid-column: 1 / -1;
  }
  .service-strip { margin-left: -20px; margin-right: -20px; }
  .preview-footer { flex-direction: row; align-items: center; }
  .preview-actions { width: auto; }
  .preview { min-height: 380px; }
  .collection-actions { gap: 8px; }
  .collection-section .section-heading, .collection-section .collection-actions { flex-wrap: wrap; }
  .collection-actions .button { padding: 7px 12px; font-size: 12px; }
  .section-heading h2 { font-size: 24px; }
  .collection-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .filter-tabs { max-width: none; order: 2; }
  .search-box { max-width: none; align-self: flex-end; }
  .search-box input { max-width: 160px; }
  .swap-layout { grid-template-columns: 1fr; }
  .swap-dialog { padding: 20px; }
  .swap-layout form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .swap-layout form > * { grid-column: 1 / -1; }
  .replacement-preview { max-height: 120px; }
  .replacement-preview img { height: 120px; }
  .dialog-heading h2 { font-size: 20px; }
  .site-footer > span:last-child { display: none; }
  .collection-search { justify-content: space-between; }
  .collection-search .search-box { align-self: auto; }
}

@media (max-width: 520px) {
  .site-header { padding: 0 16px; gap: 16px; height: 60px; }
  .brand-lockup { height: 22px; }
  nav { gap: 2px; }
  .nav-link { padding: 0 9px; font-size: 12.5px; }
  .nav-label-full { display: none; }
  .nav-label-short { display: inline; }
  .header-right { gap: 0; }
  .jobs-toggle { font-size: 12px; padding: 5px 10px; }
  .jobs-toggle .count { min-width: 16px; line-height: 16px; font-size: 9px; }
  main { padding: 0 16px; }
  .page-heading { display: block; margin-top: 26px; }
  .heading-description { max-width: 300px; font-size: 12px; margin-top: 14px; }
  h1 { font-size: 30px; margin-top: 10px; }
  h1 em { font-size: 30px; }
  .preview { min-height: 340px; }
  .room-illustration { width: 240px; height: 160px; }
  .canvas-empty h2 { font-size: 23px; }
  .canvas-empty { padding-left: 10px; padding-right: 10px; padding-bottom: 20px; }
  .panel-topline { min-height: 40px; padding: 0 12px; }
  .preview-footer { padding: 12px; flex-wrap: wrap; }
  .preview-actions { flex-wrap: wrap; justify-content: flex-start; gap: 4px; }
  .preview-actions .button { font-size: 11px; padding: 5px 10px; }
  .brief-panel { padding: 20px 16px 0; }
  .service-strip { margin-left: -16px; margin-right: -16px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-heading h2 { font-size: 23px; }
  .collection-actions { width: 100%; }
  .collection-section .collection-actions { flex-wrap: wrap; }
  .collection-actions .button { flex: 1; min-height: 44px; font-size: 12px; }
  .collection-actions .compose-link { order: -1; flex-basis: 100%; min-height: 46px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .product-image-button { aspect-ratio: 1; }
  .product-info h3 { font-size: 12px; }
  .product-info .muted { font-size: 10px; }
  .site-footer { margin: 0 16px; padding: 20px 0; }
  .site-footer p { font-size: 11px; }
  .history-card { flex-basis: 124px; }
  .history-card strong { max-width: 120px; }
  .product-dialog { padding: 20px; }
  .dialog-heading h2 { font-size: 20px; }
  .swap-dialog { max-width: calc(100% - 16px); padding: 18px; }
  .swap-dialog .dialog-heading h2 { font-size: 19px; }
  .toast-container { bottom: 14px; right: 14px; width: calc(100% - 28px); }
  .collection-search { gap: 8px; flex-wrap: wrap; }
  .collection-search select { width: 130px; flex: 1 1 130px; min-height: 44px; }
  .collection-search .search-box { min-width: 0; flex: 1 1 100%; max-width: none; }
  .collection-search input { min-width: 0; width: 100%; max-width: none; }
  html[data-view] input, html[data-view] select, html[data-view] textarea { font-size: 16px; }
  .designer-intro { grid-template-columns: minmax(0, 1fr) 110px; margin-bottom: 24px; }
  .designer-intro-copy { padding: 16px; gap: 12px; }
  .designer-intro h2 { font-size: 20px; }
  .designer-intro-copy > p:not(.eyebrow) { display: none; }
  .designer-intro figure { grid-row: auto; min-height: 0; }
  .designer-intro figure img { object-fit: contain; }
  .designer-intro figcaption { display: none; }
  .designer-brand-actions { gap: 6px; }
  .designer-brand-actions .button { padding: 6px 10px; font-size: 12px; }
}

/* Give the shared navigation its own row when all five destinations need space. */
@media (max-width: 1100px) {
  .site-header { height: auto; min-height: 72px; flex-wrap: wrap; gap: 0 20px; padding-top: 12px; }
  .site-header .brand-link { min-height: 44px; }
  .site-header .header-right { margin-left: auto; }
  .site-header > nav { order: 3; width: 100%; padding: 4px 0 8px; gap: 4px; }
  .site-header > nav .nav-link { min-height: 44px; white-space: nowrap; }
}
/* On a phone the five tabs share the full row. */
@media (max-width: 520px) {
  .site-header > nav { justify-content: space-between; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
