/* wizard.css — the operator wizard. Warm tailoring neutrals + a tailor's marking-blue
   accent (cohesive with the generation docket). Two-column on desktop: the selection
   walkthrough scrolls; the assembled-prompt preview + submit stay sticky. */

:root {
  --paper:#EFEBE2; --card:#FBF9F4; --sunk:#F1EDE4;
  --ink:#211E1A; --muted:#6E665A; --faint:#958D7E;
  --line:#DED7C8; --line-soft:#E9E3D6;
  --accent:#3B5B78; --accent-soft:#E3EAF0;
  --hard:#9C4A24; --good:#4C6B4A;
  --mono: ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  --sans: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --radius:11px; --shadow:0 1px 2px rgba(33,30,26,.05), 0 14px 34px -22px rgba(33,30,26,.4);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper:#1A1815; --card:#232019; --sunk:#1E1B16;
    --ink:#ECE6D9; --muted:#A69C8B; --faint:#847A69;
    --line:#3A342B; --line-soft:#2C271F;
    --accent:#82A8C6; --accent-soft:#22303B; --hard:#D07A4E; --good:#8FB182;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 16px 40px -24px rgba(0,0,0,.8);
  }
}

* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--paper); color:var(--ink); font:15px/1.5 var(--sans);
  letter-spacing:.004em; }
h1,h2,h3 { margin:0; }
button { font:inherit; }

/* ---- top bar ---- */
.topbar { display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px clamp(16px,3vw,32px); border-bottom:1px solid var(--line); background:var(--card);
  position:sticky; top:0; z-index:20; }
.brand { display:flex; align-items:center; gap:14px; }
.mark { width:38px; height:38px; flex:none; display:grid; place-items:center; border-radius:9px;
  background:var(--ink); color:var(--paper); font-weight:700; font-size:19px; letter-spacing:.02em; }
.brand h1 { font-size:18px; letter-spacing:.01em; }
.brand p { margin:2px 0 0; color:var(--muted); font-size:12.5px; }
.topbar-status { font-size:12px; color:var(--muted); font-family:var(--mono); }

/* ---- layout ---- */
.layout { max-width:1200px; margin:0 auto; padding:clamp(16px,3vw,28px) clamp(16px,3vw,32px) 80px;
  display:grid; gap:clamp(20px,3vw,34px); grid-template-columns:1fr; align-items:start; }
@media (min-width:940px) { .layout { grid-template-columns:minmax(0,1fr) 400px; } }

/* ---- selection sections ---- */
.section { margin:0 0 26px; }
.section-head { display:flex; align-items:baseline; gap:10px; margin:0 0 4px;
  border-bottom:1px solid var(--line); padding-bottom:8px; }
.section-head .n { font-family:var(--mono); font-size:12px; color:var(--accent); font-weight:700; }
.section-head h2 { font-size:12px; text-transform:uppercase; letter-spacing:.14em; }
.section-head .req { margin-left:auto; font-size:11px; color:var(--faint); text-transform:uppercase; letter-spacing:.1em; }
.cat { margin:16px 0 0; }
.cat-label { font-size:11px; text-transform:uppercase; letter-spacing:.1em; color:var(--muted);
  font-weight:600; margin:0 0 8px; display:flex; align-items:center; gap:8px; }
.cat-label .scope { font-family:var(--mono); font-size:10px; color:var(--faint); letter-spacing:0;
  border:1px solid var(--line); border-radius:20px; padding:1px 6px; text-transform:none; }
.cat-label .clear { margin-left:auto; font-size:11px; color:var(--accent); background:none; border:0;
  cursor:pointer; letter-spacing:.02em; text-transform:none; }
.cat-label .clear:hover { text-decoration:underline; }

/* option chips */
.opts { display:flex; flex-wrap:wrap; gap:8px; }
.opt { border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:8px;
  padding:8px 12px; font-size:13px; cursor:pointer; transition:border-color .12s, background .12s, box-shadow .12s;
  line-height:1.25; text-align:left; }
.opt:hover { border-color:var(--accent); }
.opt[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft);
  box-shadow:inset 0 0 0 1px var(--accent); font-weight:600; }
.opt:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* garment model cards (with sketch) */
.models { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; }
.model { border:1px solid var(--line); background:var(--card); border-radius:10px; overflow:hidden;
  cursor:pointer; text-align:left; padding:0; transition:border-color .12s, box-shadow .12s; }
.model:hover { border-color:var(--accent); }
.model[aria-pressed="true"] { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent); }
.model img { width:100%; aspect-ratio:3/4; object-fit:cover; background:var(--sunk); display:block; }
.model .cap { padding:8px 10px; font-size:12.5px; font-weight:600; }
.model:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* fabric swatches */
.fabrics { display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:10px; margin-top:4px; }
.swatch { border:1px solid var(--line); background:var(--card); border-radius:9px; overflow:hidden;
  cursor:pointer; padding:0; text-align:left; transition:border-color .12s, box-shadow .12s; }
.swatch:hover { border-color:var(--accent); }
.swatch[aria-pressed="true"] { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent); }
.swatch img { width:100%; height:66px; object-fit:cover; display:block; background:var(--sunk); }
.swatch .cap { padding:6px 8px; font-size:11px; line-height:1.3; }
.swatch .cap b { display:block; font-weight:600; }
.swatch .cap .meta { color:var(--muted); }
.swatch .cap .hard { color:var(--hard); font-weight:600; }
.swatch:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.fabric-hint { font-size:12px; color:var(--faint); margin:8px 0 0; }

/* ---- preview column ---- */
.preview { position:sticky; top:84px; display:flex; flex-direction:column; gap:16px; }
.preview-card, .submit-card { background:var(--card); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow); }
.preview-card { padding:16px 18px 18px; }
.preview-head { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.preview-head h2 { font-size:12px; text-transform:uppercase; letter-spacing:.12em; }
.pill { margin-left:auto; font-size:11px; font-weight:600; padding:3px 10px; border-radius:20px;
  background:var(--sunk); color:var(--muted); border:1px solid var(--line); white-space:nowrap; }
.pill.ready { background:var(--accent-soft); color:var(--accent); border-color:transparent; }
.prompt { font-family:var(--mono); font-size:12px; line-height:1.62; color:var(--ink);
  background:var(--sunk); border:1px solid var(--line-soft); border-left:3px solid var(--accent);
  border-radius:8px; padding:12px 13px; white-space:pre-wrap; word-break:break-word;
  max-height:280px; overflow:auto; }
.prompt.placeholder { color:var(--faint); font-family:var(--sans); border-left-color:var(--line); }
.prompt .slot { color:var(--accent); font-weight:700; background:var(--accent-soft); padding:0 3px; border-radius:3px; }
.refs { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:5px; }
.refs li { display:flex; align-items:center; gap:10px; font-size:12px; padding:6px 9px;
  background:var(--paper); border:1px solid var(--line-soft); border-radius:7px; }
.refs .no { flex:none; width:20px; height:20px; display:grid; place-items:center; border-radius:5px;
  background:var(--accent); color:#fff; font-family:var(--mono); font-size:11px; font-weight:700; }
.refs .role { font-weight:600; }
.refs .path { margin-left:auto; font-family:var(--mono); font-size:10.5px; color:var(--faint);
  word-break:break-all; text-align:right; }
.memory { margin-top:12px; font-size:11.5px; color:var(--muted); line-height:1.5;
  border-top:1px dashed var(--line); padding-top:10px; }
.memory b { color:var(--ink); }

/* derived shots (tick fields) */
.derived-card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:16px 18px; }
.derived-note { font-size:12px; color:var(--muted); margin:0 0 12px; line-height:1.45; }
.tick-group { margin:0 0 12px; }
.tick-group:last-child { margin-bottom:0; }
.tick-group h3 { font-size:10.5px; text-transform:uppercase; letter-spacing:.14em; color:var(--muted);
  font-weight:600; margin:0 0 7px; }
.ticks { display:flex; flex-wrap:wrap; gap:7px; }
.tick { display:inline-flex; align-items:center; gap:7px; font-size:13px; cursor:pointer;
  border:1px solid var(--line); background:var(--paper); border-radius:8px; padding:7px 11px;
  user-select:none; transition:border-color .12s, background .12s; }
.tick:hover { border-color:var(--accent); }
.tick input { appearance:none; -webkit-appearance:none; width:15px; height:15px; margin:0; flex:none;
  border:1.5px solid var(--faint); border-radius:4px; display:grid; place-items:center; cursor:pointer;
  transition:background .12s, border-color .12s; }
.tick input:checked { background:var(--accent); border-color:var(--accent); }
.tick input:checked::after { content:"✓"; color:#fff; font-size:10px; font-weight:800; line-height:1; }
.tick:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); font-weight:600; }
.tick input:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.derived-empty { font-size:12px; color:var(--faint); font-style:italic; }

/* editorial sub-panel: its own mood pickers + inspo upload */
.editorial-sub { margin-top:10px; padding:12px 13px; border:1px dashed var(--line); border-radius:9px;
  background:var(--paper); display:flex; flex-direction:column; gap:12px; }
.editorial-sub .derived-note { margin:0; }
.editorial-sub .tick-group { margin:0; }
.inspo-wrap { display:flex; flex-direction:column; gap:8px; }
.inspo-file { font-size:12px; color:var(--muted); }
.inspo-file::file-selector-button { font:inherit; font-size:12px; margin-right:8px; padding:6px 10px;
  border:1px solid var(--line); border-radius:7px; background:var(--card); color:var(--ink); cursor:pointer; }
.inspo-file::file-selector-button:hover { border-color:var(--accent); }
.inspo-status { font-size:12px; color:var(--muted); min-height:1em; }
.inspo-path { width:100%; font:12px var(--mono); color:var(--ink); background:var(--sunk);
  border:1px solid var(--line); border-radius:7px; padding:8px 10px; }
.inspo-path::placeholder { color:var(--faint); }
.inspo-preview:not(:empty) { margin-top:2px; }
.inspo-preview img { max-width:100%; max-height:160px; border-radius:8px; border:1px solid var(--line); display:block; }

/* submit */
.submit-card { padding:16px 18px; }
.btn { width:100%; padding:11px 16px; border-radius:9px; border:1px solid var(--ink);
  background:var(--ink); color:var(--paper); font-weight:600; font-size:14px; cursor:pointer;
  transition:opacity .12s, transform .04s; }
.btn:hover:not(:disabled) { opacity:.9; }
.btn:active:not(:disabled) { transform:translateY(1px); }
.btn:disabled { opacity:.4; cursor:not-allowed; }
.result { margin-top:14px; font-size:13px; }
.result:empty { display:none; }
.job { border:1px solid var(--line); border-radius:9px; padding:12px 13px; background:var(--paper); }
.job-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.job-row b { font-size:13px; }
.status { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
  padding:3px 9px; border-radius:20px; }
.status.queued { background:#EFE3C9; color:#8A6A1F; }
.status.running { background:var(--accent-soft); color:var(--accent); }
.status.done { background:#D9EAD4; color:var(--good); }
.status.failed { background:#F2D9CF; color:var(--hard); }
.job-lines { display:flex; flex-direction:column; gap:5px; margin-bottom:10px; }
.job-line { display:flex; align-items:center; gap:9px; font-size:13px; }
.job-line .status { flex:none; min-width:64px; text-align:center; }
.status.waiting, .status:empty { background:var(--card); color:var(--faint); }
.job-label { font-weight:600; }
.job-id { margin-left:auto; font-family:var(--mono); font-size:11px; color:var(--faint); }
.job .note { font-size:12px; color:var(--muted); line-height:1.45; }
.job .note code { font-family:var(--mono); font-size:11px; }
.job a { color:var(--accent); }

/* Each shot: a status line + an image slot that fills in as it's polled (submit + poll). */
.shots { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:10px; }
.shot { width:150px; }
.shot .job-line { margin-bottom:6px; }
.shot .job-label { font-size:12px; }
.shot-image img { display:block; width:100%; border-radius:6px; border:1px solid var(--line); }
.shot-ph { aspect-ratio:2/3; border-radius:6px; border:1px dashed var(--line); background:var(--card);
  display:flex; align-items:center; justify-content:center; padding:8px; text-align:center;
  font-size:11px; color:var(--faint); line-height:1.4; }
.shot-ph.failed { border-color:var(--hard); border-style:solid; color:var(--hard); }

.error { color:var(--hard); font-size:13px; }
.fatal { max-width:640px; margin:60px auto; padding:20px 24px; border:1px solid var(--hard);
  border-radius:10px; color:var(--hard); background:var(--card); font-size:14px; }

@media (prefers-reduced-motion: no-preference) {
  .job { animation:fade .3s ease both; }
  @keyframes fade { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
}
