/* ============================================================
   EM Concepts prototype
   Tokens sourced from TILE Design System (Edward Martin, Light)
   ============================================================ */

@font-face {
  font-family: "Sons";
  src: url("assets/fonts/Sons-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Sons";
  src: url("assets/fonts/Sons-Medium.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "Sons";
  src: url("assets/fonts/Sons-Light.woff2") format("woff2");
  font-weight: 300; font-display: swap;
}
@font-face {
  font-family: "Tiempos Headline";
  src: url("assets/fonts/TiemposHeadline-Light.woff2") format("woff2");
  font-weight: 300; font-display: swap;
}

:root {
  /* color — base */
  --bg: #ffffff;
  --bg-subtle: #fcfbf8;
  --fg: #343128;
  --fg-muted: #635d4f;
  --primary: #413e32;
  --primary-fg: #ffffff;
  --border: #e9e8e7;
  --border-outlined: rgba(0, 0, 0, 0.24);
  --sidebar-select: #ede6dd;
  --sidebar-fg: #737271;
  --saddle: #b4946f;

  /* radius */
  --r-lg: 8px;
  --r-xl: 10px;
  --r-3xl: 16px;
  --r-4xl: 24px;
  --r-6xl: 40px;
  --r-full: 9999px;

  /* type */
  --font-sans: "Sons", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Tiempos Headline", "Tiempos Text", "Source Serif 4", Georgia, serif;

  /* motion */
  --ease-out: cubic-bezier(0.32, 0.72, 0.33, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.5, 1);
  --dur-pop-in: 270ms;
  --dur-pop-out: 200ms; /* keep in sync with the 200ms unmount timeout in Composer */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.3;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#root { height: 100vh; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; }
.shell-main { flex: 1; position: relative; overflow: hidden; background: var(--bg); }
.view-scroll { height: 100%; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
.view-scroll > .grid-wrap { flex: 1 0 auto; } /* content frame always fills available height */

/* single-project: header pinned, only the concept grid scrolls */
.view-fixed { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.project-head { flex: none; padding: 0 64px 20px; position: relative; z-index: 2; background: var(--bg); }
.project-head .topbar { padding: 0; }
.project-head::after { /* soft fade so cards dissolve under the header instead of hard-clipping */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px;
  background: linear-gradient(to bottom, var(--bg), rgba(255,255,255,0));
  pointer-events: none;
}
.project-scroll {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin;
  padding: 12px 64px 220px;
}

/* left rail */
.leftnav {
  width: 72px; flex: 0 0 72px; height: 100%;
  border-right: 1px solid var(--border);
  background: #fff;
  display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 40;
}
.leftnav-logo { height: 64px; display: flex; align-items: center; justify-content: center; width: 100%; }
.leftnav-add {
  width: 32px; height: 32px; margin: 16px 0; border-radius: var(--r-lg);
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: transform 150ms var(--ease-out), background 150ms;
}
.leftnav-add:hover { transform: scale(1.06); background: #504c3e; }
.navitem {
  width: 56px; height: 56px; margin: 4px 0; border-radius: var(--r-3xl);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--sidebar-fg); font-size: 11px;
  transition: background 150ms var(--ease-out), color 150ms;
}
.navitem:hover { background: var(--bg-subtle); color: var(--fg); }
.navitem.active { background: var(--sidebar-select); color: var(--fg); }
.navitem-projects { border-radius: var(--r-xl); gap: 4px; line-height: 14px; }
.nav-projects-icon { width: 20px; height: 20px; flex: 0 0 20px; display: flex; align-items: center; justify-content: center; }
.leftnav-bottom { margin-top: auto; margin-bottom: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-full); background: var(--saddle);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 500;
}

/* top breadcrumb */
.topbar { height: 44px; display: flex; align-items: center; padding: 0 64px; gap: 6px; font-size: 14px; }
.topbar .crumb { color: var(--fg); }
.topbar .crumb.muted { color: #b9b5ac; }
.topbar .crumb.link { cursor: pointer; }
.topbar .crumb.link:hover { text-decoration: underline; }

/* ---------- projects grid ---------- */
.grid-wrap { padding: 12px 64px 220px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 20px; }
.row-title {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-family: var(--font-serif); font-weight: 300; font-size: 36px; line-height: 44px; letter-spacing: 0;
}
.row-title .chev { transition: transform 200ms var(--ease-out); margin-top: 4px; }
.row-title:hover .chev { transform: translateX(4px); }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px;
  border: 1px solid var(--border-outlined); border-radius: var(--r-full);
  font-weight: 500; font-size: 14px; background: #fff;
  transition: background 150ms, transform 150ms var(--ease-out);
}
.btn-outline:hover { background: var(--bg-subtle); }
.btn-outline:active { transform: scale(0.97); }

.scroll-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -64px; padding: 0 64px; }
.scroll-row::-webkit-scrollbar { display: none; }
.wrap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 8px; }

/* concept card */
.card { flex: 0 0 544px; width: 544px; cursor: pointer; }
.wrap-grid .card { width: auto; flex: initial; }
.card-img {
  position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 544/306;
  background: linear-gradient(135deg, #eae5dc, #d8d0c2);
  border: 1px solid var(--border);
}
/* Figma: Default is slightly zoomed (image 550x308 in a 544x306 frame); Hover settles to exact fit */
.card-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 400ms var(--ease-out); }
.card:hover .card-img img, .card:focus-within .card-img img { transform: scale(1); }
/* AI Label (Figma 40000869:26070): pill, 12/14 white on translucent dark, 7px inset */
.ai-badge {
  position: absolute; right: 8px; bottom: 8px; z-index: 3;
  font-size: 12px; line-height: 14px; color: #fff; background: rgba(52, 49, 40, 0.72);
  padding: 3px 10px 5px; border-radius: var(--r-full);
  backdrop-filter: blur(4px);
}
.ai-badge:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.card-hover-actions {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 6px; padding: 4px;
  background: rgba(255,255,255,0.98); border-radius: 12px; backdrop-filter: blur(20px);
  box-shadow: 0 6px 20px rgba(52,49,40,0.04), 0 4px 8px rgba(52,49,40,0.05), 0 1px 2px rgba(52,49,40,0.06);
  opacity: 0; transform: translateY(-4px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.card:hover .card-hover-actions, .card:focus-within .card-hover-actions { opacity: 1; transform: none; }
.card-hover-actions button {
  width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.card-hover-actions button:hover { background: var(--bg-subtle); }
.card-hover-actions .divider { width: 1px; height: 40px; background: #d9d9d9; }
/* Title Container — bottom gradient overlay, hover/focus only (Figma: pad-top 32→24 + fade) */
.card-title-container {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px; padding: 24px 12px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.68) 100%);
  color: #fff; font-size: 14px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
  pointer-events: none;
}
.card:hover .card-title-container, .card:focus-within .card-title-container { opacity: 1; transform: none; }
.card-title-container .ct-title { font-weight: 500; font-size: 16px; line-height: 24px; }
.card-title-container .ct-divider { width: 1px; height: 24px; background: rgba(217,217,217,0.9); }
.card-title-container .ct-sub { font-weight: 300; font-size: 14px; color: rgba(255,255,255,0.82); }
.card-title-container .palette i { border: 0; margin-left: -7px; }
.card-title-container .palette i:first-child { margin-left: 0; }
.palette { display: flex; }
.palette i {
  width: 16px; height: 16px; border-radius: var(--r-full); border: 1.5px solid #fff; margin-left: -4px;
}

/* ---------- composer ---------- */
.composer-layer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
  padding-bottom: 38px; /* Figma: composer block ends 38px above viewport bottom */
}
.composer {
  pointer-events: auto;
  position: relative; isolation: isolate;
  width: 926px; max-width: calc(100vw - 200px);
  border-radius: 40px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
}
/* --- Backgrounds element (Figma set 4320:15866) — two layers + working ring --- */
.composer-bg { position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; }
.composer-bg i { position: absolute; inset: 0; border-radius: inherit; display: block; }
/* Layer 1 "Blur": near-invisible fill whose job is the 50px backdrop blur */
.composer-bg .bg-blur {
  /* Figma: fill at ~1% opacity but full-strength backdrop blur. CSS `opacity` would
     fade the backdrop-filter too, so the 1% lives in the background alpha instead. */
  background: linear-gradient(105deg, rgba(255,255,255,0.009), rgba(255,255,255,0.006));
  backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px);
}
/* Layer 2 "Fill": white gradient, gradient hairline stroke, triple drop shadow */
.composer-bg .bg-fill {
  background: linear-gradient(105deg, rgba(255,255,255,0.90), rgba(255,255,255,0.75));
  opacity: 0.96;
  box-shadow:
    0 6px 20px 5px rgba(52,49,40,0.04),
    0 4px 8px 2px rgba(52,49,40,0.05),
    0 1px 2px 1px rgba(52,49,40,0.06);
  transition: box-shadow 250ms var(--ease-out), opacity 250ms var(--ease-out);
}
/* 1px outside stroke, vertical gradient (Figma: 52,49,40 @ .5→.8, layer 15%→25%, linear burn) */
.composer-bg .bg-fill::after {
  content: ""; position: absolute; inset: -1px; border-radius: 41px; padding: 1px;
  background: linear-gradient(to bottom, rgba(52,49,40,0.085), rgba(52,49,40,0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  transition: background 250ms var(--ease-out);
}
.composer:hover .composer-bg .bg-fill, .composer:focus-within .composer-bg .bg-fill {
  opacity: 0.98;
  box-shadow:
    0 6px 28px 5px rgba(52,49,40,0.10),
    0 4px 12px 3px rgba(52,49,40,0.10),
    0 1px 2px 0 rgba(52,49,40,0.10);
}
.composer:hover .composer-bg .bg-fill::after, .composer:focus-within .composer-bg .bg-fill::after {
  background: linear-gradient(to bottom, rgba(52,49,40,0.145), rgba(52,49,40,0.225));
}
/* Working state — mirrors the Figma layer stack (Backgrounds, 40003141:75916):
     "Mask"           alpha mask, card shape r40      → .bg-working  (overflow clip, radius inherit)
     "Stroke working" LAYER_BLUR 30                   → .wk-blur     (filter: blur(15px); Figma blur ≈ 2× CSS σ)
                      5px INSIDE stroke               → .wk-ring     (5px transparent border, masked to the border band;
                                                                      inner edge follows r35 via padding-box)
                      GRADIENT_ANGULAR stops          → .wk-spin     (oversized conic square, rotating)
   Order matters: the ring is masked first, THEN blurred, THEN clipped to the card —
   so the glow is a soft haze bleeding inward from the edge, never a crisp line.
   Shared by every prompt hero (Explore composer + Refine composer) via <WorkingGlow/>. */
.composer-bg .bg-working { overflow: hidden; opacity: 0; transition: opacity 300ms var(--ease-out); }
.composer-bg .bg-working::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(ellipse 22% 120% at 50% 50%, rgba(190,149,89,0.22), rgba(231,197,140,0.12) 55%, transparent 100%);
  animation: working-ambient-sweep 2.4s ease-in-out infinite alternate;
}
.composer-bg .wk-blur { filter: blur(15px); }
.composer-bg .wk-ring {
  border: 5px solid transparent;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0) border-box;
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0) border-box;
}
.composer-bg .wk-spin {
  inset: auto; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; border-radius: 0;
  transform: translate(-50%, -50%);
  /* exact Figma stops; angular starts at 3 o'clock (CSS conic starts at 12 → from 90deg) */
  background: conic-gradient(from 90deg,
    #b2a38d 12.9%, rgba(193,164,116,0) 25.2%,
    #cba464 33.1%, rgba(178,163,141,0) 63.5%,
    #e3a53b 76.6%, rgba(208,164,91,0) 87.1%);
  animation: working-spin 3.2s linear infinite;
}
.composer.working .composer-bg .bg-working { opacity: 1; }
.composer.working .composer-bg .bg-fill { opacity: 0.96;
  box-shadow:
    0 6px 20px 5px rgba(52,49,40,0.07),
    0 4px 8px 2px rgba(52,49,40,0.07),
    0 1px 2px 1px rgba(52,49,40,0.07);
}
@keyframes working-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes working-ambient-sweep { from { transform: translateX(-45%); } to { transform: translateX(45%); } }
@media (prefers-reduced-motion: reduce) {
  .composer-bg .wk-spin { animation: none; }
  .composer-bg .bg-working::after { animation: none; }
}
.composer textarea {
  border: 0; outline: 0; background: transparent; resize: none;
  font-size: 16px; line-height: 24px; color: var(--fg);
  min-height: 24px; max-height: 220px; overflow-y: auto; padding: 4px;
  white-space: pre-wrap; overflow-wrap: break-word; overflow-x: hidden;
  transition: height 260ms var(--ease-out);
}
.composer textarea::placeholder { color: #a49e91; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row .spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms;
}
.icon-btn:hover { background: rgba(52,49,40,0.06); }
/* AI disclaimer — 12px below composer, every state (Figma: Sons 14, #635E4F, centered) */
.disclosure { pointer-events: auto; font-size: 14px; color: #635e4f; padding-top: 12px; text-align: center; }
.disclosure a { color: inherit; text-decoration: underline; }

/* Media Chip (Figma set 2284:4697) — 48px pill, layered state fills on rgba(46,43,35,x) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 8px;
  border-radius: var(--r-full);
  background: transparent;
  font-size: 16px; color: var(--fg); white-space: nowrap;
  transition: background 180ms var(--ease-out), transform 120ms var(--ease-out);
}
.chip > svg { margin-left: 4px; }
.chip:hover { background: rgba(46,43,35,0.10); }
.chip:active { background: rgba(46,43,35,0.20); }
.chip.active { background: rgba(46,43,35,0.15); }
.chip.filled { background: rgba(46,43,35,0.05); }
.chip.filled:hover { background: rgba(46,43,35,0.10); }
.chip.filled:active, .chip.active:active { background: rgba(46,43,35,0.20); }
.chip.filled.active { background: rgba(46,43,35,0.15); }
.chip:focus-visible {
  outline: none; background: rgba(46,43,35,0.10);
  box-shadow: inset 0 0 0 1px #fff, 0 0 0 5px #71cdff;
}
.chip .chip-label { /* Figma text container pad 0/8; long style names truncate */
  padding: 0 8px 2px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block;
}
.chip .media-items { display: inline-flex; align-items: center; gap: 4px; }
.media-thumb {
  position: relative; width: 32px; height: 32px; border-radius: 8px; overflow: hidden;
  flex: none; background: #ddd6ca; display: block;
}
.media-thumb.round { border-radius: var(--r-full); }
.media-thumb::after { /* 1px inside gradient stroke @35% */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(52,49,40,0.22); pointer-events: none;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb.type-icon { /* Media Chip Preview Type=Icon: white circle + 16px icon */
  background: #fff; display: flex; align-items: center; justify-content: center;
  color: var(--fg); line-height: 0;
}
.media-thumb .mt-x {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(65,62,50,0.55); opacity: 0; transition: opacity 140ms var(--ease-out);
  border-radius: inherit;
}
.media-thumb[role="button"]:hover .mt-x { opacity: 1; }
.media-thumb[role="button"]:active .mt-x { background: rgba(65,62,50,0.65); }
.media-max {
  width: 32px; height: 32px; border-radius: var(--r-full); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--fg); flex: none;
  box-shadow: inset 0 0 0 1px rgba(52,49,40,0.12);
}
.chip .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(52,49,40,0.2); border-top-color: var(--fg);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes chipthumb-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}
.chip .mini-stack .th { animation: chipthumb-in 260ms var(--ease-spring) backwards; }

/* generate */
.btn-generate {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: var(--r-full); background: var(--primary); color: var(--primary-fg);
  font-weight: 500; font-size: 14px;
  opacity: 0.45; pointer-events: none;
  transition: opacity 250ms, transform 150ms var(--ease-out), background 200ms, width 250ms var(--ease-out);
}
.btn-generate.ready { opacity: 1; pointer-events: auto; }
.btn-generate.ready:hover { background: #504c3e; transform: translateY(-1px); }
.btn-generate.ready:active { transform: scale(0.97); }
.btn-generate.stop { width: 40px; padding: 0; justify-content: center; }

/* ---------- popover panels ---------- */
.backdrop {
  position: absolute; inset: 0; z-index: 45;
  background: transparent; /* invisible click-outside layer; panels retain their own surface */
  backdrop-filter: none; -webkit-backdrop-filter: none;
  opacity: 0;
  transition: opacity var(--dur-pop-in) var(--ease-out);
}
.backdrop.on { opacity: 1; }

.popover {
  pointer-events: auto;
  /* Blur the page only inside the panel, outside its animated child backdrop root. */
  backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px);
  position: absolute; bottom: calc(100% + 10px);
  isolation: isolate;
  z-index: 5; /* in front of the composer so its shadow can't overlap the popover */
  border-radius: 40px;
  padding: 24px;
  transform-origin: bottom center;
}
.popover .composer-bg .bg-blur { backdrop-filter: none; -webkit-backdrop-filter: none; }
/* Release the completed page opacity layer so panel backdrop blur can sample the page. */
.view-enter:has(.popover) { animation-fill-mode: backwards; }
/* popovers hover/focus keep the elevated Backgrounds state (Figma popover Fill = hover spec) */
.popover .composer-bg .bg-fill {
  opacity: 0.98;
  box-shadow:
    0 6px 28px 5px rgba(52,49,40,0.10),
    0 4px 12px 3px rgba(52,49,40,0.10),
    0 1px 2px 0 rgba(52,49,40,0.10);
}
.popover .composer-bg .bg-fill::after {
  background: linear-gradient(to bottom, rgba(52,49,40,0.145), rgba(52,49,40,0.225));
}
.pop-enter { animation: pop-in var(--dur-pop-in) var(--ease-out) backwards; }
.pop-exit { animation: pop-out var(--dur-pop-out) var(--ease-out) both; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.965); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pop-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}
/* heading style per design: 12px Sons Regular #736C5E, room for the close button */
.pop-label {
  font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  color: #736c5e; margin: 0 48px 20px 0; line-height: 18px;
}
.pop-section + .pop-section { margin-top: 24px; }
/* close button — TILE Button / Ghost / sm (icon only): rest transparent, hover #FCFBF8, focus #71CDFF ring */
.pop-close {
  position: absolute; top: 16px; right: 16px; z-index: 6;
  width: 32px; height: 32px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent; transition: background 140ms, transform 120ms var(--ease-out);
}
.pop-close svg { width: 16px; height: 16px; }
.pop-close:hover { background: var(--bg-subtle); }
.pop-close:active { transform: scale(0.94); }
.pop-close:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }

/* dropzone */
.dropzone {
  border: 1.5px dashed rgba(52,49,40,0.25); border-radius: var(--r-3xl);
  min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--fg-muted); font-size: 14px; cursor: pointer;
  transition: border-color 180ms, background 180ms, min-height 250ms var(--ease-out);
}
.dropzone:hover { border-color: rgba(52,49,40,0.5); background: rgba(52,49,40,0.03); }
.dropzone.drag { border-color: var(--fg); background: rgba(52,49,40,0.05); }
.dropzone.small { min-height: 0; width: 96px; height: 120px; flex: 0 0 96px; flex-direction: column; font-size: 12px; text-align: center; padding: 8px; }

/* room / style tiles */
.tile-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tile-row::-webkit-scrollbar { display: none; }
.sel-tile { position: relative; flex: 0 0 auto; cursor: pointer; text-align: left; }
.sel-tile .im {
  display: block;
  width: 148px; height: 96px; border-radius: var(--r-xl); overflow: hidden;
  background: #e7e1d6; border: 1.5px solid transparent;
  transition: border-color 150ms, transform 200ms var(--ease-out);
}
.sel-tile:hover .im { transform: translateY(-2px); }
.sel-tile .im img { width: 100%; height: 100%; object-fit: cover; }
.sel-tile.on .im { border-color: var(--fg); }
.sel-tile .cap { font-size: 12px; margin-top: 6px; color: var(--fg); }
.sel-check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  animation: chipthumb-in 220ms var(--ease-spring) backwards;
}
.upl {
  position: relative; flex: 0 0 auto; width: 96px; height: 120px; border-radius: var(--r-xl); overflow: hidden;
  border: 1.5px solid transparent; cursor: pointer; background: #e7e1d6;
  transition: border-color 150ms;
}
.upl img { width: 100%; height: 100%; object-fit: cover; }
.upl.on { border-color: var(--fg); }
.upl .prog {
  position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.5); overflow: hidden;
}
.upl .prog i { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width 200ms linear; }

/* style tabs — text tabs, active underlined (Figma Composer / Styles) */
.text-tabs { display: flex; gap: 24px; }
.text-tabs button {
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted);
  padding: 2px 0 6px; position: relative; transition: color 180ms;
}
.text-tabs button.on { color: var(--fg); }
.text-tabs button.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--fg);
}
.text-tabs button:hover { color: var(--fg); }

/* Preview Item (Figma set 2163:12188) */
.pi-row { display: flex; gap: 24px; align-items: flex-start; }
.pi-row.scroll { overflow-x: auto; scrollbar-width: none; margin: 8px -24px 0; padding: 8px 24px 0; /* top padding keeps the -8px selected badge unclipped */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 32px), transparent 100%); }
.pi-row.scroll::-webkit-scrollbar { display: none; }
.pi-row.uploads { align-items: flex-start; }
.pitem { flex: none; }
.pi-img {
  position: relative; display: block; width: 100%; border-radius: 24px; overflow: hidden;
  background: #e8e3da; cursor: pointer;
}
.pi-img > span[role="img"], .pi-img > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pi-stroke { /* 1px inside gradient stroke: .25 rest / .40 hover / .50 pressed / .35 selected */
  position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 3;
  background: linear-gradient(to bottom, rgba(52,49,40,0.5), rgba(52,49,40,0.8));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.25; transition: opacity 140ms var(--ease-out);
}
.pi-img:hover .pi-stroke { opacity: 0.40; }
.pi-img:active .pi-stroke { opacity: 0.50; }
.pitem.on .pi-stroke { opacity: 0.35; }
/* overlay layers per Figma: blend layer (#413E32, mix-blend overlay) + 65% tint,
   group opacity 0 rest / 0.8 hover / 1 pressed (loading: tint 40%, always on) */
.pi-ov-blend, .pi-ov-tint {
  position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity 160ms var(--ease-out);
}
.pi-ov-blend { background: #413e32; mix-blend-mode: overlay; }
.pi-ov-tint { background: rgba(65,62,50,0.65); }
.pi-overlay { /* icon layer only */
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 160ms var(--ease-out); border-radius: inherit;
}
.pi-img:hover .pi-ov-blend, .pi-img:hover .pi-ov-tint, .pi-img:hover .pi-overlay { opacity: 0.8; }
.pi-img:active .pi-ov-blend, .pi-img:active .pi-ov-tint, .pi-img:active .pi-overlay { opacity: 1; }
.pitem.loading .pi-overlay, .pitem.err .pi-overlay { display: none; }
.pitem.loading .pi-ov-blend { opacity: 1; }
.pitem.loading .pi-ov-tint { opacity: 1; background: rgba(65,62,50,0.4); }
.pitem.err .pi-ov-blend, .pitem.err .pi-ov-tint { opacity: 0; }
.pi-badge { /* Figma: 32px badge overlapping the top-right corner at (-8,-8) */
  position: absolute; top: -8px; right: -8px; z-index: 4;
  width: 32px; height: 32px; border-radius: var(--r-full); background: #413e32;
  display: flex; align-items: center; justify-content: center; line-height: 0;
}
.pi-badge.red { background: #b8352e; right: auto; left: -8px; }
.pitem { position: relative; }
.pi-remove {
  position: absolute; top: -8px; left: -8px; z-index: 5;
  width: 32px; height: 32px; border-radius: var(--r-full); background: #b8352e;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.8); transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
}
.pitem:hover .pi-remove { opacity: 1; transform: none; }
/* Error/remove controls always use the left corner; selection stays on the right. */
.pi-badge { pointer-events: none; }
.pitem:not(:hover) .pi-remove { pointer-events: none; }
.pitem.loading .pi-img { background: rgba(65,62,50,0.35); cursor: default; }
.pi-spinner {
  position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; z-index: 3;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: spin 900ms linear infinite;
}
.pi-label { font-size: 13px; color: #413e32; text-align: center; margin-top: 8px; line-height: 1.25; }
/* Multi-select item copy (products): left-aligned name + details */
.pi-copy { padding: 0 4px; margin-top: 8px; text-align: left; }
.pi-name { font-size: 13px; font-weight: 500; color: var(--fg); line-height: 16px; }
.pi-desc {
  font-size: 13px; color: var(--fg-muted); line-height: 16px; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pi-grid { display: flex; flex-wrap: wrap; gap: 24px; }
/* heading row with TILE ghost pill link buttons */
.pop-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.pop-btns { display: flex; gap: 16px; margin-left: auto; }
/* TILE Button / Shape=Pill, Only Icon=No, Variant=Ghost, Size=xs:
   32px, pad 0/7, text pad 0/5/1, 14 Medium #343128.
   Default & Pressed transparent, Hover #FCFBF8 + 10% (46,43,35), Focus #71CDFF ring. */
.pop-btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 7px;
  border-radius: var(--r-full); background: transparent;
  font-size: 14px; font-weight: 500; color: var(--fg); line-height: 18px;
  transition: background-color 140ms;
}
.pop-btn > span, .pop-btn { gap: 0; }
.pop-btn .pb-label { padding: 0 5px 1px; }
.pop-btn:hover {
  background-color: #e7e6e3;
}
.pop-btn:active { background: transparent; }
.pop-btn:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
.pop-btn svg { flex: none; }
/* TILE Tertiary xs: #FCFBF8 fill + 24% black stroke, pad 0/10 */
.pop-btn.tertiary { background: #fcfbf8; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.24); padding: 0 10px; }
.pop-btn.tertiary:hover { background-color: #e7e6e3; }
.pop-btn.tertiary:focus-visible { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.24), 0 0 0 5px #71cdff; }
/* Sets screen: separators + primary footer button (TILE primary pill sm) */
.set-sep { height: 1px; background: #d9d8d7; margin: 20px 0; }
.sets-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.btn-primary-pill {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  border-radius: var(--r-full); background: #413e32; color: #fff;
  font-size: 14px; font-weight: 500;
  transition: background 140ms, transform 120ms var(--ease-out);
}
.btn-primary-pill:hover { background: #52493c; }
.btn-primary-pill:active { transform: scale(0.98); }
.btn-primary-pill:disabled { opacity: .4; cursor: default; pointer-events: none; transform: none; }
.btn-primary-pill:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
.btn-primary-pill .pb-label { padding: 0 8px 2px; }

/* No-preview Item (Figma set 2152:5401) — icon + label tile, r=24 */
.np-row { display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; padding: 8px 8px 0 0; margin-top: -8px; }
.np-row::-webkit-scrollbar { display: none; }
.np-item {
  position: relative; flex: none; width: 120px; height: 96px; border-radius: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4px; padding: 8px 8px 0;
  background: rgba(255,255,255,0.5); cursor: pointer; color: var(--fg);
  transition: background 140ms var(--ease-out);
}
.np-item::after { /* 1px inside gradient stroke: .25 rest / .40 hover / .30 pressed / .35 active */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(52,49,40,0.5), rgba(52,49,40,0.8));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.25; transition: opacity 140ms var(--ease-out);
}
.np-item:hover { background: rgba(255,255,255,0.9); }
.np-item:hover::after { opacity: 0.40; }
.np-item:active { background: rgba(255,255,255,0.7); }
.np-item:active::after { opacity: 0.30; }
.np-item.active::after { opacity: 0.35; }
.np-item:focus-visible { outline: none; background: rgba(255,255,255,0.8); }
.np-item:focus-visible::after {
  opacity: 1; background: linear-gradient(to bottom, #d9d8d7, #b2b1b0);
}
.np-item > svg { margin-top: 17px; flex: none; } /* Figma: icon top at 25px (8px pad + 17); direct child only so the badge check stays centered */
.np-label { font-size: 13px; color: #413e32; line-height: 18px; text-align: center; width: 100%; }
.np-badge {
  position: absolute; top: -8px; right: -8px; z-index: 3;
  width: 32px; height: 32px; border-radius: var(--r-full); background: #413e32;
  display: flex; align-items: center; justify-content: center; line-height: 0;
}
.np-badge svg, .pi-badge svg { display: block; }
.np-badge, .pi-badge { color: #fff; }
/* dropzone as No-preview Item Type=Drop Filed / Drop Button — dashed gradient stroke */
.np-drop {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 80px; border-radius: 24px; cursor: pointer;
  font-size: 14px; color: #736c5e;
  transition: background 140ms var(--ease-out);
}
.np-drop svg { color: #736c5e; flex: none; }
.np-drop span { padding: 0 4px; }
.np-drop::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1px dashed rgba(52,49,40,0.42);
  opacity: 0.85; transition: opacity 140ms;
}
.np-drop:hover::after { opacity: 1; border-color: rgba(52,49,40,0.55); }
.np-drop:active::after { border-color: rgba(52,49,40,0.65); }
.np-drop:hover { background: rgba(52,49,40,0.02); }
.np-drop.button {
  flex-direction: column; width: 120px; height: 96px; flex: none;
  font-size: 13px; text-align: center; gap: 4px; padding: 0 8px;
}
.np-drop.button svg { width: 26px; height: 26px; }

/* products popover */
.prod-grid { display: grid; grid-template-columns: repeat(6, 118px); gap: 10px; }
.prod-tile { position: relative; cursor: pointer; text-align: left; }
.prod-tile .im {
  display: block;
  width: 118px; height: 88px; border-radius: var(--r-xl); background: #fff;
  border: 1.5px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center;
  transition: border-color 150ms, transform 180ms var(--ease-out);
}
.prod-tile:hover .im { transform: translateY(-2px); }
.prod-tile.on .im { border-color: var(--fg); }
.prod-tile .im img { width: 100%; height: 100%; object-fit: cover; }
.prod-tile .nm { font-size: 12px; font-weight: 500; margin-top: 6px; }
.prod-tile .ds { font-size: 11px; color: var(--fg-muted); margin-top: 1px; line-height: 1.25; }
.pop-links { display: flex; gap: 20px; }
.pop-links a { font-size: 13px; color: var(--fg); cursor: pointer; text-decoration: none; }
.pop-links a:hover { text-decoration: underline; }
.pop-links a .arr { display: inline-block; transition: transform 180ms var(--ease-out); }
.pop-links a:hover .arr { transform: translateX(3px); }

/* product sets */
.set-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.set-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 8px; }
.checkbox {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid rgba(52,49,40,0.4);
  margin-top: 34px; flex: 0 0 18px; display: flex; align-items: center; justify-content: center;
  background: #fff; transition: background 150ms, border-color 150ms;
}
.checkbox.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* settings popover — Figma Composer / Settings (2732:17704) + Settings Select Item (2732:15536) */
.settings-stack { display: flex; flex-direction: column; gap: 16px; }
.settings-group { display: flex; flex-direction: column; gap: 12px; }
.settings-label {
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #736c5e; padding: 0 8px;
}
.settings-track {
  display: flex; width: 100%; border-radius: var(--r-full);
  background: rgba(46,43,35,0.05);
}
.settings-item {
  flex: 1 1 0; height: 48px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 12px; font-size: 14px; color: var(--fg);
  background: transparent; transition: background 140ms var(--ease-out);
}
.settings-item span { padding: 0 4px 2px; }
.settings-item svg { flex: none; }
.settings-item:hover { background: rgba(46,43,35,0.10); }
.settings-item:active { background: rgba(46,43,35,0.20); }
.settings-item.on { background: rgba(46,43,35,0.30); }
.settings-item.on:hover { background: rgba(46,43,35,0.40); }
.settings-item.on:active { background: rgba(46,43,35,0.20); }
.settings-item:focus-visible {
  outline: none; box-shadow: inset 0 0 0 1px #fff, 0 0 0 5px #71cdff;
}

/* ---------- catalogue modal ---------- */
.modal-layer { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-backdrop {
  position: absolute; inset: 0; background: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  opacity: 0; transition: opacity 250ms var(--ease-out);
}
.modal-backdrop.on { opacity: 1; }
.catalog {
  position: relative; width: min(1800px, calc(100vw - 120px)); height: calc(100vh - 120px);
  background: rgba(255,255,255,0.96); border-radius: var(--r-4xl);
  box-shadow: 0 24px 80px rgba(52,49,40,0.22);
  display: flex; overflow: hidden;
  animation: modal-in 320ms var(--ease-out) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.catalog.closing { animation: modal-out 200ms var(--ease-out) both; }
@keyframes modal-out { to { opacity: 0; transform: translateY(14px) scale(0.985); } }
.mini-prod .im, .explore-summary .im { display: block; }
.btn-primary {
  height: 44px; border-radius: var(--r-full); background: var(--primary); color: #fff;
  font-weight: 500; padding: 0 20px;
  transition: background 150ms, transform 150ms var(--ease-out), opacity 200ms;
}
.btn-primary:hover { background: #504c3e; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }
.cat-back { position: absolute; top: 16px; left: 16px; display: flex; align-items: center; gap: 4px; font-size: 13px; z-index: 2; padding: 8px 12px; border-radius: var(--r-full); }
.cat-back:hover { background: var(--bg-subtle); }
.cat-x { position: absolute; top: 16px; right: 16px; z-index: 2; opacity: 0.7; padding: 8px; }
.cat-x:hover { opacity: 1; }

/* ---------- logged out ---------- */
.hero-collage { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 12px; }
.hero-col { display: flex; flex-direction: column; gap: 12px; animation: drift 60s linear infinite alternate; }
.hero-col:nth-child(2) { animation-duration: 80s; animation-direction: alternate-reverse; }
.hero-col img, .hero-col .ph { width: 100%; border-radius: var(--r-lg); object-fit: cover; }
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(-140px); } }
.hero-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 62% 55% at 50% 46%, rgba(255,255,255,0) 38%, #fff 78%);
  pointer-events: none;
}

/* ---------- Explore feed (Figma: Explore - Generating / Concept 1 / Concept 2) ---------- */
/* same warm backdrop as Refine mode (Darek, 2026-10-05) */
.xp-root { background: linear-gradient(180deg, #fcfbf8 0%, #f7f4ed 100%); }
/* Scroll container: only the feed scrolls — the composer is pinned to the viewport bottom.
   The feed itself is bottom-aligned (margin-top:auto), so the newest card always sits the same
   distance above the composer no matter how many concepts exist. */
.xp-scroll {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column;
}
.xp-feed {
  width: 100%; margin-top: auto;
  /* 266 = composer block (~226 from viewport bottom) + 40px card→composer gap per Figma */
  padding: 20px 64px 266px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}

/* Expanded Concept Card — 1572×607, r32, p16, info 468 + hero 1024×575 */
.xp-card {
  position: relative;
  width: min(1572px, 100%);
  background: #fff; border-radius: 32px;
  padding: 16px; display: flex; justify-content: flex-end;
  /* generating → concept morph: runs in lockstep with the image unblur (both 1200ms) */
  transition: width 1200ms var(--ease-out), transform 1200ms var(--ease-out);
}
/* Card stroke (Figma): 1px inside gradient rgba(52,49,40, .5→.8), layer 15%, linear burn —
   same recipe as the composer rest stroke, so same pre-computed values (.085→.14) */
.xp-card::after, .xp-mini::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(52,49,40,0.085), rgba(52,49,40,0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* The info column is ABSOLUTE so the hero image alone defines the card height —
   the card hugs the image and the products grid clips (second row partially visible).
   Its width follows the card width implicitly (left 16 / right = pad+image+gap). */
.xp-info {
  position: absolute; top: 16px; bottom: 16px; left: 16px; right: 1072px; /* 16+1024+32 */
  padding: 24px 0 8px 24px;
  display: flex; flex-direction: column;
  overflow: hidden; /* clips the fixed-width inner while the card is collapsed/expanding */
}
/* fixed-width inner stops text reflowing during the width morph — it slides out from the clip */
.xp-info-inner {
  width: 436px; height: 100%; min-height: 0;
  display: flex; flex-direction: column; gap: 32px;
  transition: opacity 760ms var(--ease-out) 420ms, transform 1040ms var(--ease-out) 160ms;
}
.xp-top { display: flex; flex-direction: column; gap: 16px; }
.xp-info h1 {
  font-family: var(--font-serif); font-weight: 300; font-size: 28px; line-height: 34px; margin: 0;
}
.xp-desc { font-size: 14px; line-height: 18px; color: #736c5e; margin-top: -8px; }
.xp-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; line-height: 14px; color: #413e32;
}
.xp-meta .palette i { width: 24px; height: 24px; border: 1px solid #fff; margin-left: -8px; }
.xp-meta .palette i:first-child { margin-left: 0; }
/* Products grid — 3×120 columns, 24 gap, 336px viewport with thin scrollbar */
.xp-prod-grid {
  display: grid; grid-template-columns: repeat(3, 120px); gap: 24px;
  flex: 0 1 auto; min-height: 96px; /* shrinks to the card's image-driven height — rows clip */
  max-height: 336px; overflow-y: auto; overflow-x: hidden;
  padding-right: 12px;
  scrollbar-width: thin; scrollbar-color: var(--primary) var(--border);
  /* blend-out at the list end (Figma mask 40003084: stops 1@82% → .35@90% → .17@96% → 0) */
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, rgba(0,0,0,0.35) 90%, rgba(0,0,0,0.17) 96%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 82%, rgba(0,0,0,0.35) 90%, rgba(0,0,0,0.17) 96%, transparent 100%);
}
.xp-prod-grid::-webkit-scrollbar { width: 2px; }
.xp-prod-grid::-webkit-scrollbar-track { background: var(--border); }
.xp-prod-grid::-webkit-scrollbar-thumb { background: var(--primary); }
.xp-prod { width: 120px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.xp-prod .im {
  position: relative;
  display: block; width: 120px; height: 96px; border-radius: var(--r-4xl);
  overflow: hidden; background: #fff;
  transition: transform 180ms var(--ease-out);
}
/* Product tile stroke (Figma): same gradient, layer 25%, linear burn → .145→.225 */
.xp-prod .im::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(to bottom, rgba(52,49,40,0.145), rgba(52,49,40,0.225));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.xp-prod:hover .im { transform: translateY(-2px); }
.xp-prod .im img { width: 100%; height: 100%; object-fit: cover; }
.xp-prod .nm {
  font-size: 13px; font-weight: 500; line-height: 16px; color: var(--fg); padding: 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xp-prod .ds {
  font-size: 13px; line-height: 16px; color: var(--fg-muted); padding: 0 4px; margin-top: -4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Refine — TILE secondary pill (Figma 40000919:25994): #E9E8E7 fill, #B2B1B0 stroke, h40 */
.btn-refine {
  align-self: flex-start; margin-top: auto; display: inline-flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 16px; border-radius: var(--r-full);
  background: #e9e8e7; border: 1px solid #b2b1b0;
  font-size: 14px; font-weight: 500; color: #413e32;
  transition: background 140ms, transform 120ms var(--ease-out);
}
.btn-refine:hover { background: #dfdedd; }
.btn-refine:active { transform: scale(0.98); }
/* Hero image — 1024×575, r16, hairline border */
.xp-visual {
  position: relative; flex: 0 1 1024px; min-width: 55%;
  aspect-ratio: 1024 / 575; align-self: flex-start;
  /* Figma: #8E8D8B @ luminosity + black 20% normal — flattened over photography ≈ #72716F */
  border-radius: var(--r-3xl); border: 1px solid #72716f; overflow: hidden; background: #efece5;
}
.xp-visual > img, .xp-visual > .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xp-visual img.blurred { filter: blur(34px); transform: scale(1.06); }
.xp-visual img.reveal { animation: unblur 1200ms var(--ease-out) both; }
@keyframes unblur {
  from { filter: blur(34px); transform: scale(1.06); }
  60% { filter: blur(8px); }
  to { filter: blur(0); transform: scale(1); }
}
/* Soft, slowly morphing colour forms give the blurred render visible motion. */
.shimmer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.shimmer::before, .shimmer::after { content: ""; position: absolute; filter: blur(clamp(32px, 4vw, 64px)); will-change: transform, border-radius; }
.shimmer::before {
  left: 8%; top: -12%; width: 34%; height: 76%; background: rgba(255,244,217,0.68);
  border-radius: 58% 42% 64% 36% / 43% 61% 39% 57%;
  animation: ambient-blob-a 5.6s ease-in-out infinite alternate;
}
.shimmer::after {
  left: 62%; top: 23%; width: 24%; height: 64%; background: rgba(136,99,58,0.36);
  border-radius: 42% 58% 37% 63% / 62% 39% 61% 38%;
  animation: ambient-blob-b 6.4s ease-in-out infinite alternate;
}
@keyframes ambient-blob-a {
  0% { transform: translate(0, 0) rotate(-12deg) scale(0.92); border-radius: 58% 42% 64% 36% / 43% 61% 39% 57%; }
  50% { transform: translate(65%, 18%) rotate(8deg) scale(1.12, 0.94); border-radius: 37% 63% 43% 57% / 64% 38% 62% 36%; }
  100% { transform: translate(125%, -2%) rotate(23deg) scale(0.96, 1.12); border-radius: 62% 38% 56% 44% / 39% 57% 43% 61%; }
}
@keyframes ambient-blob-b {
  0% { transform: translate(0, 0) rotate(14deg) scale(0.9); border-radius: 42% 58% 37% 63% / 62% 39% 61% 38%; }
  50% { transform: translate(-65%, -21%) rotate(-9deg) scale(1.12, 0.95); border-radius: 61% 39% 57% 43% / 42% 63% 37% 58%; }
  100% { transform: translate(-115%, 7%) rotate(-22deg) scale(0.95, 1.08); border-radius: 36% 64% 47% 53% / 59% 41% 64% 36%; }
}
@media (prefers-reduced-motion: reduce) { .shimmer::before, .shimmer::after { animation: none; } }

/* Generating (Figma: Explore - Generating): the card hugs the image — the absolute info
   column's width collapses to nothing (its right offset exceeds the card width).
   On landing the gen class drops: width morph + image unblur run together (1200ms). */
.xp-card.gen {
  width: min(1056px, 100%); /* 16 + 1024 + 16 */
  /* Stay centered while loading; expand on completion as the left info panel reveals. */
  transform: none;
}
.xp-card.gen .xp-info { pointer-events: none; }
.xp-card.gen .xp-info-inner { opacity: 0; transform: translateX(-24px); transition-delay: 0ms, 0ms; }

/* Collapsed Concept Card — 609×100, r24, title + meta + palette + 121×68 thumb */
.xp-mini {
  position: relative;
  width: 609px; max-width: 100%;
  background: #fff; border-radius: var(--r-4xl);
  padding: 16px; display: flex; align-items: center; gap: 16px;
  text-align: left; cursor: pointer;
  transition: background 150ms, box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.xp-mini:hover { background: var(--bg-subtle); box-shadow: 0 4px 16px rgba(52,49,40,0.08); transform: translateY(-1px); }
.xp-mini .t { flex: 1; min-width: 0; padding-left: 8px; display: flex; flex-direction: column; gap: 8px; }
.xp-mini .nm { font-family: var(--font-serif); font-weight: 300; font-size: 22px; line-height: 30px; }
.xp-mini .mt {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; line-height: 14px; color: #413e32;
}
.xp-mini .mt .palette i { width: 20px; height: 20px; border: 1px solid #fff; margin-left: -7px; }
.xp-mini .mt .palette i:first-child { margin-left: 0; }
.xp-mini .im { width: 121px; height: 68px; border-radius: 12px; overflow: hidden; flex: none; }
.xp-mini .im img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Refine mode (Figma: Refine - main … New version, Oct 2026)
   ============================================================ */
.rf-root {
  position: absolute; inset: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fcfbf8 0%, #f7f4ed 100%);
}

/* ---- top bar: breadcrumbs + actions ---- */
.rf-top {
  flex: none; height: 80px; padding: 0 64px;
  display: flex; align-items: center; justify-content: space-between;
  animation: rf-drop 420ms var(--ease-out) both;
}
@keyframes rf-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.rf-crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--fg); }
.rf-crumbs .sep { color: #b9b5ac; }
.rf-crumbs .link { cursor: pointer; }
.rf-crumbs .link:hover { text-decoration: underline; }
.rf-top-actions { display: flex; align-items: center; gap: 16px; }
/* TILE Button / Ghost icon-only: 40px, rest transparent, hover 6% fill, focus ring */
.rf-icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center; color: var(--fg);
  transition: background 140ms, transform 120ms var(--ease-out);
}
.rf-icon-btn:hover { background: rgba(52,49,40,0.06); }
.rf-icon-btn:active { transform: scale(0.94); }
.rf-icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
/* TILE Tertiary pill: #FCFBF8 fill + 24% stroke (selector-active spec) */
.rf-details-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 16px 1px;
  border-radius: var(--r-full); background: var(--bg-subtle);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.24);
  font-size: 14px; font-weight: 500; color: var(--fg);
  transition: background 140ms, transform 120ms var(--ease-out);
}
.rf-details-btn span { padding: 0 4px; }
.rf-details-btn:hover { background-color: #e7e6e3; }
.rf-details-btn:active { transform: scale(0.98); }
.rf-details-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.24), 0 0 0 5px #71cdff; }
/* TILE Primary pill sm */
.rf-done {
  height: 40px; padding: 0 20px 1px; border-radius: var(--r-full);
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
  transition: background 140ms, transform 120ms var(--ease-out);
}
.rf-done:hover { background: #504c3e; }
.rf-done:active { transform: scale(0.97); }
.rf-done:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }

/* ---- floating tool rail ---- */
.rf-rail {
  /* centered on the CANVAS area, not the viewport: stage spans from the 80px top bar
     to the 196px composer reserve → its midline is 50vh − (196−80)/2 = 50% − 58px */
  position: absolute; left: 64px; top: calc(50% - 58px); transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; gap: 8px; padding: 8px;
  transition: left 420ms var(--ease-out); /* nudges left as the sidebar pushes in */
  background: #fff; border-radius: 40px; /* Figma Toolbar: Blur/Fill layers r=40, gap 8 */
  box-shadow: 0 6px 20px rgba(52,49,40,0.06), 0 1px 2px rgba(52,49,40,0.08);
  animation: rf-rail-in 420ms var(--ease-out) both; animation-delay: 80ms;
}
@keyframes rf-rail-in { from { opacity: 0; transform: translate(-14px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.rf-rail::after { /* same hairline recipe as the cards */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(52,49,40,0.085), rgba(52,49,40,0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* sidebar open (Figma 40003142:76446): toolbar shifts to x=32 */
.rf-root:has(.rf-side-wrap.open) .rf-rail { left: 32px; }
.rf-tool {
  width: 48px; height: 48px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center; color: var(--fg);
  transition: background 140ms, transform 120ms var(--ease-out);
  animation: chipthumb-in 260ms var(--ease-spring) backwards;
}
.rf-tool:hover { background: rgba(46,43,35,0.10); }
.rf-tool:active { background: rgba(46,43,35,0.20); transform: scale(0.95); }
.rf-tool.on { background: rgba(46,43,35,0.15); }
.rf-tool:focus-visible { outline: none; box-shadow: inset 0 0 0 1px #fff, 0 0 0 5px #71cdff; }

/* ---- stage: canvas + sidebar ---- */
.rf-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center; /* canvas card hugs the image */
  padding: 0 64px 196px 64px; gap: 0;
}
.rf-canvas {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: #fff; border-radius: 32px; position: relative;
  animation: rf-canvas-in 460ms var(--ease-out) both;
  transition: margin 420ms var(--ease-out);
}
@keyframes rf-canvas-in { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: none; } }
.rf-canvas::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(52,49,40,0.085), rgba(52,49,40,0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.rf-canvas-img {
  position: relative;
  /* same aspect as the Explore hero (1024×575 ≈ 16:9), never cropped/zoomed:
     height-bound at 1920×1080 (stage = 100vh − 80 top − 196 composer − 32 canvas padding),
     width-bound when the details sidebar is open */
  aspect-ratio: 1024 / 575;
  /* the container now hugs the image, so both bounds come from the viewport:
     width-avail = 100vw − stage padding 128 − card padding 32 (− sidebar 432 when open) */
  width: min(calc(100vw - 160px), calc((100vh - 308px) * 1024 / 575));
  transition: width 420ms var(--ease-out); /* follows the sidebar slide */
  border-radius: var(--r-3xl); overflow: hidden; background: #efece5;
  border: 1px solid #72716f; /* flattened luminosity + black 20% composite */
}
.rf-canvas-img > img, .rf-canvas-img > .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rf-canvas-img img.blurred { filter: blur(34px); transform: scale(1.06); }
.rf-canvas-img img.reveal { animation: unblur 1200ms var(--ease-out) both; }
.rf-canvas.gen .rf-canvas-img { border-color: transparent; }
/* Sidebar open (Figma 40003087:19779): image 1218×684 at 1920 — the canvas scales down
   proportionally inside the remaining 1488px area, leaving ~119px clear for the toolbar
   (100vw − 432 sidebar − 238 side insets − 32 card padding = 100vw − 702) */
.rf-stage:has(.rf-side-wrap.open) .rf-canvas-img {
  width: min(calc(100vw - 702px), calc((100vh - 308px) * 1024 / 575));
}

/* product hotspots — 26px white ring + dot, pulse on hover */
.rf-hotspot {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 4;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 6px rgba(52,49,40,0.35), inset 0 0 0 1px rgba(52,49,40,0.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform 180ms var(--ease-spring), box-shadow 180ms;
  animation: chipthumb-in 320ms var(--ease-spring) backwards;
}
.rf-hotspot::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fg);
  transition: transform 180ms var(--ease-spring);
}
.rf-hotspot:hover { transform: scale(1.25); }
.rf-hotspot:active { transform: scale(1.1); }
.rf-hotspot.on { transform: scale(1.25); box-shadow: 0 1px 6px rgba(52,49,40,0.35), 0 0 0 4px rgba(255,255,255,0.45); }
.rf-hotspot.on::after { transform: scale(1.3); }
.rf-hotspot:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }

/* ---- sidebar: slide/collapse — canvas reflows via width transition ---- */
.rf-side-wrap {
  flex: 0 0 0px; width: 0; min-width: 0; overflow: visible;
  align-self: stretch; /* the sidebar stays full stage height while the canvas hugs its image */
  transition: flex-basis 420ms var(--ease-out), width 420ms var(--ease-out);
  position: relative;
}
.rf-side-wrap.open { flex-basis: 432px; width: 432px; }
.rf-side {
  /* Figma (40003115:36654): the sidebar card is viewport-pinned — 104 from the top,
     24 from the right and bottom edges, running past the composer reserve to the view's
     bottom. The wrap only reserves layout space; the card itself is fixed. */
  position: fixed; top: 104px; right: 24px; bottom: 24px; width: 408px; z-index: 30;
  background: #fff; border-radius: 40px; padding: 24px;
  display: flex; flex-direction: column; overflow: hidden;
  /* pure push: slides in fully from beyond the right edge while the canvas narrows and
     the prompt hero shifts left — one coordinated 420ms movement, no fade */
  transform: translateX(456px);
  transition: transform 420ms var(--ease-out);
  pointer-events: none;
}
.rf-side::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(52,49,40,0.085), rgba(52,49,40,0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.rf-side-wrap.open .rf-side { transform: none; pointer-events: auto; }
.rf-side-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
.rf-side-inner {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 24px; padding-top: 8px;
  animation: rf-panel-swap 300ms var(--ease-out) both;
}
@keyframes rf-panel-swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* concept header in sidebar */
.rf-concept-head { display: flex; flex-direction: column; gap: 8px; flex: none; }
.rf-concept-head h2 { font-family: var(--font-serif); font-weight: 300; font-size: 28px; line-height: 34px; margin: 0; color: #000; padding-right: 40px; }
.rf-concept-head .desc { margin: 0; font-size: 14px; line-height: 18px; color: #736c5e; }
.rf-concept-head .meta {
  margin-top: 8px; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; line-height: 14px; color: #413e32;
}
.rf-concept-head .meta .palette i { width: 24px; height: 24px; border: 1px solid #fff; margin-left: -8px; }
.rf-concept-head .meta .palette i:first-child { margin-left: 0; }

/* segmented selector (Figma 40003115:36517): 5% track + 10% stroke, active = subtle card */
.rf-selector {
  flex: none; display: flex; gap: 8px; padding: 4px; width: 100%;
  background: rgba(46,43,35,0.05); border: 1px solid rgba(0,0,0,0.1); border-radius: var(--r-full);
}
.rf-selector button {
  flex: 1 1 0; height: 40px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 500; color: var(--fg); padding-bottom: 1px;
  transition: background 160ms var(--ease-out), box-shadow 160ms;
}
.rf-selector button:hover { background: rgba(46,43,35,0.08); }
.rf-selector button.on {
  background: var(--bg-subtle); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.24);
}
.rf-selector button:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }

/* product rows */
.rf-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 24px; }
.rf-row { display: flex; align-items: center; gap: 12px; }
/* TILE Checkbox md: 20px, r4, #B2B1B0 stroke + sm shadow; checked = primary fill */
.rf-check {
  flex: none; width: 20px; height: 20px; border-radius: 4px;
  background: #fff; border: 1px solid #b2b1b0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: background 140ms, border-color 140ms, transform 120ms var(--ease-out);
}
.rf-check:hover { border-color: #8e8d8b; }
.rf-check:active { transform: scale(0.92); }
.rf-check.on { background: var(--primary); border-color: var(--primary); }
.rf-check.on svg { animation: chipthumb-in 180ms var(--ease-spring) backwards; }
.rf-check:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
.rf-row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; text-align: left;
  border-radius: var(--r-4xl); transition: background 140ms;
}
.rf-row-main .im {
  flex: none; width: 120px; height: 96px; border-radius: var(--r-4xl); overflow: hidden;
  border: 1px solid rgba(52,49,40,0.22); background: #fff; position: relative;
}
.rf-row-main .im img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.rf-row-main:hover .im img { transform: scale(1.05); }
.rf-row-main .copy { flex: 1; min-width: 0; padding: 0 4px 0 8px; display: flex; flex-direction: column; gap: 4px; }
.rf-row-main .nm { font-size: 13px; font-weight: 500; line-height: 16px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-row-main .ds { font-size: 13px; line-height: 16px; color: var(--fg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rf-row-main .chev { flex: none; color: var(--fg); transition: transform 180ms var(--ease-out); }
.rf-row-main:hover .chev { transform: translateX(3px); }
.rf-row-main:focus-visible { outline: none; box-shadow: 0 0 0 3px #71cdff; }

/* footer: taxes + total + buy */
.rf-foot { flex: none; display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.rf-foot .tax { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--fg); }
.rf-foot .tax a { color: inherit; }
.rf-foot .total {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 20px; font-weight: 500; line-height: 28px; color: #343128;
}
.rf-buy {
  height: 48px; border-radius: var(--r-full); background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 500; width: 100%;
  transition: background 140ms, transform 120ms var(--ease-out);
}
.rf-buy:hover { background: #504c3e; }
.rf-buy:active { transform: scale(0.99); }
.rf-buy:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }

/* history */
.rf-history { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 24px; }
.rf-version { display: flex; flex-direction: column; gap: 8px; text-align: left; border-radius: var(--r-3xl); }
.rf-version .im {
  position: relative; width: 100%; aspect-ratio: 360/202; border-radius: var(--r-3xl); overflow: hidden;
  border: 1px solid rgba(52,49,40,0.22);
}
.rf-version .im img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.rf-version:hover .im img { transform: scale(1.03); }
.rf-version .eye {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.92); color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  animation: chipthumb-in 220ms var(--ease-spring) backwards;
}
.rf-version.on .im { border-color: rgba(52,49,40,0.5); }
.rf-version .thumbs { display: flex; gap: 8px; }
.rf-version .thumbs .th { width: 32px; height: 32px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(52,49,40,0.2); }
.rf-version .thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.rf-version .cap { font-size: 13px; line-height: 17px; color: var(--fg-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rf-version:focus-visible { outline: none; box-shadow: 0 0 0 3px #71cdff; }

/* product detail panel */
.rf-back {
  align-self: flex-start; flex: none; display: inline-flex; align-items: center; gap: 2px;
  height: 32px; padding: 0 10px 1px 6px; margin: -4px 0 -12px -6px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 500; color: var(--fg-muted);
  transition: background 140ms, color 140ms;
}
.rf-back:hover { background: var(--bg-subtle); color: var(--fg); }
.rf-back:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
.rf-prod-head { flex: none; display: flex; flex-direction: column; gap: 8px; }
.rf-prod-head h2 { font-family: var(--font-serif); font-weight: 300; font-size: 28px; line-height: 34px; margin: 0; color: #000; }
.rf-prod-head .sub { margin: 0; font-size: 14px; line-height: 18px; color: var(--fg); }
.rf-prod-head .price-row { display: flex; align-items: flex-start; justify-content: space-between; margin-top: 8px; }
.rf-prod-head .price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 4px; }
.rf-prod-head .price .p { font-size: 20px; font-weight: 500; line-height: 24px; color: var(--fg); }
.rf-prod-head .price .u { font-size: 14px; font-weight: 500; color: var(--fg); }
.rf-prod-head .price .set { width: 100%; font-size: 13px; color: var(--fg-muted); }
/* TILE Product Badge / xs (10480:251, inner Badge node): 16px, r2, 1px inside stroke,
   pad 2/4, 10px Sons Medium */
.rf-prod-head .badges { display: flex; gap: 4px; flex: none; align-items: flex-start; }
.rf-prod-head .badge {
  display: inline-flex; align-items: center; height: 16px; padding: 0 4px 1px;
  font-size: 10px; font-weight: 500; line-height: 10px; border-radius: 2px;
  white-space: nowrap; flex: none; /* never wrap or squeeze ("Pre-order" broke at the hyphen) */
  background: #fff; color: #413e32; box-shadow: inset 0 0 0 1px #d9d8d7; /* Featured / Bestseller */
}
.rf-prod-head .badge.accent { background: #daeaf2; color: #195b7f; box-shadow: inset 0 0 0 1px #b0c6d2; } /* Logistics / Pre-order */
.rf-prod-actions { flex: none; display: flex; gap: 8px; padding-top: 8px; }
.rf-prod-actions > button { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; }
.rf-prod-actions .pop-btn { gap: 6px; }

/* ---- tab pane switch (Variants ⇄ Details): header/selector stay, only the pane moves.
   Direction mirrors the segmented control (→ Details: old out LEFT, new in from RIGHT);
   enter/exit are staged per content chunk (direct children). */
.rf-tabwrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rf-tabpane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rf-tabpane.exit { position: absolute; inset: 0; pointer-events: none; }
@keyframes rf-tab-out-l { to { opacity: 0; transform: translateX(-36px); } }
@keyframes rf-tab-out-r { to { opacity: 0; transform: translateX(36px); } }
@keyframes rf-tab-in { from { opacity: 0; transform: translateX(var(--tab-from)); } to { opacity: 1; transform: none; } }
.rf-tabpane.enter.from-right { --tab-from: 44px; }
.rf-tabpane.enter.from-left { --tab-from: -44px; }
.rf-tabpane.enter.from-right > * > *, .rf-tabpane.enter.from-left > * > * {
  animation: rf-tab-in 340ms var(--ease-out) both;
}
.rf-tabpane.exit.to-left > * > * { animation: rf-tab-out-l 220ms var(--ease-out) both; }
.rf-tabpane.exit.to-right > * > * { animation: rf-tab-out-r 220ms var(--ease-out) both; }
/* chunk stagger: groups/accordions follow each other */
.rf-tabpane.enter > * > *:nth-child(2) { animation-delay: 50ms; }
.rf-tabpane.enter > * > *:nth-child(3) { animation-delay: 100ms; }
.rf-tabpane.enter > * > *:nth-child(4) { animation-delay: 150ms; }
.rf-tabpane.enter > * > *:nth-child(n+5) { animation-delay: 190ms; }
.rf-tabpane.exit > * > *:nth-child(2) { animation-delay: 30ms; }
.rf-tabpane.exit > * > *:nth-child(3) { animation-delay: 60ms; }
.rf-tabpane.exit > * > *:nth-child(n+4) { animation-delay: 90ms; }

/* concept pane content (Products tab): list + footer as stagger chunks */
.rf-cpane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 24px; }

/* variants */
.rf-variants { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 24px; }
.rf-novariants { margin: 0; font-size: 13px; line-height: 17px; color: var(--fg-muted); }
.rf-variants .group { display: flex; flex-direction: column; gap: 12px; }
.rf-variants .lbl { font-size: 14px; line-height: 18px; color: var(--fg); }
.rf-variants .lbl .k { font-weight: 500; }
.rf-variants .swatches { display: flex; gap: 8px; flex-wrap: wrap; }
/* Swatch — TILE Radio Pattern / Image Only / xs (set 12283:4598):
   48×48 outer r8 with a 40×40 r4 image inside (1:1), state lives on the border */
.rf-variants .sw {
  position: relative; width: 48px; height: 48px; border-radius: 8px;
  padding: 3px; background: #fff; display: flex; align-items: center; justify-content: center;
  border: 1px solid #e9e8e7;
  transition: border-color 140ms, border-width 140ms, padding 140ms;
}
.rf-variants .sw img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.rf-variants .sw:hover { border-color: #d9d8d7; }
.rf-variants .sw:active { border-color: #b2b1b0; }
.rf-variants .sw.on { border-width: 2px; padding: 2px; border-color: #413e32; }
.rf-variants .sw.on:hover { border-color: #b2b1b0; }
.rf-variants .sw.on:active { border-color: #8e8d8b; }
.rf-variants .sw:focus-visible { outline: none; box-shadow: 0 0 0 4px #71cdff; }
.rf-variants .sw.gloss::before {
  content: ""; position: absolute; inset: 3px; z-index: 1; border-radius: 4px; pointer-events: none;
  background: linear-gradient(118deg, transparent 38%, rgba(255,255,255,0.75) 50%, transparent 62%);
}
/* size chips (Figma 40003142:76457): 3 equal columns — each ⅓ of the row minus gaps;
   a 2-chip bottom row keeps the same cell width as the top row */
.rf-variants .sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rf-variants .sz {
  height: 48px; padding: 0 8px 1px; width: 100%; border-radius: 8px;
  border: 1px solid rgba(52,49,40,0.28); font-size: 14px; color: var(--fg); background: #fff;
  transition: border-color 140ms, box-shadow 140ms, transform 120ms var(--ease-out);
}
.rf-variants .sz:hover { border-color: rgba(52,49,40,0.5); }
.rf-variants .sz:active { transform: scale(0.97); }
.rf-variants .sz.on { border-color: var(--fg); box-shadow: inset 0 0 0 0.5px var(--fg); }
.rf-variants .sz:focus-visible { outline: none; box-shadow: 0 0 0 4px #71cdff; }
.rf-link {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; font-weight: 500; color: #6b6440; text-decoration: underline; text-underline-offset: 3px;
}
.rf-link svg { transition: transform 160ms var(--ease-out); }
.rf-link:hover svg { transform: translateX(2px); }

/* details accordions */
.rf-details { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
.rf-details .acc-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 20px 4px; text-align: left;
  font-family: var(--font-serif); font-weight: 300; font-size: 20px; color: var(--fg);
  border-bottom: 1px solid var(--border);
  transition: background 140ms;
}
.rf-details .acc-head:hover { background: var(--bg-subtle); }
.rf-details .acc-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #71cdff; }
.rf-details .acc-chev { display: inline-flex; transform: rotate(90deg); transition: transform 240ms var(--ease-out); color: var(--fg-muted); }
.rf-details .acc-chev.up { transform: rotate(-90deg); }
.rf-details .acc-body {
  padding: 20px 4px 24px 24px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
  animation: rf-panel-swap 260ms var(--ease-out) both;
}
.rf-details .acc-body p { margin: 0; font-size: 14px; line-height: 19px; color: var(--fg); }
.rf-details .acc-body .lead { font-weight: 500; }
.rf-details .acc-body .rf-link { align-self: flex-end; }

/* ---- refine composer (Figma states 40003108/40003122/40003141) ---- */
.rf-composer-layer { z-index: 40; transition: padding-right 420ms var(--ease-out); }
/* Refine prompt hero — every value below measured off Figma
   default 40003108:22050 and chip state 40003122:64042:
   Card 926×104 (both states), r40. Content: column, justify CENTER, padding 0/24.
   Options Container: row, SPACE_BETWEEN, align CENTER, gap 24
     default h48 @y28 · chip state h56 @y24 (column grows, card does not)
   Prompt Text Container: column, gap 8, padding-left 12, align START
     text 16/24 Regular — default @y40 (centre 52) · chip state chip @y24, text @y56
   Buttom group: row, gap 16 — settings 48×48 · Generate 139×48, px16, 24 icon, 16 Medium */
.rf-composer {
  width: 926px; min-height: 104px; padding: 0 24px; gap: 0;
  justify-content: center; /* base .composer is a column */
}
.rf-options { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.rf-prompt {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding-left: 12px;
}
.rf-composer textarea {
  width: 100%; padding: 0; min-height: 24px; height: 24px;
  font-size: 16px; line-height: 24px; color: #413e32;
}
.rf-btns { flex: none; display: flex; align-items: center; gap: 16px; }
.rf-composer .icon-btn { width: 48px; height: 48px; }
.rf-composer .btn-generate { height: 48px; padding: 0 16px; gap: 0; font-size: 16px; }
.rf-composer .btn-generate .lbl { padding: 0 8px; line-height: 20px; } /* text container px8 */
.rf-composer .btn-generate.stop { width: 48px; padding: 0; }
/* placeholder: warm #B2A38D at rest, #413E32 once a refinement chip arms it */
.rf-composer textarea::placeholder { color: #b2a38d; transition: color 200ms; }
.rf-composer.armed textarea::placeholder { color: #413e32; }
/* the prompt hero centers on the IMAGE container: when the sidebar (432) opens,
   shift the centering axis left with it */
.rf-root:has(.rf-side-wrap.open) .rf-composer-layer { padding-right: 432px; }
/* context chip (Product Badge in 40003122): 24h, pad 6/8, gap 8, r6,
   #DAE5F2 / #19477F, 14/14 Medium, 16px close icon */
.rf-ctx-chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 24px; padding: 0 8px; border-radius: 6px;
  background: #dae5f2; color: #19477f;
  font-size: 14px; line-height: 14px; font-weight: 500; white-space: nowrap;
  animation: chipthumb-in 260ms var(--ease-spring) both;
}
.rf-ctx-chip button {
  width: 16px; height: 16px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  color: inherit; transition: background 120ms;
}
.rf-ctx-chip button:hover { background: rgba(25,71,127,0.12); }

@media (prefers-reduced-motion: reduce) {
  .rf-side-wrap, .rf-side, .rf-canvas { transition-duration: 0.01ms !important; }
}

/* AI info popover */
.ai-pop {
  position: absolute; z-index: 80; width: 340px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-3xl);
  box-shadow: 0 12px 40px rgba(52,49,40,0.18); padding: 18px;
  animation: pop-in 200ms var(--ease-out) both;
}
.ai-pop h4 { margin: 0 0 8px; font-size: 14px; font-weight: 500; }
.ai-pop p { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--fg-muted); }
.ai-pop a { font-size: 13px; color: var(--fg); }

/* toast */
.toast {
  position: absolute; bottom: 200px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: var(--r-full); z-index: 90; animation: pop-in 220ms var(--ease-out) both;
  box-shadow: 0 8px 24px rgba(52,49,40,0.3);
}

/* error note */
.err-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8a3b2e; padding-top: 6px; }

/* view transitions */
.view-enter { animation: view-in 280ms var(--ease-out) both; }
/* Explore ← Refine: content enters around the morphing prompt hero (see src/morph.ts) */
.xp-morph-in { animation: view-in 360ms var(--ease-out) both; animation-delay: 80ms; }
/* the app rail re-appears after full-screen Refine: slide in instead of popping */
.leftnav { animation: nav-in 420ms var(--ease-out) both; }
@keyframes nav-in { from { transform: translateX(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* placeholder pattern when image missing */
.ph { background: repeating-linear-gradient(45deg, #eee9e0, #eee9e0 12px, #e5dfd3 12px, #e5dfd3 24px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Verified catalogue choices reuse the Refine sidebar typography and borders. */
.rf-catalogue-note { margin: 0; font-size: 13px; line-height: 18px; color: var(--fg-muted); }
.rf-specs { margin: 0; width: 100%; font-size: 13px; line-height: 18px; }
.rf-specs > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #e4e1da; }
.rf-specs dt { color: var(--fg-muted); }
.rf-specs dd { margin: 0; text-align: right; }

.xp-empty { max-width: 520px; margin: auto; text-align: center; color: var(--fg); }
.xp-empty h1 { font-family: var(--font-serif); font-size: 32px; font-weight: 300; }
.xp-empty p { font-size: 14px; line-height: 22px; color: var(--fg-muted); }

/* Set actions use native disabled semantics and keep their resting pill surface. */
.pop-btn.tertiary:disabled { opacity: 0.4; cursor: default; background: #fcfbf8; pointer-events: none; }

/* Catalogue: Figma 40003102:29047; TILE filter and button states. */
.catalog-layer .modal-backdrop { background: rgba(255,255,255,.15); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); }
.catalog-layer .catalog {
  width: min(1500px, calc(100vw - 64px)); height: min(917px, calc(100vh - 128px));
  padding: 24px 16px; border-radius: 40px; overflow: visible; display: flex; flex-direction: column;
  background: linear-gradient(104.269deg, rgba(255,255,255,.882) 10.512%, rgba(255,255,255,.735) 85.598%);
  box-shadow: inset 0 0 0 1px rgba(52,49,40,.5), 0 1px 2px rgba(52,49,40,.1), 0 4px 12px 3px rgba(52,49,40,.1), 0 6px 28px 5px rgba(52,49,40,.1);
}
.catalog-layer button:focus-visible, .catalog-layer input:focus-visible { outline: none; box-shadow: 0 0 0 5px #71cdff; }
.catalog-layer button:active:not(:disabled) { opacity: .6; }
.catalog-layer button:disabled { opacity: .5; cursor: default; }
.cat-header { flex: 0 0 32px; display: flex; align-items: center; margin-bottom: 20px; }
.catalog-layer .cat-back { position: static; height: 32px; min-width: 72px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 12px; font-size: 14px; line-height: 18px; font-weight: 500; }
.catalog-layer .cat-x { top: -8px; right: -8px; padding: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-subtle); border: 1px solid rgba(0,0,0,.24); display: grid; place-items: center; opacity: 1; }
.cat-body { display: flex; flex: 1; min-height: 0; gap: 16px; }
/* Figma Menu 40000987:31054; Image item Default/Hover/Focus/Active. */
.catalog-layer .cat-rail { position: relative; width: 100px; flex: 0 0 100px; padding: 0 12px 6px 0; border: 0; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 12px; }
.catalog-layer .cat-rail::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: #e9e8e7; }
.catalog-layer .cr-item { display: flex; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 72px; height: 86px; padding: 10px 10px 6px; margin: 0 8px; border-radius: 8px; font-size: 12px; line-height: 16px; font-weight: 500; text-align: center; color: #413e32; background: transparent; font-feature-settings: "lnum" 1, "tnum" 1; transition: background-color 140ms, box-shadow 140ms; }
.catalog-layer .cr-item > .cr-thumbnail { position: relative; display: flex; align-items: center; justify-content: center; flex: 0 0 52px; width: 52px; height: 52px; border: 1px solid #e9e8e7; border-radius: 8px; overflow: hidden; transition: border-color 140ms; }
.catalog-layer .cr-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.catalog-layer .cr-art { position: relative; flex: none; display: block; }
.catalog-layer .cr-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.catalog-layer .cr-art-tiles { width: 72px; height: 40px; }
.catalog-layer .cr-art-vanities { width: 62px; height: 50px; border-radius: 16px; overflow: hidden; }
.catalog-layer .cr-art-vanities img { position: absolute; left: 10%; top: 0; width: 80%; height: 100%; }
.catalog-layer .cr-art-lighting { width: 65px; height: 52px; border-radius: 16px; overflow: hidden; }
.catalog-layer .cr-item:hover:not(:disabled) { background: #fff; }
.catalog-layer .cr-item.on, .catalog-layer .cr-item.on:hover:not(:disabled), .catalog-layer .cr-item.on:active:not(:disabled) { background: #e9e8e7; box-shadow: inset 0 0 0 1px #d9d8d7; font-weight: 600; }
.catalog-layer .cr-item:hover:not(:disabled) > .cr-thumbnail { border-color: #d9d8d7; }
.catalog-layer .cr-item.on > .cr-thumbnail, .catalog-layer .cr-item:active:not(:disabled) > .cr-thumbnail { border-color: #8e8d8b; }
.catalog-layer .cr-item:active:not(:disabled) { background: #fff; opacity: 1; }
.catalog-layer .cr-item:focus-visible { background: transparent; outline: none; box-shadow: inset 0 0 0 1px #fff, 0 0 0 5px #71cdff; }
.catalog-layer .cr-item:focus-visible > .cr-thumbnail { border-color: #e9e8e7; }
.catalog-layer .cr-item.on:focus-visible { background: #e9e8e7; box-shadow: inset 0 0 0 1px #d9d8d7, 0 0 0 5px #71cdff; }
.catalog-layer .cr-item.on:focus-visible > .cr-thumbnail { border-color: #8e8d8b; }
.catalog-layer .cr-item:disabled { opacity: 1; }
.catalog-layer .cat-main { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; padding: 0; overflow: visible; }
.catalog-layer .cat-main h2 { font-family: var(--font-serif); font-size: 32px; line-height: 40px; font-weight: 300; margin: 0 0 20px; flex: 0 0 40px; }
.cat-filter-row { display: flex; gap: 16px; padding: 15px 0; border-top: 1px solid transparent; border-bottom: 1px solid transparent; margin-bottom: 20px; flex: 0 0 72px; align-items: center; position: relative; z-index: 10; }
.cat-filter-wrap { position: relative; flex-shrink: 0; }
.cat-filter-trigger { display: inline-flex; align-items: center; height: 40px; border: 1px solid #b2b1b0; border-radius: 999px; background: transparent; font-size: 14px; line-height: 18px; white-space: nowrap; }
.cat-filter-trigger > span { display: flex; gap: 6px; align-items: center; padding: 0 16px; }
.cat-filter-trigger > i { display: grid; place-items: center; height: 24px; padding: 0 12px; border-left: 1px solid #e9e8e7; }
.cat-filter-trigger b { font-weight: 500; font-size: 12px; min-width: 18px; height: 18px; background: #413e32; color: white; border-radius: 50%; display: grid; place-items: center; }
.cat-filter-trigger:hover, .cat-filter-trigger[aria-expanded="true"] { border-color: #8e8d8b; }
.cat-filter-trigger.applied { background: #fcfbf8; border-color: #413e32; }
.cat-sort { margin-left: auto; }
.cat-filter-menu { position: absolute; top: calc(100% + 8px); left: 0; width: 300px; border-radius: 8px; border: 1px solid #e9e8e7; background: white; box-shadow: 0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.1); overflow: hidden; z-index: 20; }
.cat-filter-search { display: flex; gap: 8px; align-items: center; height: 48px; padding: 12px 16px; border-bottom: 1px solid #e9e8e7; }
.cat-filter-search input { border: 0; background: none; font: inherit; font-size: 16px; line-height: 20px; width: 100%; min-width: 0; color: #343128; outline: none; }
.catalog-layer .cat-filter-search input:focus-visible { box-shadow: none; }
.cat-filter-search:focus-within { box-shadow: inset 0 0 0 2px #71cdff; }
.cat-filter-options { max-height: min(320px, calc(100vh - 420px)); min-height: 40px; overflow-y: auto; padding: 4px 0; }
.cat-filter-option { position: relative; height: 40px; padding: 4px 7px; margin: 1px 9px; display: flex; gap: 8px; align-items: center; font-size: 16px; line-height: 20px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.cat-filter-option:hover { background: #fcfbf8; border-color: #e9e8e7; }
.cat-filter-option input { position: absolute; opacity: 0; width: 20px; height: 20px; left: 7px; margin: 0; }
.cat-checkbox { flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid #b2b1b0; border-radius: 4px; display: grid; place-items: center; }
.cat-checkbox svg { visibility: hidden; color: white; }
.cat-filter-option input:checked + .cat-checkbox { background: #413e32; border-color: #413e32; }
.cat-filter-option input:checked + .cat-checkbox svg { visibility: visible; }
.cat-filter-option input:focus-visible + .cat-checkbox { box-shadow: 0 0 0 5px #71cdff; }
.cat-facet-count { font-weight: 300; color: #635d4f; }
.cat-filter-footer { border-top: 1px solid #e9e8e7; padding: 8px; display: flex; gap: 8px; }
.cat-filter-footer button { flex: 1; height: 40px; font-size: 14px; font-weight: 500; border-radius: 999px; }
.cat-outline { border: 1px solid rgba(0,0,0,.24); border-radius: 999px; background: #fcfbf8; }
.cat-outline:hover { background: #eae9e3; }
.cat-apply { background: #413e32; color: white; }
.cat-apply:hover { background: #555143; }
.cat-filter-empty { font-size: 14px; padding: 16px; margin: 0; color: #635d4f; }
.cat-sort-menu { left: auto; right: 0; padding: 8px; }
.cat-sort-menu > button { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 40px; padding: 0 8px; font-size: 16px; border-radius: 6px; text-align: left; }
.cat-sort-menu > button:hover, .cat-sort-menu > button[aria-checked="true"] { background: #fcfbf8; }
.cat-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 12px; font-size: 12px; }
.cat-active-filters > button { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #e9e8e7; background: white; border-radius: 999px; }
.cat-active-filters .cat-clear-all { background: none; border: 0; text-decoration: underline; }
.cat-results { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 32px 0; scrollbar-width: none; mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent 100%); }
.cat-results::-webkit-scrollbar, .cat-rail::-webkit-scrollbar { display: none; }
.cat-product-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 16px; align-items: start; }
.cat-product-card { position: relative; display: flex; flex-direction: column; padding: 8px; border-radius: 24px; box-shadow: inset 0 0 0 1px #d9d8d7; background: rgba(255,255,255,.55); min-width: 0; }
.cat-product-card.is-added { box-shadow: inset 0 0 0 1px #8e8d8b; }
.cat-product-image { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #fcfbf8; }
.cat-product-image > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-product-image .cat-product-room { position: absolute; inset: 0; opacity: 0; transition: opacity 180ms; }
.cat-product-image:hover .cat-product-room { opacity: 1; }
.cat-product-badge { position: absolute; top: 10px; left: 10px; height: 24px; border-radius: 999px; padding: 0 10px; background: #fcfbf8; border: 1px solid rgba(0,0,0,.24); font-size: 12px; line-height: 22px; }
.cat-swatches { display: flex; align-items: flex-start; gap: 6px; height: 40px; margin: 8px 0 16px; position: relative; }
.cat-swatch { position: relative; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 6px; }
.cat-swatch img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; box-shadow: inset 0 0 0 1px #e9e8e7; }
.cat-swatch:hover { box-shadow: 0 0 0 1px #8e8d8b; }
.cat-swatch.selected::after { content: ''; position: absolute; height: 2px; background: #e3a53b; border-radius: 999px; bottom: -8px; left: 0; right: 0; }
.cat-more-swatches { height: 32px; min-width: 32px; padding: 0 6px; font-size: 14px; line-height: 18px; border-radius: 6px; }
.cat-more-swatches:hover { background: #fcfbf8; }
.cat-product-details { display: flex; justify-content: space-between; gap: 24px; height: 66px; padding: 0 6px 6px; margin-bottom: 16px; }
.cat-product-details > div:first-child { min-width: 0; flex: 1; }
.cat-product-details h3 { font-size: 16px; line-height: 20px; font-weight: 500; margin: 0 0 8px; }
.cat-product-details p { font-size: 13px; line-height: 16px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-product-price { font-size: 16px; line-height: 20px; font-weight: 500; white-space: nowrap; }
.cat-product-price small { display: block; font-size: 12px; line-height: 16px; color: #635d4f; font-weight: 400; }
.cat-add { display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; flex: 0 0 32px; font-size: 14px; line-height: 18px; font-weight: 500; }
.cat-add.selected { background: #413e32; color: white; }
.cat-add.selected:hover { background: #555143; }
.cat-variant-menu { position: absolute; top: 40px; left: 0; width: 280px; max-width: calc(100vw - 60px); max-height: 300px; overflow: auto; z-index: 5; border: 1px solid #e9e8e7; background: white; box-shadow: 0 4px 12px rgba(0,0,0,.12); border-radius: 8px; padding: 8px; }
.cat-product-card:nth-child(5n) .cat-variant-menu { left: auto; right: 0; }
.cat-variant-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 500; padding: 4px 8px 8px; }
.cat-variant-head button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.cat-variant-menu > button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; text-align: left; font-size: 13px; line-height: 16px; }
.cat-variant-menu > button:hover, .cat-variant-menu > button.selected { background: #fcfbf8; }
.cat-variant-menu > button img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.cat-variant-menu > button span { flex: 1; }
.cat-variant-menu small { display: block; color: #635d4f; margin-top: 4px; }
.cat-no-results { display: flex; height: 100%; min-height: 220px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cat-no-results h3 { font-family: var(--font-serif); font-size: 24px; font-weight: 300; margin: 0 0 12px; }
.cat-no-results p { color: #635d4f; font-size: 14px; margin: 0 0 20px; }
.cat-no-results button { padding: 0 16px; height: 40px; font-size: 14px; }
.cat-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 1450px) { .cat-product-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } .cat-filter-row { gap: 8px; } .cat-filter-trigger > span { padding: 0 12px; } .cat-filter-trigger > i { padding: 0 9px; } }
@media (max-width: 1160px) { .cat-product-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .cat-filter-row { flex-wrap: wrap; flex-basis: auto; } .cat-filter-menu { max-height: calc(100vh - 300px); } .cat-filter-options { max-height: 220px; } }
@media (max-width: 900px) { .catalog-layer .catalog { width: calc(100vw - 32px); height: calc(100vh - 64px); padding: 20px 12px; border-radius: 24px; } .catalog-layer .cat-rail { width: 84px; flex-basis: 84px; padding-right: 8px; } .catalog-layer .cr-item { margin-left: 4px; margin-right: 4px; } .cat-body { gap: 12px; } .cat-product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .cat-filter-trigger { height: 36px; } .cat-filter-row { padding: 12px 0; } .cat-filter-trigger > span { padding: 0 10px; } .cat-filter-trigger > i { padding: 0 8px; } .cat-sort { margin-left: 0; } .cat-product-details { gap: 12px; } }
@media (max-width: 600px) { .catalog-layer .catalog { width: calc(100vw - 16px); height: calc(100dvh - 32px); padding: 16px 12px; } .cat-body { flex-direction: column; gap: 16px; } .catalog-layer .cat-rail { width: 100%; flex: 0 0 70px; padding: 0; display: flex; flex-direction: row; gap: 8px; overflow-x: auto; overflow-y: hidden; } .catalog-layer .cat-rail::after { display: none; } .catalog-layer .cr-item { width: 56px; height: 70px; padding: 4px; margin: 0; flex-shrink: 0; } .catalog-layer .cr-item > .cr-thumbnail { width: 44px; height: 44px; flex-basis: 44px; } .catalog-layer .cat-main h2 { font-size: 28px; margin-bottom: 12px; } .cat-filter-row { gap: 8px; margin-bottom: 12px; } .cat-filter-wrap { position: static; } .cat-filter-menu { left: 0; right: 0; top: calc(100% + 8px); width: 100%; } .cat-filter-options { max-height: min(240px,calc(100dvh - 420px)); } .cat-product-grid { grid-template-columns: minmax(0,1fr); } .cat-product-details { gap: 24px; } .cat-results { padding-right: 0; } }
@media (prefers-reduced-motion: reduce) { .catalog-layer .catalog, .catalog-layer .catalog.closing { animation: none; } .cat-product-room { transition: none; } }
.catalog-layer { position: fixed; align-items: flex-start; padding-top: 64px; }
@media (max-width: 900px) { .catalog-layer { padding-top: 32px; } }
@media (max-width: 600px) { .catalog-layer { padding-top: 16px; } }
@media (max-width: 1450px) { .cat-product-card:nth-child(4n) .cat-variant-menu { left: auto; right: 0; } }
@media (max-width: 1160px) { .cat-product-card:nth-child(3n) .cat-variant-menu { left: auto; right: 0; } }
@media (max-width: 900px) { .cat-product-card:nth-child(2n) .cat-variant-menu { left: auto; right: 0; } }
@media (max-width: 600px) { .cat-variant-menu { max-width: 100%; } }

.products-empty-action { display: flex; justify-content: center; padding: 24px 0; }

/* Default 40px pill sizing shared with existing composer actions. */
.pop-btn.tertiary.default-size { height: 40px; padding: 0 16px; }
.pitem.added .pi-img { cursor: default; }
.pitem.added .pi-overlay, .pitem.added .pi-ov-blend, .pitem.added .pi-ov-tint { display: none; }
.pitem.added .pi-remove { left: auto; right: -8px; }
.pitem:focus-within .pi-remove { opacity: 1; transform: none; pointer-events: auto; }

.prompt-product-grid { position: relative; }
.prompt-product-grid > [data-product-id] { flex: none; }
.product-exit { position: absolute; pointer-events: none; animation: product-exit 320ms cubic-bezier(0.32, 0.72, 0.33, 1) both; }
@keyframes product-exit { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.88); } }
@media (prefers-reduced-motion: reduce) { .product-exit { animation: none; } }

/* Keep the Figma separator colour visible beneath its overlay highlight. */
.cat-filter-row::before, .cat-filter-row::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background-color: #d9d8d7; background-image: linear-gradient(#808080, #808080); background-blend-mode: overlay; pointer-events: none; }
.cat-filter-row::before { top: -1px; }
.cat-filter-row::after { bottom: -1px; }

/* Clip sliding panes so Safari cannot expose transient horizontal scrollbars. */
.rf-tabwrap { overflow: hidden; min-width: 0; }
.rf-tabpane, .rf-side-inner { min-width: 0; overflow-x: hidden; }
.rf-list, .rf-history, .rf-details, .rf-variants { min-width: 0; overflow-x: hidden; }
/* WebKit includes translated children in a scroll area during tab animations.
   Constrain each scrollport and suppress only its horizontal scrollbar. */
.rf-tabwrap { contain: paint; }
.rf-list::-webkit-scrollbar:horizontal, .rf-history::-webkit-scrollbar:horizontal,
.rf-details::-webkit-scrollbar:horizontal, .rf-variants::-webkit-scrollbar:horizontal { height: 0; display: none; }
.rf-history-in { animation: rf-history-fade 500ms ease-in-out both; }
@keyframes rf-history-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rf-history-in { animation: none; } }

/* Keep decoded history layers mounted; WebKit must not replace image surfaces mid-fade. */
.rf-canvas-img > .rf-image-layer { opacity: 0; transition: opacity 500ms ease-in-out; will-change: opacity; }
.rf-canvas-img > .rf-image-layer.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .rf-canvas-img > .rf-image-layer { transition: none; } }
