/* ── Lamina visualizer — styles ─────────────────────────────────────────
   Tokens first (light palette on :root, dark via prefers-color-scheme and
   an explicit data-theme stamp), then layout, then components.            */

:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel-2: #ecebe5;
  --panel-3: #e3e1da;
  --ink: #1d1c1a;
  --ink-2: #615d56;
  --ink-3: #767169;   /* AA: 4.8:1 on the panel — the old #8f8a81 was 3.4:1 on 11px text */
  --line: #e0ddd5;
  --line-2: #cfcbc1;
  --accent: #0e7c7b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(14, 124, 123, 0.11);
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.06), 0 8px 24px rgba(30, 25, 15, 0.08);
  --shadow-lg: 0 12px 40px rgba(30, 25, 15, 0.18);
  --stage-bg: #d8dee4;
  --coach: rgba(20, 18, 14, 0.58);
  --font-display: 'Archivo', 'Archivo Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font-ui: 'IBM Plex Sans', 'Segoe UI', Roboto, system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 7px;
  --topbar-h: 56px;
  --surfacebar-h: 48px;
  --catalog-w: 336px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --panel: #1f1f1c;
    --panel-2: #292926;
    --panel-3: #33332f;
    --ink: #efece6;
    --ink-2: #a7a39a;
    --ink-3: #8d897f;  /* AA on the dark panel (old value was 3.7:1) */
    --line: #34332f;
    --line-2: #45433e;
    --accent: #45b8b3;
    --accent-ink: #0a1817;
    --accent-soft: rgba(69, 184, 179, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
    --stage-bg: #0f1115;
    --coach: rgba(0, 0, 0, 0.66);
  }
}
:root[data-theme="dark"] {
  --bg: #161614;
  --panel: #1f1f1c;
  --panel-2: #292926;
  --panel-3: #33332f;
  --ink: #efece6;
  --ink-2: #a7a39a;
  --ink-3: #8d897f;  /* AA on the dark panel (old value was 3.7:1) */
  --line: #34332f;
  --line-2: #45433e;
  --accent: #45b8b3;
  --accent-ink: #0a1817;
  --accent-soft: rgba(69, 184, 179, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  --stage-bg: #0f1115;
  --coach: rgba(0, 0, 0, 0.66);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
img, canvas { display: block; max-width: 100%; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: var(--panel-2); padding: 0.1em 0.4em; border-radius: 4px; }
kbd { background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; padding: 0.05em 0.45em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
.ic { display: inline-flex; line-height: 0; }

/* ── Boot splash ─────────────────────────────────────────────────────── */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 18px; background: var(--bg); }
.boot-mark { font-family: var(--font-display); font-stretch: 118%; font-weight: 700; letter-spacing: 0.28em; font-size: 22px; color: var(--ink); text-align: center; }
.boot-bar { width: 160px; height: 3px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.boot-error { color: #b42318; max-width: 360px; text-align: center; }

/* ── Brand ───────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-family: var(--font-display); font-stretch: 118%; font-weight: 700; letter-spacing: 0.26em; font-size: 15px; text-transform: uppercase; }
.brand-sub { font-family: var(--font-display); font-weight: 500; color: var(--ink-2); letter-spacing: 0.04em; font-size: 13px; }
/* Uploaded logo (admin → Homepage) replaces the text mark. */
.brand-logo { max-height: 34px; max-width: 180px; width: auto; object-fit: contain; }
.brand-logo.small { max-height: 26px; max-width: 130px; }
.website-link { display: inline-flex; align-items: center; gap: 5px; }
.website-link .ext svg { width: 14px; height: 14px; }

/* ── Buttons & chips ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: filter 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--panel-2); filter: none; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn.small { width: 30px; height: 30px; }
.chips { display: flex; gap: 6px; align-items: center; }
.chips.wrap { flex-wrap: wrap; }
.chips.scroll-x { overflow-x: auto; scrollbar-width: none; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--panel-2); gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--ink-2); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.seg-btn.dim:not(.on) { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count-muted { color: var(--ink-3); font-weight: 500; font-size: 0.85em; margin-left: 4px; font-variant-numeric: tabular-nums; }
.tag { font-family: var(--font-display); font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.empty { color: var(--ink-2); padding: 18px 4px; }
.empty[data-reason="availability"] { display: grid; gap: 4px; padding: 16px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); font-size: 13px; }
.empty[data-reason="availability"] b { color: var(--ink); font-weight: 600; }
.empty[data-reason="availability"] .ic { color: var(--ink-3); margin-bottom: 2px; }
/* A search that matched nothing here but found designs in other rooms/areas:
   each hit is a shortcut that opens the room and applies the design. */
.empty[data-reason="filter"]:has(.empty-hits) { display: grid; gap: 4px; padding: 16px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: 13px; }
.empty[data-reason="filter"] b { color: var(--ink); font-weight: 600; }
.empty[data-reason="filter"] .ic { color: var(--ink-3); margin-bottom: 2px; }
.empty-hits { display: grid; gap: 6px; margin-top: 8px; }
.empty-hit { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.empty-hit:hover:not(:disabled) { border-color: var(--accent); }
.empty-hit:disabled { opacity: 0.55; cursor: default; }
.empty-hit .hit-name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-hit .hit-where { margin-left: auto; font-size: 11px; color: var(--accent); white-space: nowrap; }

/* ── Landing ─────────────────────────────────────────────────────────── */
.landing { max-width: 1180px; margin: 0 auto; padding: 22px 28px 40px; min-height: 100%; display: flex; flex-direction: column; gap: 48px; }
.landing-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.landing-nav { display: flex; align-items: center; gap: 22px; }
.nav-link { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.nav-link:hover { color: var(--ink); }
.hero { max-width: 66ch; display: grid; gap: 12px; padding-top: 30px; }
/* Minimal landing: one line of copy, then straight into the rooms. */
.hero-min { max-width: 100%; padding-top: 6px; gap: 6px; }
.hero-min h1 { font-size: clamp(22px, 3.2vw, 34px); max-width: 30ch; }
.eyebrow { margin: 0; font-family: var(--font-display); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.hero h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 4.6vw, 48px); line-height: 1.06; letter-spacing: -0.018em; text-wrap: balance; }
.lede { margin: 4px 0 0; font-size: 16px; color: var(--ink-2); max-width: 60ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.section-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; max-width: 64ch; }
.tabs { display: inline-flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px; }
.room-card {
  display: grid; gap: 0; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.room-thumb { aspect-ratio: 16 / 10; background: var(--panel-2); position: relative; display: grid; place-items: center; overflow: hidden; }
.room-thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.6s ease-in-out infinite; }
.room-thumb.ready::after, .room-thumb:has(img.ready)::after { display: none; }
@keyframes shimmer { to { transform: translateX(100%); } }
.room-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.35s ease; }
.room-thumb img.ready { opacity: 1; }
.room-meta { padding: 14px 16px 16px; display: grid; gap: 4px; }
.room-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.room-meta h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.room-meta p { margin: 0; color: var(--ink-2); font-size: 13px; }
.room-count { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--accent); font-size: 12.5px; font-weight: 600; }
.room-count svg { width: 16px; height: 16px; }

.featured-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.featured-card {
  display: grid; gap: 6px; padding: 8px 8px 10px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.featured-swatch { width: 100%; aspect-ratio: 1; height: auto; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.featured-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.featured-id { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Where a searched design can be applied (shown only in search results). */
.featured-where { font-size: 11px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Landing-page catalogue search */
.find-search { min-width: 260px; flex: 0 1 340px; }
.find-status { margin: -8px 0 14px; font-size: 13px; color: var(--ink-2); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); display: grid; gap: 6px; align-content: start; }
.step-n { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.step h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.step p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.stat { padding: 18px 22px; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat-n { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-l { color: var(--ink-2); font-size: 13px; }

.landing-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-size: 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.foot-right { display: inline-flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.admin-link { color: var(--ink-3); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.admin-link:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
/* Agency credit (white-label footer). */
.made-by { color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.made-by:hover { color: var(--ink); }
.made-by .heart { color: #c8323b; }

/* ── App frame ───────────────────────────────────────────────────────── */
.app { position: fixed; inset: 0; display: grid; grid-template-rows: var(--topbar-h) 1fr; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 8px 6px 4px; border-radius: 8px; cursor: pointer; }
.brand-btn:hover { background: var(--panel-2); }
.brand-btn .ic { color: var(--ink-2); }
.room-switch { position: relative; }
.room-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); padding: 7px 10px 7px 14px; border-radius: 999px; cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.room-btn:hover { background: var(--panel-2); }
.menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 20; display: grid; }
.menu-item { display: grid; text-align: left; gap: 1px; padding: 9px 12px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; }
.menu-item:hover { background: var(--panel-2); }
.menu-item.on { background: var(--accent-soft); }
.menu-item.back { border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); color: var(--ink-2); }
.menu-item.back .menu-name { display: inline-flex; align-items: center; gap: 8px; }
.menu-name { font-weight: 600; }
.menu-sub { font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.workspace { display: grid; grid-template-columns: var(--catalog-w) 1fr; min-height: 0; transition: grid-template-columns 0.3s ease; }
/* Desktop: the catalogue column collapses to give the room the full width. */
.app.catalog-collapsed .workspace { grid-template-columns: 0 1fr; }
.app.catalog-collapsed .catalog { overflow: hidden; padding-left: 0; padding-right: 0; border-right-width: 0; }
.catalog-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }

/* ── Catalogue ───────────────────────────────────────────────────────── */
.catalog { display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 8px; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; min-width: 0; }
.catalog > :not(.swatches) { flex: none; }   /* only the swatch grid may shrink/scroll */
.sheet-grab { display: none; }
.sheet-close { display: none; }
.catalog-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.catalog-head { display: grid; gap: 8px; }
.catalog-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.catalog-sub { margin: -4px 0 0; color: var(--ink-2); font-size: 12.5px; }
.catalog-sub b { color: var(--accent); font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--ink-3); }
.search input { flex: 1; border: 0; background: transparent; padding: 8px 0; color: var(--ink); outline: none; min-width: 0; }
.search:focus-within { border-color: var(--accent); color: var(--accent); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 12px 10px; overflow-y: auto; padding: 2px 2px 12px; min-height: 0; align-content: start; scrollbar-width: thin; overscroll-behavior: contain; }
.swatch-card { position: relative; display: grid; gap: 3px; }
.swatch-btn { padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: var(--radius-sm); position: relative; }
.swatch-img { width: 100%; aspect-ratio: 1; height: auto; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); transition: transform 0.15s ease; object-fit: cover; }
.swatch-btn:hover .swatch-img { transform: scale(1.03); }
.swatch-card.applied .swatch-img { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.applied-badge { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: none; place-items: center; }
.applied-badge svg { width: 14px; height: 14px; }
.swatch-card.applied .applied-badge { display: grid; }
.heart-btn { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.9); color: #4b4741; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.heart-btn svg { width: 15px; height: 15px; }
.swatch-card:hover .heart-btn, .heart-btn.on, .heart-btn:focus-visible { opacity: 1; }
.heart-btn.on { color: #c8323b; }
/* Touch screens have no hover: an invisible heart button would still eat the
   tap that lands on it, which reads as "tapping the swatch does nothing". */
@media (hover: none) { .heart-btn { opacity: 1; } }
.swatch-name { font-size: 12.5px; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch-id { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── Stage ───────────────────────────────────────────────────────────── */
.stage { position: relative; min-width: 0; min-height: 0; background: var(--stage-bg); overflow: hidden; }
.canvas-host { position: absolute; inset: 0; }
.canvas-host canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.canvas-host canvas:active { cursor: grabbing; }
.hover-label { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 3; }
.loading { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink-2); background: var(--stage-bg); }
.loading-bar { width: 140px; height: 3px; background: color-mix(in srgb, var(--ink) 12%, transparent); border-radius: 2px; overflow: hidden; }
.loading-bar span { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: boot 1.1s ease-in-out infinite; }
.toolbar { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.tool { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); transition: background 0.15s, color 0.15s; }
.tool:hover { color: var(--ink); background: var(--panel-2); }
.tool.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tool svg { width: 20px; height: 20px; }
.applied-strip { position: absolute; left: 14px; top: 14px; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 3; max-width: min(440px, calc(100% - 90px)); }
.applied-strip:empty { display: none; }
.applied-swatch { width: 44px; height: 44px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1); object-fit: cover; }
.applied-text { display: grid; line-height: 1.25; min-width: 0; }
.applied-surface { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.applied-design { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.applied-meta { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hint { position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%); font-size: 12px; color: var(--ink-2); background: color-mix(in srgb, var(--panel) 78%, transparent); padding: 5px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; z-index: 2; backdrop-filter: blur(6px); transition: background 0.2s, color 0.2s; }
.hint.look { color: var(--ink); background: color-mix(in srgb, var(--accent) 16%, color-mix(in srgb, var(--panel) 80%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ── Application-area bar (bottom of the stage) ──────────────────────── */
.areabar {
  /* Anchored between fixed insets and centred with auto margins: the right
     inset reserves the WhatsApp button's corner, so however many areas a
     room has, the bar can shrink-and-scroll but never slide under the
     button (a centred translateX bar did, measured at 1024×700). */
  position: absolute; left: 14px; right: 170px; bottom: 14px; margin-inline: auto; width: fit-content;
  /* max-width must equal the inset zone (100% − left − right): a larger cap
     over-constrains the box and the browser drops `right`, putting the bar
     back under the button. */
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 184px);
  padding: 8px 12px; border-radius: 16px; z-index: 4;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
}
.areabar-label { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.area-chips { display: flex; gap: 6px; align-items: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; touch-action: pan-x; }
.area-chips::-webkit-scrollbar { display: none; }
.area-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.area-btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.area-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 45%, transparent); }
.area-swatch { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); object-fit: cover; flex: none; }
.area-swatch-ph { background: var(--panel-3); display: inline-block; }

/* ── WhatsApp enquiry ────────────────────────────────────────────────── */
.wa-fab {
  position: absolute; right: 14px; bottom: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px;
  /* #178046: white label reads at 5.0:1 (the WhatsApp-brand green was 3.2:1). */
  border: 0; background: #178046; color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer;
  box-shadow: 0 4px 18px rgba(23, 128, 70, 0.45); transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.wa-fab:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 6px 22px rgba(23, 128, 70, 0.55); }
.wa-fab .ic svg { width: 20px; height: 20px; }
.wa-action { color: #178046; border-color: color-mix(in srgb, #178046 45%, transparent); }
.wa-action:hover { background: color-mix(in srgb, #178046 12%, transparent); }

/* ── Portrait rotate tip ─────────────────────────────────────────────── */
.rotate-tip {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 9px; max-width: calc(100% - 20px);
  padding: 7px 8px 7px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); backdrop-filter: blur(8px);
}
.rotate-tip .rotate-ic { color: var(--accent); }
.rotate-tip .rotate-ic svg { width: 18px; height: 18px; }
.rotate-text { font-size: 12.5px; font-weight: 500; }
.rotate-tip .btn.small { padding: 5px 11px; font-size: 12px; }

/* ── Coach overlay ───────────────────────────────────────────────────── */
.coach { position: fixed; inset: 0; z-index: 40; background: var(--coach); opacity: 0; transition: opacity 0.25s; cursor: pointer; }
.coach.on { opacity: 1; }
.callout { position: absolute; width: 280px; background: var(--panel); color: var(--ink); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); display: grid; gap: 4px; }
.callout::before { content: ''; position: absolute; left: -8px; top: 18px; border: 8px solid transparent; border-right-color: var(--panel); border-left: 0; }
.callout-step { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.callout p { margin: 0; font-size: 13.5px; }
.coach-dismiss { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: 0.8; margin: 0; }

/* ── Modals & toasts ─────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 8, 0.5); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity 0.2s; }
.modal-backdrop.on { opacity: 1; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); background: var(--panel); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-lg); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; transform: translateY(6px); transition: transform 0.2s; }
.modal-backdrop.on .modal { transform: none; }
.modal.wide { width: min(840px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.shortlist-grid { display: grid; gap: 10px; }
.sl-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.sl-swatch { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; }
.sl-text { display: grid; gap: 2px; }
.sl-text span { color: var(--ink-3); font-size: 12px; }
.sl-actions { display: flex; align-items: center; gap: 6px; }
.snap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.snap-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.snap-side h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 15px; }
.snap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.snap-list li { display: grid; gap: 2px; }
.snap-surface { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.snap-design { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.help-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.help-tips { margin: 16px 0 0; color: var(--ink-2); font-size: 12.5px; }
.quality { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.quality-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quality-head b { font-weight: 600; }
.quality-note { margin: 0; color: var(--ink-3); font-size: 12px; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; white-space: nowrap; }
.toast.on { opacity: 1; transform: none; }
.toast-ic { display: inline-flex; color: var(--accent); }
.toast-ic svg { width: 16px; height: 16px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .landing { padding: 16px 16px 32px; gap: 28px; }
  .hero { padding-top: 6px; }
  .section-head { margin-bottom: 14px; }
  .featured-list { display: flex; overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; }
  .featured-card { flex: 0 0 132px; scroll-snap-align: start; }

  /* The catalogue becomes a bottom sheet over the stage: the room keeps the
     whole screen and the canvas never resizes when the sheet opens. */
  .workspace { grid-template-columns: 1fr; }
  .catalog {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    max-height: min(62vh, 520px); border-right: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(102%); transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.25, 1);
    gap: 10px; padding-top: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  /* The swatch grid must never be squeezed out by the filters above it. */
  .swatches { min-height: 150px; }
  .app.sheet-open .catalog { transform: none; }
  .sheet-grab { display: grid; place-items: center; padding: 2px 0 0; }
  .sheet-grab span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
  .sheet-close { display: inline-grid; }
  .catalog-sub { display: block; margin-top: -2px; }
  .chips.wrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips.wrap::-webkit-scrollbar { display: none; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

  .hint { display: none; }
  .applied-strip { display: none; }   /* the sheet + area bar carry the same info */
  .areabar { bottom: max(10px, env(safe-area-inset-bottom)); left: 8px; right: 8px; padding: 6px 10px; border-radius: 14px; }   /* FAB sits above the bar on phones */
  .areabar-label { display: none; }
  .area-btn { padding: 7px 12px 7px 7px; font-size: 12.5px; }
  .wa-fab { bottom: 74px; right: 10px; padding: 11px 14px; }
  .wa-fab .wa-text { display: none; }   /* circle-ish on phones; the glyph is universally known */
  .toolbar { top: 10px; right: 10px; }
  .tool { width: 38px; height: 38px; }

  .snap { grid-template-columns: 1fr; }
  .topbar-right .btn span:not(.ic):not(.count) { display: none; }
  .topbar-right .btn { padding: 6px 10px; }
  .brand-btn .brand-mark { display: none; }
  .brand-btn .brand-logo { max-height: 22px; max-width: 90px; }
  .sl-item { grid-template-columns: 56px 1fr; }
  .sl-swatch { width: 56px; height: 56px; }
  .sl-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .quality-head { align-items: flex-start; flex-direction: column; }
}
/* Landscape phones: chrome shrinks so the room gets the height, and the
   catalogue becomes a right-side drawer — a bottom sheet would cover the
   whole room, so applying a laminate would happen invisibly.
   This block must stand alone: 861–1000 px landscape phones (Pixel Pro,
   S-Ultra, iPhone Pro Max) never enter the ≤860 px sheet block, so all the
   fixed-drawer plumbing is declared here too. The width/height pair below is
   half of COMPACT_MQ in src/main.js — change the two together. */
@media (max-width: 1000px) and (max-height: 500px) {
  :root { --topbar-h: 46px; --drawer-w: min(320px, 44vw); }
  .toolbar { flex-direction: row; top: 8px; right: 8px; gap: 5px; }
  .tool { width: 36px; height: 36px; border-radius: 9px; }
  .tool svg { width: 18px; height: 18px; }
  .workspace { grid-template-columns: 1fr; }
  .areabar { bottom: 8px; left: 8px; right: 8px; }
  .wa-fab { bottom: 64px; right: 8px; padding: 9px 12px; }   /* above the bar — no corner to reserve */
  .hint { display: none; }
  .applied-strip { display: none; }

  .catalog {
    position: fixed; z-index: 30;
    left: auto; right: 0; top: var(--topbar-h); bottom: 0;
    width: var(--drawer-w); max-height: none;
    border-radius: 14px 0 0 14px; border-top: 0; border-right: 0; border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg); overscroll-behavior: contain;
    transform: translateX(103%); transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.25, 1);
    padding-top: 10px; padding-bottom: 10px;
  }
  .app.sheet-open .catalog { transform: none; }
  .sheet-grab { display: none; }
  .sheet-close { display: inline-grid; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); min-height: 100px; }

  /* With the drawer open, everything floating on the stage slides left so it
     stays visible and tappable beside it. */
  .app.sheet-open .areabar { left: 8px; right: calc(var(--drawer-w) + 8px); transform: none; max-width: none; justify-content: flex-start; }
  .app.sheet-open .toolbar { right: calc(var(--drawer-w) + 8px); }
  .app.sheet-open .wa-fab { right: calc(var(--drawer-w) + 8px); }
  .app.sheet-open .rotate-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
