/* ==========================================================================
   js.17 — the studio (studio.html)
   The store on a canvas, the AI beside it. Loaded after css/workshop.css,
   whose tokens, sidebar, controls and dialogs it shares.
   ========================================================================== */

:root {
  --canvas: #ebe8e2;
  --ai-w: 384px;
  --top-h: 56px;
}

.ws--studio { height: 100dvh; overflow: hidden; }
.st-main { display: flex; flex-direction: column; min-width: 0; height: 100dvh; }

/* Sidebar in the studio: the account is a way back, not a menu */
.account--link { text-decoration: none; }
.account--link .account__sub { font-size: .75rem; }

/* ==========================================================================
   Top bar
   ========================================================================== */
.st-top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  height: var(--top-h); padding: 0 12px 0 14px; flex-shrink: 0;
  background: var(--side); border-bottom: 1px solid var(--line);
}
.st-top__start { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-top__end { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.st-top__menu, .st-top__ai { display: none; }
.st-name {
  min-width: 0; width: clamp(140px, 20vw, 300px); height: 34px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; text-overflow: ellipsis;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.st-name:hover { border-color: var(--line); }
.st-name:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px rgba(139, 107, 61, .14); }
.st-page { height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); font-size: .8125rem; }
.st-saved { font-size: .75rem; color: var(--muted); margin: 0 6px; white-space: nowrap; }
.st-saved.is-error { color: var(--danger); }
.st-devices button { width: 38px; padding: 0; display: inline-grid; place-items: center; }
.st-devices .i { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:disabled:hover { background: none; }

/* ==========================================================================
   Body: stage and AI
   ========================================================================== */
.st-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) var(--ai-w); min-height: 0; }
.st-stage {
  position: relative; min-width: 0; min-height: 0; overflow: auto;
  background-color: var(--canvas);
  background-image: radial-gradient(rgba(22, 21, 20, .07) 1px, transparent 1.2px);
  background-size: 18px 18px;
}

/* ==========================================================================
   Setup
   ========================================================================== */
.setup { width: min(800px, calc(100% - 48px)); margin: 32px auto 72px; }
.setup__steps { display: flex; gap: 6px; margin-bottom: 16px; font-size: .8125rem; color: var(--muted); }
.setup__steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; }
.setup__num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card); font-size: .6875rem; font-weight: 600; }
.setup__steps li[aria-current="step"] { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(22, 21, 20, .06); }
.setup__steps li[aria-current="step"] .setup__num { background: var(--ink); border-color: var(--ink); color: #fff; }
.setup__steps li.is-done .setup__num { background: var(--live-soft); border-color: var(--live-soft); color: var(--live); }

.setup__panel { padding: 32px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); animation: rise .45s var(--ease) both; }
.setup__title { font-size: clamp(1.5rem, 2.4vw, 1.85rem); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; outline: none; }
.setup__lede { margin-top: 6px; color: var(--muted); max-width: 60ch; }
.setup__aside { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.setup__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.setup__warn { flex: 1; font-size: .8125rem; color: var(--draft); text-align: right; }
.setup__warn:empty { visibility: hidden; }

.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--card);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.choice:hover { border-color: #cbbfa9; }
.choice[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 107, 61, .14); background: #fffdf9; }
.choice__icon { display: inline-grid; place-items: center; width: 38px; height: 38px; margin-bottom: 6px; border-radius: 10px; background: var(--bg); color: var(--ink-2); }
.choice__title { font-weight: 600; }
.choice__text { font-size: .8125rem; color: var(--muted); }

.import { margin-top: 20px; animation: rise .35s var(--ease) both; }
.import__row { display: flex; gap: 8px; }
.import__row .field { flex: 1; }
.import__status { min-height: 1.4em; margin-top: 8px; font-size: .8125rem; color: var(--muted); }
.import__status.is-error { color: var(--danger); }
.import__status.is-ok { color: var(--live); }

.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card);
  font-size: .9375rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.input { padding-right: 28px; }
.input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 107, 61, .14); }
.input::placeholder { color: var(--placeholder); }
.field-label { display: block; margin: 16px 0 6px; font-size: .8125rem; font-weight: 500; }
.field-opt { font-weight: 400; color: var(--muted); }
.field-note { margin-top: 6px; font-size: .75rem; color: var(--muted); }

/* A product: photographs on the left, facts on the right */
.products { display: grid; gap: 16px; margin-top: 24px; }
.product-card { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fffdfb; }
.product-card__head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-bottom: -8px; }
.product-card__n { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.product-card .field-label:first-child { margin-top: 0; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; }
.photo { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo__pick { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: flex-end; padding: 5px; }
.photo__pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo__tick { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .9); border: 1px solid var(--line-2); color: transparent; }
.photo__tick .i { width: 13px; height: 13px; stroke-width: 2.4; }
.photo__pick input:checked + .photo__tick { background: var(--ink); border-color: var(--ink); color: #fff; }
.photo__pick input:focus-visible + .photo__tick { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo:has(input:not(:checked)) img { opacity: .38; filter: grayscale(.6); }
.photo--add {
  display: grid; place-items: center; align-content: center; gap: 4px; border-style: dashed; border-color: var(--line-2);
  background: var(--bg); color: var(--muted); font-size: .6875rem; text-align: center; cursor: pointer;
}
.photo--add:hover { color: var(--ink); border-color: #b9ae9b; }
.photo--add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo--add:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photos__note { grid-column: 1 / -1; font-size: .75rem; color: var(--muted); }

/* What I see in your photos (docs/product-aware.md §7) */
.seen { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }
.seen__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-bottom: 10px; }
.seen__title { font-size: .875rem; font-weight: 600; }
.seen__status { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; color: var(--muted); }
.seen__status.is-busy { color: var(--ink-2); }
.seen__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: seen-pulse 1.4s ease-in-out infinite; }
@keyframes seen-pulse { 50% { opacity: .25; } }
.seen__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.seen__row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.seen__row.is-off { background: var(--sunk); }
.seen__row.is-off .seen__thumb img { opacity: .38; filter: grayscale(.6); }
.seen__thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line); }
.seen__thumb img { width: 100%; height: 100%; object-fit: cover; }
.seen__thumb .photo__pick { padding: 4px; }
.seen__body { display: grid; align-content: start; gap: 5px; min-width: 0; font-size: .75rem; line-height: 1.4; color: var(--ink-2); }
.seen__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.seen__role {
  max-width: 100%; padding: 3px 24px 3px 9px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer;
  -webkit-appearance: none; appearance: none; font: inherit; font-size: .75rem; font-weight: 600; color: var(--ink);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236f675d' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center / 9px 6px;
}
.seen__role:hover { border-color: #b9ae9b; }
.seen__role:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seen__role.is-yours { border-color: var(--accent); background-color: #fff7ea; }
.seen__ground { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.seen__swatch { display: inline-block; flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.seen__subject { color: var(--ink); }
.seen__colours { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.seen__swatches { display: inline-flex; gap: 3px; }
.seen__swatches .seen__swatch { width: 14px; height: 14px; }
.seen__note { color: var(--muted); }
.seen__warn { color: #8a4b12; }
.seen__issues { display: flex; flex-wrap: wrap; gap: 4px; }
.seen__issue { padding: 1px 7px; border-radius: 999px; background: #f3ede4; color: #6b5230; font-size: .6875rem; }
.seen__product { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 0; font-size: .75rem; }
.seen__product div { display: flex; gap: 6px; }
.seen__product dt { color: var(--muted); }
.seen__product dd { margin: 0; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .seen__dot { animation: none; } }

.money { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.cost-note { margin-top: 6px; font-size: .75rem; color: var(--muted); }
.cost-note strong { color: var(--ink-2); font-weight: 500; }
.variant { display: grid; grid-template-columns: 120px minmax(0, 1fr) 32px; gap: 8px; margin-top: 8px; }
.angle { margin-top: 16px; padding: 18px 20px 20px; }
.angle .field-label:first-child { margin-top: 0; }
.angle__ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.angle__ideas .chip { height: 28px; padding: 0 11px; font-size: .8125rem; }

/* Looks: the three that suit this product, drawn live with its own words and photographs, and
   every other look a click away. Each preview is the desktop page (1280px wide, a real screen
   tall) scaled into its frame, so nothing sized to the screen is stretched. */
.setup--wide { width: min(1240px, calc(100% - 48px)); }
.looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.looks--rest { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 0; }
.look-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px 8px 14px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 16px; background: var(--card);
  transition: border-color .15s, box-shadow .2s;
}
.look-card:hover { border-color: #cbbfa9; box-shadow: var(--shadow-card); }
.look-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 107, 61, .16); }
.look-card__thumb {
  position: relative; aspect-ratio: 4 / 3; margin-bottom: 6px; border-radius: 10px; overflow: hidden;
  background: var(--sunk); pointer-events: none; box-shadow: inset 0 0 0 1px rgba(22, 21, 20, .06);
}
.look-card__thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 960px; border: 0; transform-origin: 0 0; transform: scale(var(--s, .25)); }
.look-card__tick {
  position: absolute; top: 10px; right: 10px; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .4);
  opacity: 0; transform: scale(.6); transition: opacity .18s, transform .25s var(--ease);
}
.look-card__tick .i { width: 15px; height: 15px; stroke-width: 2.4; }
.look-card[aria-checked="true"] .look-card__tick { opacity: 1; transform: none; }
.look-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; padding: 0 6px; }
.look-card__name { min-width: 0; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.looks--rest .look-card__name { font-size: 1.2rem; }
.look-card__rank {
  position: absolute; top: 10px; left: 10px; z-index: 1; padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 253, 249, .94); color: #5c4524; box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .35);
  font-size: .6875rem; font-weight: 600; letter-spacing: .02em;
}
.look-card__swatches { display: flex; margin-left: auto; padding-left: 3px; flex-shrink: 0; }
.look-card__swatches span { width: 14px; height: 14px; margin-left: -3px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--card), inset 0 0 0 1px rgba(0, 0, 0, .12); }
.look-card__note { padding: 0 6px; font-size: .8125rem; line-height: 1.45; color: var(--muted); }
.look-card__colour { padding: 0 6px; font-size: .75rem; line-height: 1.4; color: var(--ink-2); }
.looks--rest .look-card__note { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.look-card__why { margin: 2px 6px 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--ink-2); }
.looks__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; }
.looks__rest { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.looks__rest-title { margin-bottom: 12px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.style-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 12px; }
.style-row .segment { width: 100%; }
.style-row .segment button { flex: 1; }

/* ==========================================================================
   Building
   ========================================================================== */
.building { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 100%; padding: 48px 24px; text-align: center; }
.building__mark { width: 54px; height: 54px; color: var(--ink); animation: breathe 2.4s var(--ease) infinite; }
.building__mark svg { width: 54px; height: 54px; }
@keyframes breathe { 50% { transform: scale(.9) rotate(-8deg); opacity: .7; } }
.building__title { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; }
.building__steps { display: grid; gap: 10px; min-width: 280px; text-align: left; }
.building__steps li { display: flex; align-items: center; gap: 10px; font-size: .9375rem; color: var(--muted); }
.building__steps li .i { width: 16px; height: 16px; stroke-width: 2; }
.building__steps .dot { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.building__steps .dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.building__steps li.is-current { color: var(--ink); }
.building__steps li.is-current .dot::before { background: var(--ink); box-shadow: 0 0 0 4px rgba(22, 21, 20, .08); }
.building__steps li.is-done { color: var(--ink-2); }
.building__steps li.is-done .dot::before { display: none; }
.building__note { max-width: 46ch; font-size: .8125rem; color: var(--muted); }

/* ==========================================================================
   Canvas
   ========================================================================== */
.canvas { position: absolute; inset: 0; display: flex; flex-direction: column; }
.canvas__viewport { position: relative; flex: 1; min-height: 0; padding: 20px 24px 8px; overflow: hidden; }
.canvas__frame {
  position: relative; margin: 0 auto; height: 100%; overflow: hidden;
  border-radius: 10px; background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 21, 20, .08), 0 18px 50px -24px rgba(22, 21, 20, .35);
  transition: width .3s var(--ease);
}
.canvas__doc { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; }
.canvas__doc[hidden] { display: block !important; visibility: hidden; }
.canvas__hud { flex-shrink: 0; padding: 8px 24px 12px; font-size: .75rem; color: var(--muted); text-align: center; }

/* Ink: the crafting table. Strokes are drawn in page space and follow the page as it scrolls. */
.ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 3; }
.canvas__frame.is-drawing .ink { pointer-events: auto; cursor: crosshair; }
.ink path { fill: none; stroke: #c2491f; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ink path.is-highlight { stroke: rgba(243, 198, 64, .55); stroke-width: 16; mix-blend-mode: multiply; }
/* Visible by default; the animation only replays the stroke, so no motion setting can hide it. */
.ink path.is-new { stroke-dasharray: var(--len); animation: ink-in .5s var(--ease) both; }
@keyframes ink-in { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.ink__live { opacity: .9; }

/* The small bar over a selection */
.float {
  position: absolute; z-index: 4; display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 10px; background: #1c1b19; color: #f3f1ec; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; animation: pop .14s var(--ease);
}
.float.is-below { transform: translate(-50%, 10px); }
.float__label { padding: 0 8px 0 6px; font-size: .75rem; color: #b9b3a8; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.float button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: 7px; color: inherit; font-size: .8125rem; }
.float button:hover { background: rgba(255, 255, 255, .1); }
.float button:focus-visible { outline-color: #e7cf9f; }
.float .i { width: 16px; height: 16px; }
.float button[hidden] { display: none; }

/* ==========================================================================
   The AI panel
   ========================================================================== */
.ai { display: flex; flex-direction: column; min-height: 0; background: var(--side); border-left: 1px solid var(--line); }
.ai__head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.ai__tabs { flex: 1; }
.ai__tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ai__tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(22, 21, 20, .08); }
.ai__close { display: none; }
.ai__panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ai__panel--scroll { overflow-y: auto; padding: 14px 16px 24px; display: block; }
.segment--full { display: flex; width: 100%; }
.segment--full button { flex: 1; }

/* Messages */
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 8px; animation: rise .3s var(--ease) both; }
.msg__who { display: flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.msg__who .i { width: 14px; height: 14px; color: var(--accent); }
.msg__text { font-size: .875rem; line-height: 1.55; color: var(--ink); }
.msg--user { align-items: flex-end; }
.msg--user .msg__text { max-width: 88%; padding: 9px 12px; border-radius: 12px 12px 4px 12px; background: var(--card); border: 1px solid var(--line); }
.msg__targets { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.msg__note { font-size: .75rem; color: var(--muted); }
.msg__done { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--live); }
.msg__done .i { width: 15px; height: 15px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { background: var(--ink-2); transform: translateY(-2px); } }
.prompts { display: flex; flex-direction: column; gap: 6px; }
.prompts .chip { justify-content: flex-start; height: auto; min-height: 32px; padding: 6px 12px; border-radius: 10px; text-align: left; }

/* Options the AI offers: each one is a ready change */
.opts { display: grid; gap: 8px; }
.opt-card {
  display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.opt-card:hover, .opt-card:focus-within { border-color: #cbbfa9; box-shadow: var(--shadow-card); }
.opt-card.is-applied { border-color: var(--live-soft); background: #fbfdfb; }
.opt-card__top { display: flex; align-items: center; gap: 10px; }
.opt-card__text { flex: 1; min-width: 0; }
.opt-card__label { font-size: .875rem; font-weight: 600; }
.opt-card__desc { font-size: .8125rem; color: var(--muted); }
.opt-card__sample { font-size: 1.5rem; line-height: 1; color: var(--ink); min-width: 34px; text-align: center; }
.opt-card__actions { display: flex; align-items: center; gap: 6px; }
.opt-card__state { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--live); font-weight: 500; }
.opt-card__state .i { width: 14px; height: 14px; }
.swatches { display: flex; gap: 4px; flex-shrink: 0; }
.swatches span { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatches--now { margin-bottom: 8px; }
.swatches--now span { width: 24px; height: 24px; border-radius: 6px; }

/* Composer */
.chat { flex-shrink: 0; margin: 0 12px 12px; padding: 10px 10px 8px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-card); transition: border-color .15s, box-shadow .15s; }
.chat:focus-within { border-color: #cdbfa6; box-shadow: 0 0 0 4px rgba(139, 107, 61, .1), var(--shadow-card); }
.chat__targets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.chat__targets:empty { display: none; }
.target {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 26px; padding: 0 4px 0 9px;
  border-radius: 7px; background: var(--accent-soft); color: #5c4524; font-size: .75rem; font-weight: 500;
}
.target .i { width: 13px; height: 13px; }
.target__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target button { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: inherit; }
.target button:hover { background: rgba(92, 69, 36, .12); }
.msg__targets .target { padding-right: 9px; }
.chat__input { display: block; width: 100%; min-height: 44px; max-height: 180px; border: 0; resize: none; background: transparent; font-size: .9375rem; line-height: 1.5; outline: none; }
.chat__input::placeholder { color: var(--placeholder); }
.chat__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.chat__tools button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; font-size: .8125rem; }
.chat .send { width: 34px; height: 34px; }

/* Design tab */
.dz { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.dz:last-child { border-bottom: 0; }
.dz__head { display: flex; align-items: center; justify-content: space-between; }
.dz__title { font-size: .8125rem; font-weight: 600; margin: 4px 0 10px; }
.dz .segment + .dz__title { margin-top: 16px; }
.dz__sub { font-size: .75rem; color: var(--muted); margin: 0 0 8px; }
.dz .opts + .dz__sub { margin-top: 12px; }
.dz__sub--lead { margin: 14px 0 6px; font-weight: 600; color: var(--ink-2); }
.dz__title + div > .dz__sub--lead:first-child { margin-top: 0; }
.dz__hint { margin: -2px 0 10px; font-size: .75rem; line-height: 1.45; color: var(--muted); }
.opts + .dz__hint { margin: 8px 0 0; }
.dz__more { display: inline-flex; margin-top: 10px; font-size: .8125rem; }
/* The selected section's group sits on a faint ground, so it reads as "about what you clicked". */
.dz--section { margin: -14px -16px 18px; padding: 14px 16px 18px; background: #faf8f4; }
.dz--section .dz__title { font-size: .875rem; }
.opts__divider { margin: 6px 0 -2px; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* A look as an option: its colours as a band, its name in its own display face */
.opt-card--look { padding-top: 0; overflow: hidden; }
.opt-card__band { display: flex; height: 10px; margin: 0 -12px 2px; }
.opt-card__band span { flex: 1; }
.opt-card__label--face { font-size: 1.125rem; font-weight: 400; line-height: 1.15; letter-spacing: 0; }
.opt-card__faces { margin-top: 3px; font-size: .6875rem; color: var(--muted); letter-spacing: .01em; }
.opt-card--look.is-current { border-color: var(--accent); background: #fffdf9; }
.opt-card--look.is-current .opt-card__state { color: #6b5230; }
/* A borrowed layout names the look it comes from */
.opt-card__from { font-weight: 500; color: var(--accent); white-space: nowrap; }
/* A photograph on offer (Photos, Rearrange photos) */
.opt-card__photo { flex-shrink: 0; width: 52px; height: 52px; border-radius: 7px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line); }
.opt-card__photo img { width: 100%; height: 100%; object-fit: cover; }
.opt-card--photo .opt-card__desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.opt-card--variant .opt-card__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Page tab */
.outline { display: grid; gap: 4px; }
.outline__page { margin: 14px 0 6px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.outline__page:first-child { margin-top: 0; }
.outline__row { display: flex; align-items: center; gap: 4px; border-radius: 9px; transition: background-color .15s; }
.outline__row:hover, .outline__row.is-selected { background: var(--hover); }
.outline__row.is-selected { box-shadow: inset 2px 0 0 var(--accent); }
.outline__open { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 7px 10px; text-align: left; }
.outline__type { font-size: .8125rem; font-weight: 500; }
.outline__heading { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline__variant { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: var(--accent-soft); color: #5c4524; font-size: .6875rem; font-weight: 500; white-space: nowrap; }
.outline__row .icon-btn { width: 28px; height: 28px; opacity: 0; }
.outline__row:hover .icon-btn, .outline__row:focus-within .icon-btn, .outline__row.is-selected .icon-btn { opacity: 1; }
@media (hover: none) { .outline__row .icon-btn { opacity: 1; } }

/* During setup */
.brief { display: grid; gap: 12px; }
.brief__kicker { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.brief__kicker .i { color: var(--accent); }
.brief__lead { font-size: .875rem; line-height: 1.55; }
.brief__facts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.brief__facts div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .8125rem; }
.brief__facts dt { color: var(--muted); }
.brief__facts dd { overflow-wrap: anywhere; }

.checks { display: grid; gap: 8px; margin: 14px 24px 0; }
.checks li { display: flex; gap: 10px; font-size: .875rem; color: var(--ink-2); }
.checks .i { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; color: var(--live); }
.checks .is-warn .i { color: var(--draft); }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 12px 10px 16px; border-radius: 12px; background: #1c1b19; color: #f3f1ec;
  font-size: .875rem; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .45); animation: pop .18s var(--ease);
}
.toast button { color: #e7cf9f; font-weight: 500; font-size: .8125rem; padding: 4px 8px; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, .08); }

/* ==========================================================================
   Narrow screens: the AI becomes a sheet over the page
   ========================================================================== */
@media (max-width: 1100px) {
  :root { --ai-w: 340px; }
  .choices { grid-template-columns: 1fr; }
  .looks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .looks--rest { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-card { grid-template-columns: 1fr; }
  .st-saved { display: none; }
}

@media (max-width: 899px) {
  .ws--studio { display: block; }
  .st-top { grid-template-columns: minmax(0, 1fr) auto; padding: 0 8px; }
  .st-top__menu, .st-top__ai { display: inline-grid; }
  .st-devices { display: none !important; }
  .st-top__end .btn--ghost { display: none; }
  .st-name { width: auto; flex: 1; }
  .st-body { grid-template-columns: minmax(0, 1fr); position: relative; }
  .ai {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: min(78dvh, 640px);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px -20px rgba(22, 21, 20, .35);
    transform: translateY(102%); transition: transform .28s var(--ease);
  }
  html.ai-open .ai { transform: none; }
  .ai__close { display: inline-grid; }
  .setup { width: calc(100% - 32px); margin-top: 20px; }
  .setup__panel { padding: 20px; }
  .style-row { grid-template-columns: 1fr; }
  .looks { grid-template-columns: minmax(0, 1fr); }
  .looks--rest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .canvas__viewport { padding: 12px; }
  .float__label { display: none; }
}

/* What the supplier's listing said: kept apart from the client's own words, used only on purpose */
.listing { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg); }
.listing summary { cursor: pointer; font-size: .8125rem; }
.listing .field-note { margin: 8px 0 10px; white-space: pre-line; }
.dz--section [data-dz-photos].is-first > .dz__sub--lead:first-child { margin-top: 0; }
.dz--section [data-dz-photos].is-first { padding-bottom: 4px; }
