/* Venue Studio — the A Lovers Card look (design.md): bottle-green header band, gold logo, paper and ivory pages,
   Cormorant Garamond titles and Manrope text. Comment pins stay #2563EB so they read on any photo. */

:root {
  color-scheme: light;
  /* design.md brand */
  --green: #2A4538;
  --green-deep: #1B2E25;
  --gold: #D6B15A;
  --gold-line: #C9A24C;
  --champagne: #EFE2BC;
  --paper: #FBF8F1;
  --ivory: #F3ECDC;
  --card: #FFFFFF;
  --sage: #DCE4D8;
  --line-strong: #D3C6A8;
  --ink: #1B2E25;
  --muted: #5E7466;
  --faint: #8A9C8F;
  --mark-keep: #3FAE5B;
  --mark-remove: #D2463C;
  --mark-draw: #2FB34A;
  --mark-callout: #2E9BE0;
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", system-ui, sans-serif;
  /* the names the stylesheet already uses, mapped onto the palette */
  --bg: var(--paper);
  --s1: var(--card);
  --s2: var(--ivory);
  --s3: #EDE4D0;
  --s4: var(--sage);
  --line: #E4D9C2;
  --line-2: var(--line-strong);
  --line-3: #BFAF8C;
  --fg: var(--ink);
  --fg-2: var(--muted);
  --fg-3: var(--faint);
  --ok: #3E8E5A;
  --warn: #B7822F;
  --bad: #B4473F;
  --pin: #2563eb;
  --peach: #d9a36f;
  --pink: #ec6fc4;
  --edge: #e3173f;
  --font: var(--sans);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --top-h: 64px;
  --rail-w: 232px;
  --panel-w: 320px;
  --tab-h: 56px;
  --hi: none;
  --pop: 0 0 0 1px var(--line), 0 12px 32px rgba(27, 46, 37, 0.12);
  --ease: cubic-bezier(0.55, 0, 0.25, 1);
  --t: 150ms var(--ease);
}

/* ---------------- Base ---------------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body.no-scroll, body.presenting { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--fg); }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--fg); }
::selection { background: rgba(255, 255, 255, 0.2); }
:focus { outline: none; }
:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--s2); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------------- Atoms ---------------- */

.muted { color: var(--fg-2); }
.small { font-size: 13px; }
.hint { color: var(--fg-3); font-size: 12px; line-height: 1.45; }
.eyebrow { font-size: 12px; color: var(--fg-3); font-weight: 500; }
.label { font-size: 12px; color: var(--fg-3); font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fg-2); }
.push { margin-left: auto; }
.empty-line { color: var(--fg-3); font-size: 13px; padding: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--s1); color: var(--fg);
  cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none;
  box-shadow: var(--hi);
  transition: background var(--t), border-color var(--t), color var(--t), opacity var(--t);
}
.btn:hover:not(:disabled) { background: var(--s3); border-color: var(--line-3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; }
.btn-quiet { background: var(--s1); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--fg-2); }
.btn-ghost:hover:not(:disabled) { background: var(--s3); border-color: transparent; color: var(--fg); }
.btn-ghost[aria-pressed="true"] { background: var(--s3); color: var(--fg); }
.btn-primary { background: var(--fg); color: #000; border-color: var(--fg); box-shadow: none; }
.btn-primary:hover:not(:disabled) { background: #fff; border-color: #fff; }
.btn .ico { flex: none; }
.btn.is-running .demo-dot { animation: pulse 1.2s ease-in-out infinite; background: var(--fg); }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--fg-2); cursor: pointer; transition: background var(--t), color var(--t); }
.icon-btn:hover { background: var(--s3); color: var(--fg); }
.link-btn { background: none; border: 0; padding: 0; color: var(--fg); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--fg-3); }

.select, .input {
  width: 100%; height: 36px; background: var(--s1); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 0 10px; color: var(--fg); transition: border-color var(--t), box-shadow var(--t);
}
.input-sm { height: 32px; font-size: 13px; }
.select-xs { height: 26px; width: auto; padding: 0 6px; font-size: 12px; background: transparent; border-color: var(--line-2); color: var(--fg-2); }
.select:focus-visible, .input:focus-visible, .input:focus { outline: none; border-color: var(--fg-2); box-shadow: 0 0 0 1px var(--fg-2); }
.input::placeholder { color: var(--fg-3); }

/* Loaders: skeleton shimmer, and a small pulsing dot where a spinner would be. */
.skeleton {
  background: linear-gradient(90deg, var(--s2) 25%, var(--s4) 40%, var(--s2) 60%) 0 0 / 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.spinner, .live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; animation: pulse 1.2s ease-in-out infinite; }
.btn-primary .spinner { background: #000; }
.sk-line { height: 14px; border-radius: 4px; }
.boot, .fatal { display: grid; place-items: center; gap: 12px; padding: 96px 16px; text-align: center; }
.boot-sk { width: 220px; height: 8px; border-radius: 4px; }
.fatal h1 { font-size: 20px; }
.noscript { padding: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; background: var(--s2); color: var(--fg-2); border: 1px solid var(--line-2); white-space: nowrap;
}
.badge.ok, .badge.warn, .badge.bad { color: var(--fg); }
.badge.ok::before, .badge.warn::before, .badge.bad::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.badge.warn::before { background: var(--warn); }
.badge.bad::before { background: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--fg-2);
  font-size: 12px; cursor: pointer; line-height: 24px; white-space: nowrap; transition: border-color var(--t), color var(--t), background var(--t);
}
.chip:hover { color: var(--fg); border-color: var(--line-3); background: var(--s2); }
.chip[aria-pressed="true"] { color: #000; background: var(--fg); border-color: var(--fg); }
.chip.skeleton { border-color: transparent; cursor: default; }
.alert { border: 1px solid rgba(240, 108, 108, 0.35); background: rgba(240, 108, 108, 0.06); color: var(--fg); padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px; }
.alert strong { font-weight: 600; }
.alert.inline { padding: 6px 10px; }
.notice { border: 1px dashed var(--line-3); padding: 8px 12px; border-radius: var(--r-sm); color: var(--fg-2); font-size: 13px; }
.progress { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 13px; }
.elapsed { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.img-error { padding: 16px; color: var(--fg-3); font-size: 12px; }
img { transition: opacity 200ms var(--ease); }
img.loading { opacity: 0; }

.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--hi); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* Segmented control */
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--s1); border: 1px solid var(--line-2); align-self: flex-start; }
.seg-btn { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 4px; color: var(--fg-2); cursor: pointer; font-size: 13px; transition: background var(--t), color var(--t); }
.seg-btn[aria-selected="true"], .seg-btn[aria-checked="true"] { background: var(--s4); color: var(--fg); }
.seg-sm .seg-btn { height: 24px; padding: 0 8px; font-size: 12px; }

/* ---------------- Top bar ---------------- */

.top {
  position: relative; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; overflow: hidden; font-size: 14px; }
.mark { width: 16px; height: 16px; flex: none; color: var(--fg); }
.brand-name { font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { color: var(--fg-2); white-space: nowrap; }
.brand-slash { color: var(--line-3); font-size: 18px; font-weight: 300; }
.brand-sep { width: 1px; height: 16px; background: var(--line-2); }
.project-name { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.top-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.demo-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); }
.cost-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--s1); color: var(--fg); font-size: 13px; cursor: pointer; transition: border-color var(--t), background var(--t);
}
.cost-pill:hover, .cost-pill[aria-expanded="true"] { border-color: var(--line-3); background: var(--s2); }
.cost-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg); }
.cost-pop {
  position: fixed; top: calc(var(--top-h) + 6px); right: 12px; z-index: 65; width: min(340px, calc(100vw - 24px));
  padding: 16px; border-radius: var(--r); background: var(--s1); box-shadow: var(--pop); display: flex; flex-direction: column; gap: 12px;
  animation: popIn 160ms var(--ease);
}
.cost-head { display: flex; align-items: baseline; justify-content: space-between; }
.cost-total { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.cost-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--s3); gap: 2px; }
.cost-seg { height: 100%; }
.s0 { background: var(--fg); }
.s1 { background: #8f8f8f; }
.s2 { background: #4a4a4a; }
.cost-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cost-legend li { display: flex; align-items: center; gap: 8px; }
.cost-legend li > span:last-child { margin-left: auto; }
.cost-key { width: 8px; height: 8px; border-radius: 2px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cost-table th { text-align: left; font-weight: 500; color: var(--fg-3); font-size: 12px; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.cost-table td { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--fg-2); }
.cost-table td:first-child { color: var(--fg); }
.cost-table .num { text-align: right; padding-left: 12px; }
.cost-table tr:last-child td { border-bottom: 0; }

/* ---------------- Shell ---------------- */

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); height: calc(100dvh - var(--top-h)); }
/* The row is the screen height: a long rail (Your projects) scrolls on its own instead of stretching the page past the screen. */
.shell > * { min-height: 0; }
.main { overflow: auto; min-width: 0; outline: none; }
body[data-stage="3"] .main { overflow: hidden; }

/* Rail */
.rail { display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); padding: 12px 8px; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; }
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; cursor: pointer; padding: 8px; border-radius: var(--r-sm);
  color: var(--fg-2); text-align: left; transition: background var(--t), color var(--t);
}
.stage-btn:hover:not(:disabled) { background: var(--s2); color: var(--fg); }
.stage-btn:disabled { cursor: not-allowed; opacity: 0.4; }
.stage-btn.current { background: var(--s3); color: var(--fg); }
.stage-num {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  font-size: 12px; font-weight: 500; border: 1px solid var(--line-3); color: var(--fg-2); font-variant-numeric: tabular-nums;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.stage-btn.done .stage-num { background: var(--s4); border-color: var(--s4); color: var(--fg); }
.stage-btn.current .stage-num { background: var(--fg); border-color: var(--fg); color: #000; }
.stage-text { display: flex; flex-direction: column; min-width: 0; }
.stage-title { font-size: 13px; font-weight: 500; line-height: 1.3; }
.stage-title .short { display: none; }
.stage-sub { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.rail-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.present-btn .stage-num { border-style: dashed; }

/* Side panel */
.panel { width: var(--panel-w); border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
body:not(.has-panel) .panel { display: none; }
.panel-tabs { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; height: 44px; border-bottom: 1px solid var(--line); flex: none; }
.panel-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; border: 0; background: none; padding: 0 6px; color: var(--fg-3); cursor: pointer;
  font-size: 13px; box-shadow: inset 0 -1px 0 transparent; white-space: nowrap; transition: color var(--t), box-shadow var(--t);
}
.panel-tab:hover { color: var(--fg-2); }
.panel-tab[aria-selected="true"] { color: var(--fg); box-shadow: inset 0 -1px 0 var(--fg); }
.panel-close { margin-left: auto; }
.panel-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.panel-sub { margin-top: 4px; }
.lib-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lib-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lib-item { position: relative; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--s1); cursor: grab; text-align: left; aspect-ratio: 4 / 5; transition: border-color var(--t); }
.lib-grid.small .lib-item { aspect-ratio: 1; }
.lib-item:hover { border-color: var(--line-3); }
.lib-item img { width: 100%; height: 100%; object-fit: cover; }
.lib-cap { position: absolute; inset: auto 0 0 0; padding: 24px 8px 6px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88)); display: flex; flex-direction: column; }
.lib-label { font-size: 12px; font-weight: 500; line-height: 1.25; }
.lib-grid.small .lib-label { font-size: 11px; color: var(--fg-2); }
.lib-style { font-size: 11px; color: var(--fg-3); }
.layers, .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: var(--r-sm); transition: background var(--t), border-color var(--t); }
.layer:hover { background: var(--s1); }
.layer.selected { background: var(--s2); border-color: var(--line-2); }
.layer-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--pin); color: #fff; font-size: 11px; font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.layer-num.area { background: linear-gradient(120deg, var(--peach), var(--pink)); color: #000; }
.layer-num.applied { background: var(--s4); color: var(--fg-2); }
.layer-main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 0; display: flex; flex-direction: column; }
.layer-title { font-size: 13px; font-weight: 500; }
.layer-text { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-refs { font-size: 11px; color: var(--fg-3); }
.hist { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s1); }
.hist.shown { border-color: var(--line-3); }
.hist-thumb { width: 72px; height: 54px; flex: none; border-radius: 4px; overflow: hidden; padding: 0; border: 1px solid var(--line); cursor: pointer; background: var(--s2); }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.hist-notes { margin: 0; padding: 0; list-style: none; color: var(--fg-2); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }

/* ---------------- Stage views ---------------- */

.stage-view { max-width: 1120px; margin: 0 auto; padding: 32px 32px 112px; display: flex; flex-direction: column; gap: 24px; }
.stage-view.enter { animation: rise 200ms var(--ease); }
.stage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.stage-head-text { display: flex; flex-direction: column; gap: 6px; max-width: 680px; }
.lead { color: var(--fg-2); font-size: 14px; max-width: 68ch; }
.stage-foot {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: var(--r); background: rgba(10, 10, 10, 0.9); border: 1px solid var(--line-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--hi);
}
.foot-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; min-width: 0; }
.foot-text .progress, .foot-text .alert { flex-basis: 100%; }
.foot-actions { display: flex; gap: 8px; margin-left: auto; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--s1); font-size: 13px; }

/* Slots */
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.slot { border-radius: var(--r); background: var(--s1); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--hi); transition: border-color var(--t); }
.slot.ok { border-color: var(--line-2); }
.slot.drop-over { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.slot-media { position: relative; aspect-ratio: 4 / 3; background: var(--bg); border-bottom: 1px solid var(--line); }
.slot-media img { width: 100%; height: 100%; object-fit: cover; }
.slot-empty {
  position: absolute; inset: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px;
  text-align: center; color: var(--fg-2); font-size: 12px; border: 1px dashed var(--line-3); border-radius: var(--r-sm); transition: border-color var(--t), background var(--t);
}
.slot:hover .slot-empty { border-color: var(--fg-3); }
.slot.drop-over .slot-empty { border-color: var(--fg); background: rgba(255, 255, 255, 0.03); }
.slot-hint { max-width: 22ch; }
.slot-scan { position: absolute; inset: 0; opacity: 0.6; }
.slot-tag { font-size: 13px; font-weight: 600; }
.slot-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.slot-reason { font-size: 12px; color: var(--fg-2); }
.slot-actions { display: flex; gap: 4px; margin-top: auto; flex-wrap: wrap; margin-left: -8px; }
.slot-clean { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.compass { width: 32px; height: 32px; }
.compass-ring { fill: none; stroke: var(--line-3); stroke-width: 1.2; }
.compass-ray { stroke: var(--fg); stroke-width: 2; stroke-linecap: round; }
.compass-me { fill: var(--fg); }

/* Overview */
.overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ov-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ov-media { border-radius: var(--r-sm); overflow: hidden; background: var(--bg); border: 1px solid var(--line); aspect-ratio: 4 / 3; position: relative; }
.ov-img { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ov-img img { width: 100%; height: 100%; object-fit: contain; }
.ov-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; }
.ov-media .viewer { position: absolute; inset: 0; height: 100%; border-radius: 0; }

/* ---------------- Design canvas ---------------- */

.design { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.design-stage { position: relative; flex: 1; min-height: 0; background: var(--bg); }
/* Embedded editor host (ADR-6): fills the stage area; toolbar floats above via z-index. */
.design-editor-host { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--s2); z-index: 1; }
.design-editor-host .ed-canvas { min-height: 0; }
.ed-wrap.embedded .ed-toolbar-wrap { display: none; }
.ed-wrap.embedded .ed-tools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--s1); }
.ed-wrap.embedded .ed-tools[hidden] { display: none; }
.ed-wrap.embedded { position: relative; }
/* Layer bar uses sketch-bar layout; dot is white not blue. */
.design-layer-bar .sketch-bar-dot { background: var(--fg-2); box-shadow: none; }
.design-layer-bar .dlb-status { min-width: 52px; white-space: nowrap; }
.dc { position: absolute; inset: 0; outline: none; }
.dc-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--bg); }
.dc-viewport[data-tool="comment"] { cursor: crosshair; }
.dc-readonly .dc-viewport[data-tool="comment"] { cursor: default; }
.dc-viewport[data-tool="pan"], .dc-viewport.space { cursor: grab; }
.dc-viewport.panning { cursor: grabbing; }
.dc-viewport.dropping::after { content: ""; position: absolute; inset: 8px; border: 1px dashed var(--fg-2); border-radius: var(--r); pointer-events: none; }
.dc-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.dc-base, .dc-reveal { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.dc-base { box-shadow: 0 0 0 1px var(--line); }
.dc-reveal { z-index: 2; }
.dc-wipe-edge { position: absolute; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); z-index: 3; background: #fff; box-shadow: 0 0 16px 2px rgba(255, 255, 255, 0.35); pointer-events: none; }
.dc-overlay { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.dc-overlay [data-ui] { pointer-events: auto; }

/* Comment pins: blue numbered circle on the point; a ring shows live progress. */
.pin { position: absolute; width: 0; height: 0; z-index: 2; }
.pin.editing { z-index: 4; }
.pin-btn {
  position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--pin); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 3px 10px rgba(0, 0, 0, 0.5); transition: transform 150ms var(--ease), background var(--t), box-shadow var(--t);
  animation: pinDrop 220ms var(--ease);
}
.pin-btn:hover, .pin.editing .pin-btn { transform: scale(1.08); }
.pin.editing .pin-btn { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(37, 99, 235, 0.35), 0 3px 10px rgba(0, 0, 0, 0.5); }
.pin-num { pointer-events: none; line-height: 1; }
.pin-ring { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; pointer-events: none; transform: rotate(-90deg); opacity: 0; transition: opacity var(--t); }
.pin-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 3; }
.pin-ring-fg { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 900ms linear; }
.pin.s-running .pin-ring { opacity: 1; }
.pin.s-running .pin-btn { animation: pinPulse 1.4s ease-in-out infinite; }
.pin.s-queued .pin-btn { background: #1d3f8f; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6), 0 3px 10px rgba(0, 0, 0, 0.5); }
.pin.s-applied .pin-btn { background: #3a3a3a; color: var(--fg-2); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4); animation: none; }
.pin.s-applied.flagged .pin-btn { box-shadow: 0 0 0 1.5px var(--warn), 0 2px 6px rgba(0, 0, 0, 0.4); }
.pin.s-failed .pin-btn { background: #111; color: var(--fg); box-shadow: 0 0 0 1.5px var(--bad), 0 3px 10px rgba(0, 0, 0, 0.5); }
.pin-time { position: absolute; left: 0; top: 22px; transform: translateX(-50%); font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.8); color: var(--fg); white-space: nowrap; pointer-events: none; }
.pin-time:empty { display: none; }
.pin-tip {
  position: absolute; left: 0; bottom: 20px; transform: translate(-50%, 4px); width: max-content; max-width: 260px; padding: 6px 10px; border-radius: var(--r-sm);
  background: #2a2a2a; color: var(--fg); font-size: 12px; line-height: 1.4; box-shadow: 0 0 0 1px var(--line-3), 0 6px 16px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 150ms var(--ease), transform 150ms var(--ease); overflow-wrap: anywhere;
}
.pin:hover .pin-tip, .pin.show-tip .pin-tip, .pin:focus-within .pin-tip { opacity: 1; transform: translate(-50%, 0); }
.pin.editing .pin-tip, .pin.s-draft .pin-tip, .pin.s-failed .pin-tip { display: none; }
.pin-bubble {
  position: absolute; left: 20px; top: -14px; width: 240px; padding: 10px 12px; border-radius: 12px; background: #2a2a2a;
  box-shadow: 0 0 0 1px rgba(240, 108, 108, 0.45), 0 10px 30px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 8px; font-size: 12px; animation: popIn 150ms var(--ease);
}
.pin-err { color: var(--fg-2); overflow-wrap: anywhere; }
.pin-err strong { color: var(--fg); }
.pin-area { position: absolute; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.7); background: rgba(37, 99, 235, 0.08); pointer-events: none; transition: width 80ms, height 80ms, left 80ms, top 80ms; }
.pin-area.live { border-style: solid; border-color: rgba(255, 255, 255, 0.35); animation: areaPulse 1.6s ease-in-out infinite; }

/* Comment pill: dark rounded input with send arrow, references and area slider. */
.pill {
  position: absolute; z-index: 6; display: flex; flex-direction: column; padding: 6px 6px 8px 12px; border-radius: 18px;
  background: #262626; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 12px 32px rgba(0, 0, 0, 0.55); animation: popIn 150ms var(--ease);
}
.pill-row { display: flex; align-items: flex-end; gap: 8px; }
.pill-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--pin); color: #fff; font-size: 11px; font-weight: 700; flex: none; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.pill-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); resize: none; padding: 5px 0; margin: 0; font-size: 14px; line-height: 20px; height: 30px; max-height: 140px; overflow-y: auto; outline: none; }
.pill-input::placeholder { color: #8f8f8f; }
.pill-send { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fg); color: #000; cursor: pointer; transition: background var(--t); }
.pill-send:hover { background: #fff; }
.pill-extra { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding: 8px 4px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.pill-refs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 20px; }
.pill-hint { font-size: 11px; color: #8f8f8f; }
.pill-foot { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.pill-arearow { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.pill-label { font-size: 11px; color: #8f8f8f; font-weight: 500; }
.pill-area { flex: 1; min-width: 0; accent-color: var(--fg); height: 16px; }
.pill-area-val { font-size: 12px; color: var(--fg-2); width: 32px; text-align: right; }
.pill-upload { color: var(--fg-2); }
.pill-upload:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.ref-chip { position: relative; width: 40px; height: 40px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.14); padding: 0; background: var(--bg); flex: none; animation: popIn 150ms var(--ease); }
.ref-chip img { width: 100%; height: 100%; object-fit: cover; }
.ref-chip.error { border-color: rgba(240, 108, 108, 0.6); }
.ref-state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: var(--fg); font-weight: 700; font-size: 13px; }
.ref-x { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.8); color: var(--fg); font-size: 11px; line-height: 1; cursor: pointer; padding: 0; opacity: 0; transition: opacity var(--t); }
.ref-chip:hover .ref-x, .ref-x:focus-visible { opacity: 1; }
@media (hover: none) { .ref-x { opacity: 1; } }

/* Quality-check notes (the only amber in the UI) */
.qa-note { font-size: 12px; color: var(--warn); }
.qa-chip { align-self: flex-start; display: inline-flex; align-items: center; max-width: 100%; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; color: var(--warn); border: 1px solid rgba(229, 180, 84, 0.35); background: rgba(229, 180, 84, 0.06); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-text { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tab-count { font-size: 11px; color: var(--fg-3); }
.p-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 28px; }
.p-version { display: flex; flex-direction: column; gap: 10px; }
.p-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.p-note { color: var(--fg-2); font-size: 14px; }
.p-note strong { color: var(--fg); font-weight: 600; }


.dc-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--fg-3); padding: 16px; text-align: center; font-size: 13px; }
.dc-empty-sk { width: min(560px, 70%); aspect-ratio: 16 / 10; border-radius: var(--r); }
.dc-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7; height: 32px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 999px; background: rgba(10, 10, 10, 0.85); border: 1px solid var(--line-2); color: var(--fg-2); font-size: 13px; white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeIn 200ms var(--ease);
}
.toolbar {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 8; display: flex; flex-direction: column; gap: 2px; padding: 4px;
  border-radius: var(--r); background: rgba(10, 10, 10, 0.92); border: 1px solid var(--line-2); box-shadow: var(--hi); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tool { position: relative; width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--fg-2); cursor: pointer; display: grid; place-items: center; transition: background var(--t), color var(--t); }
.tool:hover:not(:disabled) { background: var(--s3); color: var(--fg); }
.tool:disabled { opacity: 0.3; cursor: not-allowed; }
.tool[aria-pressed="true"] { background: var(--fg); color: #000; }
.tool-key { position: absolute; right: 2px; bottom: 1px; font-size: 8px; opacity: 0.55; font-weight: 600; }
.tool-sep { height: 1px; margin: 3px 4px; background: var(--line-2); }

.design-foot { flex: none; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.design-msg { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 13px; overflow: hidden; }
.design-msg > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design-msg .alert { white-space: normal; }
.foot-count { font-weight: 600; }
.msg-live { display: inline-flex; align-items: center; gap: 8px; }
.design-actions { display: flex; gap: 6px; align-items: center; flex: none; }


/* ---------------- Modal, drawer, toasts, dock ---------------- */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.72); animation: fadeIn 150ms var(--ease); }
.modal-box { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: var(--r-lg); background: var(--s1); box-shadow: var(--pop); padding: 20px; display: flex; flex-direction: column; gap: 16px; animation: popIn 180ms var(--ease); }
.modal-box.wide { width: min(1040px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 16px; }
.lightbox .modal-box { width: min(1200px, 100%); }
.lightbox-img img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: var(--r-sm); }
.viewer-modal { height: min(70vh, 640px); }
.viewer-modal .viewer { height: 100%; }
.camera-box { width: min(760px, 100%); }
.camera-stage { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; }
.camera-msg { position: absolute; inset: 0; display: flex; gap: 8px; align-items: center; justify-content: center; padding: 16px; text-align: center; color: var(--fg-2); }
.camera-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shutter { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #000; background: #fff; cursor: pointer; box-shadow: 0 0 0 2px #fff; }
.shutter:disabled { opacity: 0.4; }


.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 8px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: var(--r); background: var(--s1); box-shadow: var(--pop); animation: popIn 180ms var(--ease); font-size: 13px; }
.toast-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.toast-text span { color: var(--fg-2); }
.toast-error { box-shadow: 0 0 0 1px rgba(240, 108, 108, 0.45), 0 12px 32px rgba(0, 0, 0, 0.55); }
.toast-x { border: 0; background: none; color: var(--fg-3); font-size: 16px; cursor: pointer; line-height: 1; padding: 0 2px; }
.toast-x:hover { color: var(--fg); }

.dock {
  position: fixed; left: calc(var(--rail-w) + 16px); bottom: 16px; z-index: 40; width: 300px; max-height: calc(100dvh - var(--top-h) - 32px); overflow: auto;
  padding: 14px; border-radius: var(--r); background: var(--s1); box-shadow: var(--pop); display: flex; flex-direction: column; gap: 12px; animation: popIn 200ms var(--ease);
}
body[data-stage="3"] .dock { bottom: 80px; left: calc(var(--rail-w) + 60px); }
.dock-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.dock-title { font-size: 14px; line-height: 1.3; margin-top: 2px; }
.swatches { display: flex; gap: 4px; }
.swatch { width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl { position: relative; display: flex; gap: 10px; padding: 0 0 10px; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--line-2); }
.tl-done:not(:last-child)::before { background: var(--fg-3); }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line-3); background: var(--bg); flex: none; margin-top: 4px; }
.tl-running .tl-dot { border-color: var(--fg); animation: pulse 1.2s ease-in-out infinite; }
.tl-done .tl-dot { background: var(--fg); border-color: var(--fg); }
.tl-failed .tl-dot { background: var(--bad); border-color: var(--bad); }
.tl-stopped .tl-dot { background: var(--warn); border-color: var(--warn); }
.tl-warn.tl-done .tl-dot { background: var(--warn); border-color: var(--warn); }
.tl-body { flex: 1; min-width: 0; }
.tl-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.tl-pending .tl-label { color: var(--fg-3); }
.tl-state { color: var(--fg-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-note { font-size: 12px; color: var(--fg-2); }
.tl-warn .tl-note { color: var(--warn); }
.tl-error { font-size: 12px; color: var(--bad); }

/* ---------------- 360 viewer ---------------- */

.viewer { position: relative; width: 100%; height: 100%; min-height: 200px; background: #000; border-radius: var(--r-sm); overflow: hidden; outline: none; }
.viewer:focus-visible { box-shadow: inset 0 0 0 1px #fff; }
.viewer-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.viewer.grabbing .viewer-canvas { cursor: grabbing; }
.viewer-ctrls { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; z-index: 2; }
.viewer-btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.75); color: var(--fg); cursor: pointer; font-size: 14px; transition: background var(--t); }
.viewer-btn:hover { background: var(--s3); }
.viewer-btn-text { font-size: 12px; }
.viewer-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); font-size: 12px; color: var(--fg-2); transition: opacity 400ms; pointer-events: none; }
.viewer-hint.gone { opacity: 0; }
.viewer-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--fg-2); font-size: 13px; z-index: 3; }
.viewer-err-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; text-align: center; }
.viewer-max { position: fixed !important; inset: 0 !important; z-index: 90; border-radius: 0; height: 100dvh !important; }

/* ---------------- Presentation ---------------- */

.present { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; animation: fadeIn 200ms var(--ease); }
.p-bar { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.p-scroll { flex: 1; overflow: auto; }
.p-body { max-width: 1080px; margin: 0 auto; padding: 56px 24px 120px; display: flex; flex-direction: column; gap: 72px; }
.p-hero { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.p-hero h1 { font-size: 40px; letter-spacing: -0.03em; line-height: 1.05; }
.p-hero .lead { font-size: 16px; }
.p-section { display: flex; flex-direction: column; gap: 20px; }
.p-head { display: flex; gap: 16px; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.p-head h2 { font-size: 20px; letter-spacing: -0.01em; }
.p-num { font-size: 13px; color: var(--fg-3); font-family: var(--mono); }
.p-grid { display: grid; gap: 12px; }
.p-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.p-fig { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.p-fig figcaption { font-size: 13px; color: var(--fg-2); }
.p-img { padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--s1); cursor: zoom-in; display: block; width: 100%; }
.p-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.p-fig.wide .p-img img { aspect-ratio: auto; object-fit: contain; max-height: 72vh; }
.p-el { display: flex; flex-direction: column; gap: 8px; }
.p-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.p-thumb { width: 56px; height: 42px; padding: 0; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--s1); cursor: zoom-in; }
.p-thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--fg-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.p-notes strong { color: var(--fg); font-weight: 500; }
.p-viewer { height: min(62vh, 560px); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.p-viewer .viewer { height: 100%; border-radius: 0; }
.p-specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.p-spec { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.p-price { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.p-cost { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 420px; }

/* ---------------- Progress cards (ADR-10) ---------------- */

.prog-card {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  overflow: hidden;
  /* Soft light pool drifting across a dark card, like the reference. */
  background:
    radial-gradient(60% 80% at 20% 30%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%),
    linear-gradient(135deg, #3a3b3e 0%, #232427 45%, #1a1b1d 100%);
  background-size: 200% 200%, 100% 100%;
  border: 0;
  display: flex;
  flex-direction: column;
  animation: progDrift 6s ease-in-out infinite alternate;
  cursor: default;
}
.prog-card.is-done,
.prog-card.is-failed { animation: none; background: var(--s2); }
.prog-card.is-selected { box-shadow: 0 0 0 2px var(--fg); }
.prog-card--inline { aspect-ratio: unset; min-height: 36px; padding: 4px 8px; }
.prog-card-ico {
  position: absolute;
  top: 16px;
  left: 18px;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.prog-card--inline .prog-card-ico { position: static; display: inline-flex; vertical-align: middle; }
.prog-card-pct {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.prog-card--inline .prog-card-pct { position: static; display: inline; margin-left: 4px; }
.prog-card-lbl {
  position: absolute;
  bottom: 16px;
  left: 18px;
  right: 52px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.prog-card--inline .prog-card-lbl { position: static; display: inline; margin-left: 4px; }
.prog-card-act { position: absolute; bottom: 12px; right: 16px; }
.prog-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prog-card.is-done .prog-card-pct,
.prog-card.is-done .prog-card-ico,
.prog-card.is-done .prog-card-lbl { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.prog-card-fail {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 12px;
  color: var(--bad);
}
.prog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* ---------------- Motion ---------------- */

@keyframes progDrift { from { background-position: 0% 0%, 0 0; } to { background-position: 100% 100%, 0 0; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes pinPulse { 0%, 100% { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.92), 0 0 0 0 rgba(37, 99, 235, 0.55), 0 3px 8px rgba(0, 0, 0, 0.45); } 50% { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.92), 0 0 0 8px rgba(37, 99, 235, 0), 0 3px 8px rgba(0, 0, 0, 0.45); } }
@keyframes pinDrop { from { transform: translateY(-6px) scale(0.7); opacity: 0; } }
@keyframes areaPulse { 0%, 100% { background: rgba(37, 99, 235, 0.06); } 50% { background: rgba(37, 99, 235, 0.16); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@keyframes popIn { from { opacity: 0; transform: translateY(2px) scale(0.99); } }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1240px) {
  :root { --rail-w: 64px; --panel-w: 300px; }
  .rail { padding: 12px 8px; }
  .stage-btn { justify-content: center; padding: 8px 0; }
  .stage-text { display: none; }
  .stage-num { width: 28px; height: 28px; }
  .dock { left: calc(var(--rail-w) + 16px); }
}
@media (max-width: 1080px) {
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview { grid-template-columns: 1fr; }
  .p-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .top { padding: 0 8px 0 12px; }
  .brand-sub, .brand-slash, .hide-sm { display: none; }
  .project-name { max-width: 34vw; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .main { padding-bottom: var(--tab-h); }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); flex-direction: row; align-items: stretch;
    padding: 4px 4px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); overflow: visible;
  }
  .stages { flex-direction: row; flex: 1; gap: 0; }
  .stages li { flex: 1; }
  .rail-foot { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 4px; display: flex; }
  .stage-btn { flex-direction: column; gap: 2px; padding: 4px 2px; height: 100%; justify-content: center; }
  .stage-btn.current { background: transparent; }
  .stage-text { display: flex; align-items: center; }
  .stage-sub { display: none; }
  .stage-num { width: 24px; height: 24px; font-size: 11px; }
  .stage-title { font-size: 11px; }
  .stage-title .long { display: none; }
  .stage-title .short { display: inline; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: var(--tab-h); z-index: 35; width: auto; height: min(64dvh, 560px); border-left: 0; border-top: 1px solid var(--line-2);
    border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(calc(100% + var(--tab-h))); transition: transform 200ms var(--ease);
  }
  body .panel:not([hidden]) { display: flex !important; }
  body.sheet-open .panel { transform: none; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6); }
  .panel-tabs { overflow-x: auto; }
  .stage-view { padding: 20px 16px 96px; gap: 16px; }
  h1 { font-size: 22px; }
  .stage-foot { bottom: 8px; padding: 8px; }
  .foot-actions { width: 100%; }
  .foot-actions .btn { flex: 1; }
  .slots { gap: 8px; }
  .toolbar { top: 8px; left: 8px; transform: none; flex-direction: row; flex-wrap: wrap; max-width: calc(100% - 16px); padding: 2px; }
  .tool { width: 34px; height: 34px; }
  .tool-sep { width: 1px; height: auto; margin: 4px 2px; }
  .tool-key, .tool[data-act="zin"], .tool[data-act="zout"] { display: none; }
  .pin-bubble { left: -120px; top: 26px; width: min(240px, 80vw); }
  .p-pair { gap: 6px; }
  .dc-hint { top: auto; bottom: 12px; font-size: 12px; }
  .design-foot { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .design-msg { order: 2; flex: 1 1 100%; font-size: 12px; }
  .design-actions { order: 3; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .design-actions .btn { padding: 0 10px; }
  .dock, body[data-stage="3"] .dock { left: 8px; right: 8px; width: auto; bottom: calc(var(--tab-h) + 8px); max-height: 46dvh; }
  .toasts { left: 8px; right: 8px; bottom: calc(var(--tab-h) + 8px); max-width: none; }
  .cost-pop { right: 8px; }
  .p-body { padding: 32px 16px 96px; gap: 48px; }
  .p-hero h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .project-name, .brand-name, .demo-dot { display: none; }
  .top-actions { gap: 4px; }
  .top-actions .btn { padding: 0 10px; }
  .slot-empty .compass, .slot-hint { display: none; }
  .callout { flex-direction: column; align-items: flex-start; }
  .p-grid.four, .p-grid.three { grid-template-columns: 1fr 1fr; }
  #new-project { padding: 0 10px; }
}

/* Spec sheet */
.spec-sheet { display: flex; flex-direction: column; gap: 14px; }
.spec-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
@media (max-width: 640px) { .spec-grid { grid-template-columns: 1fr; } }
.spec-photo { display: flex; flex-direction: column; gap: 6px; }
.spec-drop { aspect-ratio: 3 / 4; width: 100%; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--s2, var(--s1)); color: var(--fg-2); cursor: pointer; padding: 0; }
.spec-drop img { width: 100%; height: 100%; object-fit: cover; }
.spec-form { display: flex; flex-direction: column; gap: 10px; }
.spec-dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.spec-notes { height: auto; padding: 8px 10px; resize: vertical; font: inherit; }
.spec-result { display: flex; flex-direction: column; gap: 8px; }
.spec-board { padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; cursor: zoom-in; }
.spec-board img { display: block; width: 100%; height: auto; }

/* Decor step */
.decor-step { display: flex; flex-direction: column; gap: 16px; }
.decor-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.decor-thumb { position: relative; flex: 0 0 auto; width: 96px; height: 96px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s1); overflow: hidden; cursor: pointer; color: var(--fg-2); font-size: 12px; }
.decor-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.decor-thumb.is-on { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.decor-add { border-style: dashed; display: grid; place-items: center; }
.decor-badge { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.75); font-size: 10px; color: #fff; }
.decor-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .decor-editor { grid-template-columns: 1fr; } }
.decor-main { display: flex; justify-content: center; }
.decor-canvas { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: crosshair; touch-action: none; user-select: none; }
.decor-canvas img { display: block; max-width: 100%; max-height: 64dvh; pointer-events: none; }
.decor-rings { position: absolute; inset: 0; pointer-events: none; }
.decor-ring { position: absolute; border: 2px solid #fff; border-radius: 50%; background: rgba(255,255,255,.12); box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.6); }
.decor-ring-n { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #000; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.decor-ring-n.static { position: static; transform: none; flex: 0 0 auto; margin-top: 6px; }
.decor-side { display: flex; flex-direction: column; gap: 12px; }
.decor-regions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.decor-regions li { display: flex; gap: 8px; align-items: flex-start; }
.decor-comment { height: auto; padding: 8px 10px; resize: vertical; font: inherit; }
.decor-ver { display: flex; flex-direction: column; gap: 2px; align-items: center; width: 64px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s1); color: var(--fg-2); font-size: 11px; cursor: pointer; }
.decor-ver img { width: 58px; height: 58px; object-fit: cover; border-radius: 4px; }
.decor-ver.is-on { border-color: var(--fg); color: var(--fg); }

/* Sketch tool */
.dc-viewport[data-tool="sketch"] { cursor: crosshair; touch-action: none; }
.sketch-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sketch-layer .sk-halo { fill: none; stroke: rgba(255, 255, 255, 0.9); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.sketch-layer .sk-line { fill: none; stroke: #1f6bff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sketch-layer .sk-handle { fill: #fff; stroke: #1f6bff; stroke-width: 2.5; pointer-events: all; touch-action: none; }
.sketch-layer .sk-handle:hover { fill: #1f6bff; stroke: #fff; }
.sketch-layer .sk-line.live { animation: areaPulse 1.6s ease-in-out infinite; }

/* Decor step: library, tools, character sheet */
.decor-thumb { position: relative; display: flex; flex-direction: column; }
.decor-thumb-btn { padding: 0; border: 0; background: none; width: 100%; height: 100%; cursor: pointer; }
.decor-thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.decor-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decor-badge { top: 4px; bottom: auto; }
.decor-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; line-height: 18px; padding: 0; cursor: pointer; opacity: 0; }
.decor-thumb:hover .decor-x, .decor-x:focus-visible { opacity: 1; }
.decor-tools { margin-bottom: 8px; }
.decor-main { flex-direction: column; align-items: center; }
.decor-canvas[data-tool="sketch"] { cursor: crosshair; }
.decor-canvas .sketch-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.decor-canvas .sketch-layer .sk-halo { stroke-width: 7; vector-effect: non-scaling-stroke; }
.decor-canvas .sketch-layer .sk-line { stroke-width: 3.5; vector-effect: non-scaling-stroke; }
.decor-ring.sketched { border-style: dashed; background: rgba(31,107,255,.06); }
.decor-versions { margin-top: 10px; justify-content: center; }
.decor-sheet { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); }
.decor-sheet-img { padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; overflow: hidden; cursor: zoom-in; }
.decor-sheet-img img { display: block; width: 100%; height: auto; }
.decor-refs { display: flex; flex-direction: column; gap: 6px; }
.decor-ref { position: relative; width: 48px; height: 48px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line-2); }
.decor-ref img { width: 100%; height: 100%; object-fit: cover; }
.decor-ref .icon-btn { position: absolute; top: 0; right: 0; width: 16px; height: 16px; font-size: 10px; background: rgba(0,0,0,.7); color: #fff; }
.chip-static { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--fg-2); color: var(--fg); }
.decor-lib-wrap { display: flex; flex-direction: column; gap: 12px; }
.decor-lib { max-height: 60dvh; overflow: auto; }
.lib-mine { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* Decor views and 360 */
.spin-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.spin { width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; cursor: ew-resize; touch-action: none; user-select: none; background: var(--s1); }
.spin-frame, .spin-frame img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.spin-ctrl { justify-content: center; }
.view-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.view-tile { position: relative; padding: 0; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; background: var(--s1); cursor: zoom-in; aspect-ratio: 1; }
.view-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.view-tile span { position: absolute; left: 0; bottom: 0; padding: 1px 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; }

/* Angle picker and fixed views */
.angle-picker { display: flex; flex-direction: column; gap: 12px; }
.angle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.angle-pick { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s1); color: var(--fg); cursor: pointer; font-size: 12px; }
.angle-pick:hover, .angle-pick:focus-visible { border-color: var(--fg); }
.angle-pick img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 4px; }
.view-slot { display: flex; flex-direction: column; gap: 4px; }
.view-tile.empty { display: grid; place-items: center; color: var(--fg-3); font-size: 11px; cursor: default; }
.view-tile.empty span { position: static; background: none; color: inherit; }

.angle-group { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.angle-group:last-child { border-bottom: 0; }
.angle-picker { max-height: 70dvh; overflow: auto; }

.decor-main .decor-versions { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
.decor-main .decor-versions > .row { flex-direction: row; }

/* ---------- Decor step layout (final) ---------- */
.decor-step { max-width: 1240px; padding-bottom: 128px; }
.decor-editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .decor-editor { grid-template-columns: 1fr; } }
.decor-main { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; }
.decor-main .decor-canvas { align-self: center; max-width: 100%; }
.decor-canvas img { max-height: 58dvh; }
.decor-under { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.decor-main .decor-versions { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 8px; overflow-x: auto; margin: 0; justify-content: flex-start; }
.decor-ver { flex: 0 0 auto; }
.decor-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; max-height: calc(100dvh - 140px); overflow-y: auto; padding-right: 2px; }
.dc-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); min-width: 0; }
.dc-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dc-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.dc-card .hint { margin: 0; }
.dc-details { border-top: 1px solid var(--line); padding-top: 10px; }
.dc-details summary { cursor: pointer; font-size: 13px; color: var(--fg-2); }
.dc-details-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.dc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dc-textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; font: inherit; line-height: 1.4; }
.decor-sheet-img { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; overflow: hidden; cursor: zoom-in; }
.angle-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.angle-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.angle-img { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; overflow: hidden; cursor: zoom-in; }
.angle-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.angle-img.empty { display: grid; place-items: center; background: var(--s2, #111); color: var(--fg-3); font-size: 12px; cursor: default; }
.angle-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--fg-2); }
.link-btn.small { font-size: 12px; }
.link-btn:disabled { opacity: .4; cursor: default; }
.decor-badge.ok { background: #fff; color: #000; }
.decor-regions li { align-items: flex-start; }
.decor-regions .dc-textarea { flex: 1; }

/* Sketch bar: free drawing, described only when finished */
.sketch-bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 32px); padding: 8px 8px 8px 14px; border-radius: 999px; background: rgba(10, 10, 10, 0.92); border: 1px solid var(--line-2); box-shadow: var(--pop); }
.sketch-bar-text { font-size: 12px; color: var(--fg-2); max-width: 420px; }
.sketch-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
.sketch-layer .sk-line.draft { stroke: #1f6bff; stroke-dasharray: none; }
.pill-del { color: #ff6b6b; }
@media (max-width: 640px) { .sketch-bar { border-radius: var(--r); bottom: calc(var(--tab-h, 56px) + 8px); } }

/* ---------- Doodle step polish ---------- */
.sketch-bar { flex-wrap: nowrap; gap: 4px; padding: 6px; border-radius: 12px; bottom: 20px; }
.sketch-bar-dot { width: 8px; height: 8px; margin: 0 4px 0 8px; border-radius: 50%; background: #1f6bff; box-shadow: 0 0 0 3px rgba(31, 107, 255, 0.25); flex: none; }
.sketch-bar-text { font-size: 13px; color: var(--fg); white-space: nowrap; max-width: none; padding-right: 6px; }
.sketch-bar-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; flex: none; }
.sk-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--fg-2); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.sk-btn:hover:not(:disabled) { background: var(--s3, #1a1a1a); color: var(--fg); }
.sk-btn:disabled { opacity: 0.35; cursor: default; }
.sk-btn.primary { background: #fff; color: #000; font-weight: 500; padding: 0 14px; }
.sk-btn.primary:hover:not(:disabled) { background: #e6e6e6; color: #000; }
.lib-mine .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lib-item.mine { aspect-ratio: auto; display: flex; flex-direction: column; cursor: pointer; }
.mine-img { display: block; aspect-ratio: 1; background: #fff; }
.mine-img img { width: 100%; height: 100%; object-fit: contain; }
.mine-cap { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-top: 1px solid var(--line); }
.mine-cap .lib-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   Rework: one rhythm for all four steps
   - each step fills the screen; the action bar docks to the bottom
   - Decor is a workspace: piece list | tabs (Edit, Character sheet, Angles)
   ===================================================================== */

/* Steps fill the viewport so the action bar always sits at the bottom. */
.main { height: 100%; }
.stage-view { min-height: 100%; max-width: 1240px; padding: 28px 32px 0; gap: 20px; }
.stage-view > .stage-foot { margin-top: auto; }
.stage-foot {
  position: sticky; bottom: 0; margin-left: -32px; margin-right: -32px; padding: 12px 32px; border-radius: 0;
  border: 0; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.92); box-shadow: none;
}
.stage-head-text { gap: 4px; }
.stage-head h1 { font-size: 26px; }

/* ---------- Decor workspace ---------- */
.decor-step { padding-bottom: 0; }
.ws { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--s1); min-height: 0; overflow: hidden; }
@media (max-width: 900px) { .ws { grid-template-columns: 1fr; } }

.ws-list { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-right: 1px solid var(--line); background: var(--bg); }
@media (max-width: 900px) { .ws-list { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; } }
.ws-list-add { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.ws-list-add .btn { width: 100%; justify-content: center; }
.ws-item { position: relative; border-radius: var(--r); }
.ws-item.is-on { background: var(--s3); }
.ws-item:not(.is-on):hover { background: var(--s2); }
.ws-item-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; border-radius: var(--r); }
.ws-thumb { flex: none; width: 44px; height: 44px; border-radius: var(--r-sm); overflow: hidden; background: var(--s3); }
.ws-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ws-item-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.ws-item-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-item-state { font-size: 12px; color: var(--fg-3); }
.ws-item-state.ok { color: var(--fg-2); }
.ws-item-state.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.ws-item-x { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--fg-3); cursor: pointer; opacity: 0; }
.ws-item:hover .ws-item-x, .ws-item-x:focus-visible { opacity: 1; }
.ws-item-x:hover { background: var(--s4); color: var(--fg); }

.ws-main { display: flex; flex-direction: column; min-width: 0; }
.ws-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.ws-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 0; background: none; color: var(--fg-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.ws-tab:hover { color: var(--fg); }
.ws-tab[aria-selected="true"] { color: var(--fg); }
.ws-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--fg); border-radius: 2px; }
.ws-badge { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--s4); color: var(--fg-2); }
.ws-full { margin-left: auto; }
.ws-main > .alert { margin: 12px 16px 0; }

.ws-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 20px; align-items: start; }
@media (max-width: 1100px) { .ws-split { grid-template-columns: 1fr; } }
.ws-canvas { display: flex; justify-content: center; min-width: 0; }
.ws-canvas .decor-canvas { max-width: 100%; }
.ws-canvas .decor-canvas img { max-height: calc(100dvh - 330px); min-height: 240px; width: auto; }
.ws-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ws-note { padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--fg-3); font-size: 13px; text-align: center; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.seg .chip { height: 32px; border: 0; border-radius: var(--r-sm); justify-content: center; background: transparent; }
.seg .chip[aria-pressed="true"] { background: var(--fg); color: #000; }
.decor-versions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.decor-ver { width: 72px; }
.decor-ver img { width: 64px; height: 64px; }

.ws-sheet-img { display: grid; place-items: center; width: 100%; min-height: 320px; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; cursor: zoom-in; }
.ws-sheet-img img { width: 100%; height: auto; display: block; }
.ws-sheet-img.pending { background: var(--bg); border-style: dashed; cursor: default; padding: 24px; text-align: center; }
.ws-sheet-img.pending p { max-width: 36ch; }

.ws-angles { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.ws-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ws-bar p { max-width: 64ch; font-size: 13px; }
.angle-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .angle-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.angle-card { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.angle-card .angle-img { aspect-ratio: 1; border-radius: var(--r); }
.angle-card figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--fg); }

.ws-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 64px 24px; text-align: center; }
.ws-empty p { max-width: 44ch; }
.ws-start { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 72px 24px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); text-align: center; }
.ws-start h2 { font-size: 20px; }
.ws-start p { max-width: 52ch; }
.ws-start .row { justify-content: center; margin-top: 8px; }

/* ---------- Library tiles: image, then caption (no text over photos) ---------- */
.lib-item { aspect-ratio: auto; display: flex; flex-direction: column; cursor: pointer; }
.lib-item > img { aspect-ratio: 4 / 5; height: auto; object-fit: cover; }
.lib-item .lib-cap { position: static; padding: 8px; background: none; border-top: 1px solid var(--line); gap: 2px; }
.lib-item .lib-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item .lib-style { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-foot { margin-left: 0; margin-right: 0; padding: 14px 0; background: rgba(0, 0, 0, 0.94); }
.ws-form .decor-versions { justify-content: flex-start; }
.ws-tabs { overflow-x: auto; scrollbar-width: none; }
.ws-tab { white-space: nowrap; flex: none; }
@media (max-width: 640px) {
  .ws-full { display: none; }
  .stage-view { padding: 20px 16px 0; }
  .ws-split, .ws-angles { padding: 14px; }
  .ws-list-add { grid-template-columns: auto auto; margin: 0 8px 0 0; align-content: center; }
  .ws-item { flex: none; }
}

.overview.single { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.overview.single .ov-media { aspect-ratio: auto; height: min(calc(100dvh - 400px), 620px); min-height: 280px; }
.overview.single .ov-media img { width: 100%; height: 100%; object-fit: contain; }
/* The progress card fills the media box (its own 16:10 shape is taller than this wide box and clipped the percent). */
.ov-media > .prog-card { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; border: 0; }
.decor-lib.lib-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-height: 64dvh; }
.decor-lib .lib-item > img { aspect-ratio: 4 / 3; }
.lib-item > img { aspect-ratio: 4 / 3; }

/* Place decor from a drawing */
.sk-check { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 13px; color: var(--fg-2); white-space: nowrap; cursor: pointer; }

.place-modes { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-2); border-radius: 10px; }
.place-modes .sk-btn { height: 28px; padding: 0 10px; }
.place-modes .sk-btn[aria-pressed="true"] { background: var(--fg); color: #000; }
.pill-place { color: var(--fg); font-weight: 500; }

/* Decor areas: one card per marked area */
.area-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.area-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.area-card.is-open { border-color: #1f6bff; }
.area-head { display: flex; align-items: center; gap: 8px; }
.area-head .decor-ring-n.static { margin: 0; }
.area-title { font-size: 13px; font-weight: 600; }
.area-kind { font-size: 11px; color: var(--fg-3); padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 999px; }
.area-x { margin-left: auto; border: 0; background: none; color: var(--fg-3); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.area-x:hover:not(:disabled) { color: var(--fg); background: var(--s3); }
.area-card .dc-textarea { width: 100%; min-height: 56px; }
.area-refs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.area-ref { position: relative; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); }
.area-ref img { width: 100%; height: 100%; object-fit: cover; }
.area-ref button { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 10px; line-height: 16px; cursor: pointer; }
.area-ref-add { display: inline-flex; align-items: center; gap: 10px; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-pair .btn { width: 100%; justify-content: center; }
.ws-form .seg { width: 100%; }


/* Shape cleanup: the stroke as drawn fades out over the clean shape */
.sketch-layer .sk-line.sk-morph { stroke: #ffffff; opacity: 0.9; animation: skMorph 150ms ease-out forwards; }
@keyframes skMorph { to { opacity: 0; } }

/* Prompt suggestions: ghost text typed over an empty prompt box */
.ghost-wrap { position: relative; display: flex; flex-direction: column; gap: 4px; }
.ghost { position: absolute; top: 0; left: 0; right: 0; padding: 9px 11px; font: inherit; font-size: inherit; line-height: 1.4; color: var(--fg-3); white-space: pre-wrap; overflow: hidden; pointer-events: none; }
.ghost::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: var(--fg-3); }
.ghost-hint { font-size: 11px; color: var(--fg-3); }

/* Isolated decor shown on a transparency checkerboard */
.checker { background-color: #fff; background-image: linear-gradient(45deg, #e6e6e6 25%, transparent 25%), linear-gradient(-45deg, #e6e6e6 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e6e6e6 75%), linear-gradient(-45deg, transparent 75%, #e6e6e6 75%); background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; }

/* ---- Final placement editor (ADR-5) ---- */
.ed-photo-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); height: 44px; }
.ed-status { margin-left: auto; }
.ed-host { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ed-wrap { display: flex; flex-direction: column; height: 100%; }
.ed-toolbar-wrap { display: flex; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--line); height: 40px; gap: 2px; }
.ed-toolbar { display: flex; align-items: center; gap: 2px; width: 100%; }
.ed-body { flex: 1; display: flex; overflow: hidden; }
.ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; outline: none; background: var(--s2); }
.ed-panel { width: 200px; border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; background: var(--s1); }
.ed-panel-head { padding: 10px 12px 6px; border-bottom: 1px solid var(--line); }
.ed-layer-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.ed-layer { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.ed-layer:hover { background: var(--s3); }
.ed-layer.selected { background: var(--s4); }
.ed-layer-thumb { width: 40px; height: 40px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--s3); flex-shrink: 0; }
.ed-layer-thumb canvas { display: block; }
.ed-layer-thumb-ph { width: 100%; height: 100%; background: var(--s4); }
.ed-layer-info { flex: 1; min-width: 0; }
.ed-layer-label { font-size: 12px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ed-layer-vis { margin-left: auto; }
.ed-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; background: none; color: var(--fg-2); border-radius: var(--r-sm); cursor: pointer; }
.ed-btn:hover:not(:disabled) { background: var(--s4); color: var(--fg); }
.ed-btn:disabled { opacity: 0.3; cursor: default; }
.ed-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 2px; align-self: center; }
.ed-sep.ed-push { flex: 1; background: none; width: auto; }
.ed-stage { flex: 1; position: relative; display: flex; min-width: 0; min-height: 0; overflow: hidden; }
.ed-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ed-tools { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--s4); flex-wrap: wrap; }
.ed-tools > .ed-btn { width: auto; padding: 0 10px; font-size: 13px; }
.ed-btn.active, .ed-sel-mode.active { background: var(--fg); color: var(--s1, #000); }
.ed-sel-panel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); }
.ed-sel-modes, .ed-sel-bar, .ed-sel-actions { display: flex; align-items: center; gap: 6px; }
.ed-sel-mode, .ed-sel-cancel, .ed-sel-action { height: 28px; padding: 0 10px; border: 1px solid var(--s4); background: none; color: var(--fg); border-radius: var(--r-sm); cursor: pointer; font: inherit; }
.ed-sel-action:disabled, .ed-sel-cancel:disabled { opacity: 0.3; cursor: default; }
/* --- Submit panel + version strip (ADR-5 Phase 3) --- */
.ed-submit { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--s1); }
.ed-btn-primary { width: auto; padding: 0 18px; font-size: 13px; font-weight: 600; background: var(--fg); color: var(--bg); border-radius: var(--r-sm); height: 32px; }
.ed-btn-primary:hover:not(:disabled) { background: var(--fg-2); color: var(--bg); }
.ed-submit-status { font-size: 12px; color: var(--fg-3); min-height: 16px; }
.ed-ver-strip { display: flex; flex-direction: column; gap: 8px; }
.ed-ver-card { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ed-ver-thumb { width: 60px; height: 45px; flex-shrink: 0; background: var(--s3); border-radius: var(--r-sm); overflow: hidden; }
.ed-ver-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-ver-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ed-ver-btns .ed-btn { width: auto; padding: 0 8px; font-size: 12px; border: 1px solid var(--line-3); }
.ed-ver-btns a.ed-btn { text-decoration: none; }
.ed-versions { display: flex; flex-direction: column; }
/* ADR-7 Phase 1: detected-object chips */
.ed-detect-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; min-height: 0; }
.ed-detect-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--s4); background: none; color: var(--fg-2); border-radius: 11px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.ed-detect-chip:hover { background: var(--s4); color: var(--fg); }
.ed-detect-chip.active { background: var(--fg); color: var(--s1, #000); }

/* front_view + whole edit */
.ws-tabs .ws-tab[aria-selected="true"][data-tab="front_view"] { font-style: italic; }
.whole-mode-area { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); margin-top: 8px; }

/* decor 4-up variant grid (ADR-10 Phase 5) */
.dc-variants { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* pill angle strip */
.pill-angles { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; padding: 8px 8px 0; }
.pill-angles[hidden] { display: none; }
.pill-angle { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--s2); color: var(--fg-2); font: inherit; font-size: 11px; cursor: pointer; }
.pill-angle img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 5px; background: #fff; }
.pill-angle:hover { background: var(--s4); }
.pill-angle.active { border-color: #fff; color: #fff; font-weight: 600; box-shadow: 0 0 0 1.5px #fff; }

/* placing bar sits above the sketch bar when both are open */
.sketch-bar.place-bar.stacked { bottom: 72px; }

/* measured size label stays on one line */
.place-nudge-label { white-space: nowrap; min-width: 92px; font-size: 13px; color: var(--fg-2); }
.place-bar input[type="range"] { width: 96px; }

/* 4 options fill the image area */
.dc-stage4 { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.dc-stage4 .prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* placing bar never wider than the stage; the long name truncates */
.sketch-bar.place-bar { max-width: calc(100% - 32px); }
.sketch-bar.place-bar .sketch-bar-text { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Magic eraser (cut-out touch-up) ---------- */
.ws-cutouts { display: grid; gap: 6px; }
.ws-cutout-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-cutout { position: relative; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line, #333); border-radius: var(--r-sm, 6px); overflow: hidden; cursor: pointer; }
.ws-cutout:hover, .ws-cutout:focus-visible { border-color: var(--fg); }
.ws-cutout img { width: 100%; height: 100%; object-fit: contain; }
.ws-cutout-tag { position: absolute; left: 3px; bottom: 3px; font-size: 10px; line-height: 1; padding: 2px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.75); color: #fff; }
.er-modal { width: min(1100px, calc(100vw - 32px)); }
.er { display: grid; gap: 10px; }
.er-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.er-spacer { flex: 1; }
.er-slider { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.er-slider input { width: 110px; }
.er-stage { position: relative; height: min(68vh, 720px); display: grid; place-items: center; border-radius: var(--r-sm, 6px); overflow: hidden; touch-action: none; }
.er-canvas { display: block; cursor: crosshair; image-rendering: auto; }
.er-cursor { position: absolute; pointer-events: none; border: 1.5px solid #000; border-radius: 50%; box-shadow: 0 0 0 1px #fff; }
.er-box { position: absolute; pointer-events: none; border: 1.5px dashed #000; background: rgba(255, 255, 255, 0.25); box-shadow: 0 0 0 1px #fff; }
.er-hint { margin: 0; font-size: 13px; }
@media (max-width: 640px) { .er-stage { height: 56vh; } .er-slider input { width: 80px; } }
.er-tools { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--s2, #111); }
.er-tools .sk-btn[aria-pressed="true"] { background: var(--fg); color: #000; }
/* The sheet preview's progress card fills the box (all its children are absolutely positioned). */
.ws-sheet-img.pending.is-progress { padding: 0; border: 0; background: transparent; place-items: stretch; }
.ws-sheet-img.pending.is-progress > .prog-card { width: 100%; height: 100%; min-height: 320px; aspect-ratio: auto; }
/* Failed pin card: closable, and opens upward low on the image so the bottom bars never cover it. */
.pin-bubble { z-index: 30; }
.pin-bubble.up { top: auto; bottom: 26px; }
.pin-bubble-x { position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--fg-2); font: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.pin-bubble-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--fg); }
.pin-bubble .pin-err { padding-right: 18px; }

/* Venue from above (ADR-12): the plan with the piece's real footprint. */
.plan-section { margin: 0 20px 20px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.plan-head h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.plan-head p { margin: 0; }
.plan-form { display: grid; gap: 10px; max-width: 420px; }
.plan-stage { position: relative; width: 100%; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); touch-action: none; user-select: none; }
.plan-stage > img { display: block; width: 100%; height: auto; pointer-events: none; }
.plan-stage.is-progress { border: 0; }
.plan-stage.is-progress > .prog-card { width: 100%; min-height: 320px; aspect-ratio: auto; }
.plan-foot { position: absolute; box-sizing: border-box; border: 2px solid #fff; outline: 1px solid rgba(0, 0, 0, 0.6); background: rgba(255, 255, 255, 0.12); cursor: move; }
.plan-foot-img { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.plan-foot-img img { width: 100%; height: 100%; object-fit: fill; opacity: 0.85; display: block; }
.plan-foot-size { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); white-space: nowrap; font-size: 11px; font-variant-numeric: tabular-nums; color: #fff; background: rgba(0, 0, 0, 0.75); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
.plan-foot-turn { position: absolute; left: 50%; top: -22px; width: 14px; height: 14px; margin-left: -7px; padding: 0; border: 2px solid #000; border-radius: 50%; background: #fff; cursor: grab; }
.plan-foot-turn::after { content: ""; position: absolute; left: 50%; top: 12px; width: 1px; height: 8px; background: #fff; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Whole-scene placement picker (ADR-13): four full venue options. */
.scene-pick-modal { width: min(1100px, 96vw); }
.scene-pick { display: grid; gap: 14px; }
.scene-pick .prog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scene-pick .btn-pair { justify-content: flex-start; }
.scene-pick-step .prog-card { width: 100%; min-height: 260px; aspect-ratio: auto; }

/* Keep / remove marking on the front view (ADR-14). */
.mk-stage { display: grid; place-items: center; }
.mk-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.mk-wrap > img { display: block; max-width: 100%; max-height: 70vh; height: auto; user-select: none; -webkit-user-drag: none; }
.mk-canvas { position: absolute; left: 0; top: 0; cursor: crosshair; touch-action: none; }
.chip.mk-keep::before, .chip.mk-remove::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.chip.mk-keep::before { background: #18d018; }
.chip.mk-remove::before { background: #ff1a1a; }

/* ADR-20: rough 3D CSS (model-*, v3d-*, views-*, render-*) removed. */
.p-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .p-grid.two { grid-template-columns: 1fr; }
}

/* Sign-in (ADR-16), brand look from design.md: violet page, green card, gold text, orange action */
body.signed-out { --b-green: #1E4636; --b-violet: #3A2563; --b-gold: #E2B451; --b-orange: #F08A3C; background: var(--b-violet); color: var(--b-gold); }
body.signed-out .top, body.signed-out .rail, body.signed-out .panel { display: none !important; }
body.signed-out .shell { display: block; }
body.signed-out .main { min-height: 100dvh; padding: 0; background: radial-gradient(120% 80% at 50% 0%, rgba(30, 70, 54, 0.55), transparent 60%), var(--b-violet); }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; font-family: "Manrope", system-ui, sans-serif; }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 16px; padding: 32px 36px 28px; background: var(--b-green); border: 1px solid rgba(226, 180, 81, 0.25); border-radius: 0; color: var(--b-gold); animation: authIn 0.25s ease-out; }
@keyframes authIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid rgba(226, 180, 81, 0.18); }
.auth-brand img { width: 42px; height: 42px; display: block; }
.auth-word { display: grid; line-height: 1.1; }
.auth-name { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 17px; letter-spacing: 0.11em; }
.auth-sub { font-size: 8px; font-weight: 700; letter-spacing: 0.2em; color: rgba(226, 180, 81, 0.72); }
.auth-eyebrow { margin: 4px 0 -8px; font-size: 10px; font-weight: 800; letter-spacing: 0.17em; text-transform: uppercase; color: var(--b-orange); }
.auth-card h1 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 34px; line-height: 1.05; letter-spacing: -0.01em; color: var(--b-gold); }
.auth-card .muted { color: rgba(226, 180, 81, 0.72); margin: -6px 0 0; font-size: 13px; line-height: 1.5; }
.auth-card .muted strong { color: var(--b-gold); }
.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; color: rgba(226, 180, 81, 0.82); }
.auth-field input { height: 44px; padding: 0 14px; border: 1px solid rgba(226, 180, 81, 0.35); border-radius: 10px; background: var(--b-violet); color: var(--b-gold); font: inherit; font-size: 14px; font-weight: 400; letter-spacing: 0; }
.auth-field input:focus { outline: 2px solid var(--b-gold); outline-offset: 3px; border-color: rgba(226, 180, 81, 0.6); }
.auth .btn { border-radius: 0; font-family: "Manrope", system-ui, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: 0.03em; height: 46px; width: 100%; justify-content: center; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s; }
.auth .auth-submit { background: var(--b-orange); border: 1px solid var(--b-orange); color: var(--b-green); }
.auth .auth-submit:hover:not(:disabled) { background: var(--b-orange); border-color: var(--b-orange); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(240, 138, 60, 0.4); }
.auth .auth-submit:disabled { opacity: 0.45; }
.auth .auth-google { background: transparent; border: 1px solid rgba(226, 180, 81, 0.35); color: var(--b-gold); }
.auth .auth-google:hover { border-color: var(--b-orange); color: var(--b-orange); background: transparent; }
.auth .btn:focus-visible, .auth-link:focus-visible { outline: 2px solid var(--b-gold); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .auth .btn { transition: none; } .auth .auth-submit:hover:not(:disabled) { transform: none; } }
.auth-msg { min-height: 1.2em; margin: 0; font-size: 13px; color: #ff6b6b; }
.auth-msg:empty { min-height: 0; }
.auth-or { display: flex; align-items: center; gap: 12px; color: rgba(226, 180, 81, 0.58); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: rgba(226, 180, 81, 0.2); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.auth-link { background: none; border: 0; padding: 0; color: rgba(226, 180, 81, 0.82); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth-link:hover { color: var(--b-orange); }
.expiry-notice { margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--line-3); border-left: 3px solid var(--fg); border-radius: var(--r-sm); color: var(--fg-2); font-size: 14px; line-height: 1.5; max-width: 640px; }
.expiry-notice strong { color: var(--fg); font-weight: 600; }
body.signed-out .top-actions > :not(#account) { display: none; }

/* Credits (ADR-17) */
.credits-pill { display: inline-flex; align-items: baseline; gap: 5px; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--s1); color: var(--fg); font-size: 13px; cursor: pointer; transition: border-color var(--t), background var(--t); align-self: center; line-height: 26px; }
.credits-pill:hover { border-color: var(--line-3); background: var(--s2); }
.credits-pill .credits-val { font-weight: 600; }
.credits-pill .credits-unit { color: var(--fg-2); }
.credits-pill.low { border-color: var(--fg-2); }
.cr-modal { width: min(640px, calc(100vw - 32px)); }
.cr { display: grid; gap: 14px; }
.cr-balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cr-num { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.cr-badge { font-size: 12px; padding: 3px 8px; border: 1px solid var(--line-3); border-radius: 999px; color: var(--fg-2); }
.cr-low { margin: 0; padding: 10px 12px; border: 1px solid var(--line-3); border-left: 3px solid var(--fg); border-radius: var(--r-sm); font-size: 13px; }
.cr-h { font-size: 13px; font-weight: 600; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.cr-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.cr-pack { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r); }
.cr-pack p { margin: 0; }
.cr-pack-name { font-size: 13px; color: var(--fg-2); }
.cr-pack-credits { font-size: 18px; font-weight: 600; }
.cr-pack-price { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.cr-buy { margin-top: 8px; width: 100%; justify-content: center; }
.cr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cr-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.cr-table td:last-child { text-align: right; color: var(--fg-2); white-space: nowrap; padding-left: 12px; }
.cr-list { list-style: none; margin: 0; padding: 0; display: grid; font-size: 13px; }
.cr-list li { display: grid; grid-template-columns: 1fr auto 72px; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.cr-list li > :last-child { text-align: right; }
.cr-delta { font-weight: 600; }
.cr-delta.down { color: var(--fg-2); }
.cr-delta.up { color: var(--fg); }
.cr-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Camera views on the venue top view (ADR-18) */
.cam-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .cam-split { grid-template-columns: 1fr; } }
.cam-left { display: grid; gap: 8px; min-width: 0; }
.cam-stage { cursor: crosshair; }
.cam-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.cam-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cam-svg path { fill: rgba(255, 255, 255, 0.14); stroke: rgba(255, 255, 255, 0.85); stroke-linejoin: round; }
.cam-svg .cam-dot { fill: #fff; stroke: #000; stroke-width: 2; cursor: pointer; }
.cam-svg .cam-saved { cursor: pointer; }
.cam-svg .cam-saved path { fill: rgba(255, 255, 255, 0.06); stroke: rgba(255, 255, 255, 0.45); }
.cam-svg .cam-saved.sel path { stroke: #fff; }
.cam-svg .cam-draft path { fill: rgba(255, 255, 255, 0.22); stroke: #fff; }
.cam-svg .cam-draft .cam-dot { cursor: move; }
.cam-svg .cam-handle { fill: #000; stroke: #fff; stroke-width: 3; cursor: grab; }
.cam-svg .cam-piece { fill: rgba(0, 0, 0, 0.7); stroke: #fff; stroke-width: 2; pointer-events: none; }
.cam-pane .cam-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; width: 100%; }
.cam-pane .seg-btn[aria-checked="true"] { background: var(--s4); color: var(--fg); }
.cam-draft-panel { display: grid; gap: 12px; }
.cam-draft-panel input[type="text"] { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s1); color: var(--fg); font: inherit; }
.cam-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 16px; }
.cam-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r); }
.cam-card.sel { border-color: var(--line-3); }
.cam-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.cam-name { margin: 0 0 2px; font-weight: 600; }
.cam-kept { display: grid; gap: 6px; }
.cam-kept-img { padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none; cursor: zoom-in; overflow: hidden; max-width: 560px; }
.cam-kept-img img { display: block; width: 100%; height: auto; }

/* Onboarding tour (ADR-21): a ring around the thing being explained and a note beside it.
   pointer-events: none on the ring, so the page under it keeps working. */
.tour-ring { position: fixed; z-index: 90; pointer-events: none; border-radius: var(--r); box-shadow: 0 0 0 2px var(--fg), 0 0 0 9999px rgba(0, 0, 0, 0.45); transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease; }
.tour-note { position: fixed; z-index: 91; width: min(340px, calc(100vw - 16px)); padding: 16px; border-radius: var(--r); background: var(--s1); border: 1px solid var(--line-3); box-shadow: var(--pop); color: var(--fg); display: grid; gap: 8px; animation: popIn 160ms var(--ease); }
.tour-note.sheet { width: auto; }
.tour-note.no-motion { animation: none; }
.tour-count { margin: 0; font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.tour-title { margin: 0; font-size: 16px; font-weight: 600; }
.tour-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-2); }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tour-gap { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } .tour-note { animation: none; } }
body.signed-out .tour-ring, body.signed-out .tour-note { display: none; }

/* ---------------- ADR-22: in-app confirm, camera direction, compact render picks ---------------- */
.confirm-box { width: min(440px, 100%); }
.confirm-body { display: grid; gap: 14px; }
.confirm-text { margin: 0; color: var(--fg-2); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.confirm-body .btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cam-turn { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.cam-turn input[type="range"] { width: 100%; accent-color: var(--fg); }
.cam-svg .cam-saved .cam-handle { opacity: 0.55; }
.cam-svg .cam-saved.sel .cam-handle, .cam-svg .cam-saved:hover .cam-handle { opacity: 1; }
.cam-svg .cam-saved .cam-dot { cursor: move; }
.cam-card .prog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1100px; }
.cam-card .prog-card { aspect-ratio: 3 / 2; border-radius: var(--r); }
@media (max-width: 1100px) { .cam-card .prog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cam-card-head .btn-pair { display: flex; flex-wrap: wrap; gap: 8px; }
.cam-card-head .btn-pair .btn { width: auto; }
.cam-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.cam-actions .btn { width: auto; }
.cam-actions-note { margin-right: auto; }
.cam-card .prog-grid { max-width: none; }
.cam-card > div:has(> .prog-grid) { display: grid; gap: 12px; }

/* =====================================================================================
   design.md theme layer (A Lovers Card): later rules win over the base styles above.
   Green for the header band, primary buttons and headings; gold only for the logo,
   selection outlines and focus; paper and ivory everywhere else. No black surfaces.
   ===================================================================================== */

body { background: var(--paper); color: var(--ink); font-family: var(--sans); }
::selection { background: rgba(201, 162, 76, 0.28); }
:focus-visible { outline: 2px solid var(--gold-line); outline-offset: 2px; }
h1, h2, h3 { color: var(--green); }
a { color: var(--green); }
.muted { color: var(--muted); }
.hint { color: var(--faint); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }

/* Buttons */
.btn { height: 40px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font-weight: 600; }
.btn:hover:not(:disabled) { background: var(--card); border-color: var(--green); }
.btn:disabled { opacity: 0.45; }
.btn-sm { height: 34px; }
.btn-xs { height: 28px; }
.btn-quiet { background: var(--card); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled), .btn-ghost[aria-pressed="true"] { background: var(--sage); border-color: transparent; color: var(--ink); }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: var(--green-deep); border-color: var(--green-deep); color: var(--paper); }
.btn-primary .spinner { background: var(--paper); }
.stage-foot .btn-primary:not(.btn-sm) { height: 52px; padding: 0 22px; font-size: 15px; }
.btn.is-running .demo-dot { background: var(--gold); }
.icon-btn { color: var(--muted); }
.icon-btn:hover { background: var(--sage); color: var(--ink); }
.link-btn { color: var(--green); text-decoration-color: var(--green); text-underline-offset: 3px; }

/* Inputs, chips, segmented controls, sliders */
.select, .input { height: 44px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
textarea.input { height: auto; }
.input-sm { height: 36px; }
.select:focus-visible, .input:focus-visible, .input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(201, 162, 76, 0.35); }
.input::placeholder { color: var(--faint); }
input[type="range"] { accent-color: var(--green); }
.chip { border-color: var(--line-strong); color: var(--muted); background: var(--card); }
.chip:hover { color: var(--ink); border-color: var(--green); background: var(--sage); }
.chip[aria-pressed="true"] { color: var(--paper); background: var(--green); border-color: var(--green); }
.chip.mk-keep::before { background: var(--mark-keep); }
.chip.mk-remove::before { background: var(--mark-remove); }
.seg { background: var(--card); border: 1px solid var(--line-strong); padding: 3px; }
.seg-btn { color: var(--muted); }
.seg-btn[aria-selected="true"], .seg-btn[aria-checked="true"], .seg .chip[aria-pressed="true"] { background: var(--green); color: var(--paper); }
.cam-pane .seg-btn[aria-checked="true"] { background: var(--green); color: var(--paper); }
.alert { border-color: rgba(180, 71, 63, 0.35); background: rgba(180, 71, 63, 0.06); color: var(--ink); }
.notice, .ws-note { border-color: var(--line-strong); color: var(--muted); background: var(--card); }
.skeleton { background: linear-gradient(90deg, var(--ivory) 25%, #EFE6D2 40%, var(--ivory) 60%) 0 0 / 400% 100%; }

/* Cards and images */
.card, .slot, .callout, .ws { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.decor-canvas, .ws-sheet-img, .plan-stage { background: var(--ivory); border-color: var(--line); border-radius: 12px; }
.checker { background-color: #F3ECDC; background-image: linear-gradient(45deg, #EDE4D0 25%, transparent 25%), linear-gradient(-45deg, #EDE4D0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #EDE4D0 75%), linear-gradient(-45deg, transparent 75%, #EDE4D0 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }

/* Header band: green, breadcrumb left, gold logo centred, actions right */
.top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  height: var(--top-h); padding: 0 16px 0 24px; background: var(--green); border-bottom: 0; color: var(--champagne);
}
.brand { font-size: 13px; color: var(--champagne); }
.brand .mark, .brand-name, .brand-name + .brand-slash { display: none; }
.brand-sub { color: rgba(239, 226, 188, 0.75); }
.brand-slash { color: rgba(239, 226, 188, 0.4); font-size: 15px; }
.project-name { color: var(--champagne); font-weight: 600; }
.logo { display: inline-flex; flex-direction: column; gap: 5px; transform: rotate(-4deg); justify-self: center; text-decoration: none; }
.logo .lt { font: 500 19px/1 var(--display); letter-spacing: 0.2em; color: var(--gold); padding-left: 0.2em; white-space: nowrap; }
.logo .lu { height: 1px; background: var(--gold); margin: 0 -12%; }
.top-actions { justify-self: end; }
.top .btn, .top .cost-pill, .top .credits-pill {
  height: 32px; border-radius: 8px; background: transparent; border: 1px solid rgba(239, 226, 188, 0.4); color: var(--champagne); font-size: 13px;
}
.top .btn:hover:not(:disabled), .top .cost-pill:hover, .top .credits-pill:hover, .top .cost-pill[aria-expanded="true"] { background: rgba(239, 226, 188, 0.1); border-color: var(--champagne); color: var(--paper); }
.top .btn-ghost { border-color: transparent; }
.top #new-project { background: var(--paper); border-color: var(--paper); color: var(--green); }
.top #new-project:hover:not(:disabled) { background: var(--champagne); border-color: var(--champagne); color: var(--green); }
.top .credits-pill .credits-unit { color: rgba(239, 226, 188, 0.7); }
.top .credits-pill.low { border-color: var(--warn); }
.demo-dot, .cost-dot { background: var(--champagne); }
.cost-pop { top: calc(var(--top-h) + 6px); background: var(--card); }
.s0 { background: var(--green); }
.s1 { background: var(--gold-line); }
.s2 { background: var(--sage); }

/* Step rail */
.rail { background: var(--card); border-right: 1px solid var(--line); padding: 16px 10px; }
.stages { gap: 12px; }
.stage-btn { color: var(--ink); padding: 8px 10px; border-radius: 8px; }
.stage-btn:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.stage-btn.current { background: var(--champagne); color: var(--green); }
.stage-num { width: 24px; height: 24px; border: 1px solid var(--line-strong); color: var(--muted); font-weight: 600; }
.stage-btn.done .stage-num { background: var(--green); border-color: var(--green); color: #fff; }
.stage-btn.current .stage-num { background: var(--green); border-color: var(--green); color: var(--paper); }
.stage-title { font-size: 14px; font-weight: 600; }
.stage-sub { color: var(--muted); }
.rail-foot { border-top-color: var(--line); }
.panel { background: var(--card); border-left-color: var(--line); }

/* Stage heading and step bar */
.stage-view { max-width: 1240px; padding: 32px 32px 112px; gap: 24px; }
.stage-head h1, .stage-head-text h1 { font: 500 44px/1.05 var(--display); color: var(--green); letter-spacing: 0; text-wrap: balance; }
.lead { font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 66ch; }
.stage-foot { background: rgba(251, 248, 241, 0.94); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; padding: 12px 12px 12px 20px; }
.foot-text { font-size: 14px; color: var(--muted); }
.foot-text strong { color: var(--ink); font-weight: 600; }
.design-foot { background: var(--card); border-top-color: var(--line); }

/* Tabs */
.ws-tabs { border-bottom-color: var(--line); }
.ws-tab { font-size: 14px; color: var(--muted); }
.ws-tab:hover { color: var(--ink); }
.ws-tab[aria-selected="true"] { color: var(--green); }
.ws-tab[aria-selected="true"]::after { background: var(--gold-line); }

/* Selection: a 2px gold outline, never a fill */
.prog-card.is-selected { box-shadow: inset 0 0 0 2px var(--gold-line); }
.cam-card.sel { border-color: var(--gold-line); }

/* Progress cards: an ivory well with a slow shimmer */
.prog-card { border-radius: 12px; background: linear-gradient(110deg, var(--ivory) 30%, #EFE6D2 45%, var(--ivory) 60%) 0 0 / 300% 100%; animation: shimmer 2.4s ease-in-out infinite; border: 1px solid var(--line); }
.prog-card.is-done, .prog-card.is-failed { background: var(--ivory); animation: none; }
.prog-card-ico { color: var(--muted); }
.prog-card-pct { color: var(--muted); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.prog-card-lbl { color: var(--ink); }
.prog-card.is-done .prog-card-lbl, .prog-card.is-done .prog-card-pct, .prog-card.is-done .prog-card-ico { color: #fff; text-shadow: 0 1px 3px rgba(27, 46, 37, 0.7); }

/* Modals and toasts */
.modal { background: rgba(27, 46, 37, 0.55); }
.modal-box { background: var(--card); border-radius: 16px; padding: 24px; box-shadow: none; border: 1px solid var(--line); }
.modal-head h2 { font: 600 24px/1.1 var(--display); color: var(--green); }
.toast { background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.12); color: var(--ink); }
.toast-text span { color: var(--muted); }
.toast-error { border-color: rgba(180, 71, 63, 0.45); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.12); }

/* Doodle canvas: comment composer, tools, sketch bar */
.pill, .pin-tip { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(27, 46, 37, 0.14); }
.pill-input::placeholder, .pill-hint, .pill-label { color: var(--faint); }
.pill-send { background: var(--green); color: var(--paper); }
.pill-send:hover { background: var(--green-deep); }
.pill-extra { border-top-color: var(--line); }
.pill-upload:hover:not(:disabled) { background: var(--sage); }
.pill-angle.active { border-color: var(--gold-line); color: var(--green); box-shadow: inset 0 0 0 2px var(--gold-line); }
.pill-del { color: var(--bad); }
.toolbar { background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.12); }
.tool { color: var(--muted); }
.tool:hover:not(:disabled) { background: var(--sage); color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--green); color: var(--paper); }
.sketch-bar, .place-bar { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.12); }
.sk-btn { color: var(--muted); background: transparent; }
.sk-btn:hover:not(:disabled) { background: var(--sage); color: var(--ink); }
.sk-btn.primary, .place-modes .sk-btn[aria-pressed="true"], .er-tools .sk-btn[aria-pressed="true"] { background: var(--green); color: var(--paper); }
.sk-btn.primary:hover:not(:disabled) { background: var(--green-deep); color: var(--paper); }
.er-tools { background: var(--ivory); }
.dc-hint { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.ed-btn.active, .ed-sel-mode.active, .ed-detect-chip.active { background: var(--green); color: var(--paper); }
.ed-btn-primary { background: var(--green); color: var(--paper); }
.angle-img.empty { background: var(--ivory); color: var(--faint); }

/* Presentation */
.present { background: var(--paper); color: var(--ink); }

/* Tour: a green bubble with paper text and a gold kicker */
.tour-ring { box-shadow: 0 0 0 2px var(--gold-line), 0 0 0 9999px rgba(27, 46, 37, 0.35); border-radius: 12px; }
.tour-note { background: var(--green); color: var(--paper); border: 0; border-radius: 12px; box-shadow: 0 8px 24px rgba(27, 46, 37, 0.25); }
.tour-count { color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.tour-title { color: var(--paper); font: 600 22px/1.15 var(--display); }
.tour-text { color: rgba(251, 248, 241, 0.86); }
.tour-note .btn { background: transparent; color: var(--champagne); border-color: rgba(239, 226, 188, 0.4); }
.tour-note .btn:hover:not(:disabled) { background: rgba(239, 226, 188, 0.12); border-color: var(--champagne); color: var(--paper); }
.tour-note .btn-primary { background: var(--paper); color: var(--green); border-color: var(--paper); }
.tour-note .btn-primary:hover:not(:disabled) { background: var(--champagne); color: var(--green); }

/* Camera views on the top view */
.cam-svg .cam-saved.sel path { stroke: var(--gold); }
.cam-svg .cam-handle { fill: var(--green); stroke: #fff; }

/* Booting: only the green band and logo until sign-in is decided (no flash of the empty studio) */
body.booting .top-actions, body.booting .brand, body.booting .rail { visibility: hidden; }
body.booting .shell { display: block; }
.boot { padding: 140px 16px; color: var(--muted); }
.boot-sk { width: 220px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; animation: none; }
.boot-sk::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--green); animation: bootSlide 1.4s var(--ease) infinite; }
@keyframes bootSlide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .boot-sk::after { animation: none; width: 100%; opacity: 0.4; } }

/* Sign in: paper page under the green band, a white card, green primary */
body.signed-out { background: var(--paper); color: var(--ink); }
body.signed-out .top { display: grid !important; }
body.signed-out .top .brand, body.signed-out .top .top-actions { visibility: hidden; }
body.signed-out .main { min-height: calc(100dvh - var(--top-h)); background: var(--paper); }
.auth { min-height: calc(100dvh - var(--top-h)); }
.auth-card { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.auth-brand { border-bottom-color: var(--line); }
.auth-brand img { display: none; }
.auth-name { color: var(--gold-line); font-family: var(--display); font-weight: 500; letter-spacing: 0.2em; }
.auth-sub { color: var(--muted); }
.auth-eyebrow { color: var(--muted); font-weight: 600; letter-spacing: 0.18em; }
.auth-card h1 { color: var(--green); font: 500 36px/1.05 var(--display); }
.auth-card .muted { color: var(--muted); }
.auth-card .muted strong { color: var(--ink); }
.auth-field { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.auth-field input { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; }
.auth-field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(201, 162, 76, 0.35); }
.auth .btn { border-radius: 8px; font-weight: 600; letter-spacing: 0; height: 52px; font-size: 15px; }
.auth .auth-submit { background: var(--green); border-color: var(--green); color: var(--paper); }
.auth .auth-submit:hover:not(:disabled) { background: var(--green-deep); border-color: var(--green-deep); transform: none; box-shadow: none; }
.auth .auth-google { background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
.auth .auth-google:hover { border-color: var(--green); color: var(--ink); background: var(--card); }
.auth .btn:focus-visible, .auth-link:focus-visible { outline: 2px solid var(--gold-line); }
.auth-link { color: var(--green); }
.auth-msg { color: var(--bad); }

/* Phone: the rail becomes a strip at the bottom, on paper */
@media (max-width: 860px) {
  .top { grid-template-columns: auto 1fr; padding: 0 10px 0 14px; }
  .top .brand { display: none; }
  .logo { justify-self: start; }
  .logo .lt { font-size: 15px; }
  .rail { background: rgba(255, 255, 255, 0.96); border-top-color: var(--line); }
  .stage-btn.current { background: var(--champagne); }
  .stage-foot { background: rgba(251, 248, 241, 0.96); }
  .stage-head h1, .stage-head-text h1 { font-size: 34px; }
  body.sheet-open .panel { box-shadow: 0 -12px 40px rgba(27, 46, 37, 0.18); }
}

/* Photo slots: ivory wells, dashed when empty, green direction icon */
.slot-empty { background: var(--ivory); border-color: var(--line-strong); color: var(--ink); }
.slot.drop-over .slot-empty { border-color: var(--green); background: var(--champagne); }
.compass-ring { stroke: var(--green); }
.compass-ray { stroke: var(--green); }
.compass-me { fill: var(--green); }
.slot-actions .btn { color: var(--muted); }

/* Camera views page wrapper (its old styles went with the 3D screens): same frame as the other steps */
.stage-pane { max-width: 1240px; margin: 0 auto; padding: 32px 32px 112px; display: flex; flex-direction: column; gap: 24px; }
.stage-pane > .stage-head { margin-bottom: 0; }
.cam-left > .small.muted { margin-top: 4px; }
.cam-right { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.cam-list { margin-top: 0; }
.cam-card { background: var(--card); border-color: var(--line); }
.cam-name { font: 600 22px/1.1 var(--display); color: var(--green); }
.top :focus-visible { outline-color: var(--champagne); }
@media (max-width: 860px) { .stage-pane { padding: 20px 16px 112px; } }
.cost-total .cost-inr { display: block; font-size: 13px; font-weight: 500; color: var(--muted); text-align: right; }

/* ================= UI polish (2026-11-03) ================= */

/* Buttons: long labels wrap inside the button instead of spilling out of it */
.btn { max-width: 100%; height: auto; min-height: 36px; padding-block: 6px; white-space: normal; line-height: 1.25; text-align: center; }
.btn-sm { height: auto; min-height: 32px; padding-block: 5px; }
.btn-xs { height: auto; min-height: 26px; padding-block: 3px; }

/* Scrollbars: slim champagne thumb on a clear track, green on hover */
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--green); }
  ::-webkit-scrollbar-corner { background: transparent; }
}

/* Dropdowns: brand chevron; Chromium also gets a fully styled option list */
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232A4538' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select:hover:not(:disabled) { border-color: var(--line-3); }
.select:disabled { opacity: 0.55; cursor: not-allowed; }
@supports (appearance: base-select) {
  .select, .select::picker(select) { appearance: base-select; }
  .select { display: flex; align-items: center; gap: 8px; background-image: none; padding-right: 12px; }
  .select::picker-icon {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232A4538' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    display: flex; margin-left: auto; transition: rotate var(--t);
  }
  .select:open::picker-icon { rotate: 180deg; }
  .select:open { background-color: var(--s1); border-color: var(--green); box-shadow: 0 0 0 3px rgba(42, 69, 56, 0.12); }
  .select::picker(select) {
    margin-top: 6px; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px;
    background: var(--card); box-shadow: 0 16px 40px rgba(27, 46, 37, 0.16);
  }
  .select option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; cursor: pointer; }
  .select option:hover, .select option:focus-visible { background: var(--ivory); outline: none; }
  .select option:checked { background: var(--champagne); color: var(--green); font-weight: 600; }
  .select option::checkmark { color: var(--green); order: 1; margin-left: auto; }
}

/* Google sign-in: logo beside the label */
.auth .auth-google { gap: 10px; }
.auth .auth-google .g-logo { width: 18px; height: 18px; flex: none; }

/* Photo slots: Upload / Camera sit in their own bar at the foot of the card */
.slot-body > .slot-actions {
  margin: auto -12px -12px; padding: 0; gap: 0; flex-wrap: nowrap;
  border-top: 1px solid var(--line); background: var(--paper);
}
.slot-body > .slot-actions .btn {
  flex: 1 1 0; min-height: 44px; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--muted); font-weight: 600;
}
.slot-body > .slot-actions .btn + .btn { border-left: 1px solid var(--line); }
.slot-body > .slot-actions .btn:hover:not(:disabled) { background: var(--champagne); color: var(--green); }
.slot-body > .slot-actions .btn:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.slot-body > .slot-actions .btn.push { margin-left: 0; color: var(--green); }
.slot-clean .slot-actions { margin-left: 0; gap: 6px; }
.slot-clean .btn-ghost { border: 1px solid var(--line-2); background: var(--card); }
.slot-clean .btn-ghost:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); color: var(--green); }

/* Credits panel */
.cr-modal { width: min(720px, calc(100vw - 32px)); }
.cr { display: grid; gap: 22px; }
.cr-hero {
  position: relative; overflow: hidden; display: grid; gap: 6px; padding: 22px 24px;
  border-radius: 16px; background: var(--green); color: var(--paper);
}
.cr-hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  border: 1px solid rgba(214, 177, 90, 0.35); pointer-events: none;
}
.cr-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cr-eyebrow { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.cr-hero .cr-badge { border-color: rgba(214, 177, 90, 0.6); color: var(--champagne); background: rgba(255, 255, 255, 0.06); }
.cr-amount { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.cr-hero .cr-num { font: 600 56px/1 var(--display); color: var(--paper); letter-spacing: 0; font-variant-numeric: lining-nums tabular-nums; }
.cr-pack .cr-pack-credits, .cr-pack .cr-pack-price { font-variant-numeric: lining-nums tabular-nums; }
.cr-unit { font-size: 15px; color: var(--champagne); }
.cr-hero-note { margin: 0; font-size: 13px; color: rgba(251, 248, 241, 0.75); }
.cr-hero .cr-low { margin-top: 6px; border: 1px solid rgba(214, 177, 90, 0.55); border-left: 3px solid var(--gold); background: rgba(214, 177, 90, 0.12); color: var(--paper); }
.cr-section { display: grid; gap: 10px; }
.cr-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cr-h { margin: 0; font: 600 22px/1.15 var(--display); color: var(--green); text-transform: none; letter-spacing: 0; }
.cr-sub { margin: 0; font-size: 13px; color: var(--muted); }
.cr-packs { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding-top: 8px; }
.cr-pack {
  position: relative; gap: 2px; padding: 18px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.cr-pack:hover { border-color: var(--gold-line); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.08); transform: translateY(-1px); }
.cr-pack.best { border-color: var(--gold); background: linear-gradient(180deg, #FFFDF6, var(--card)); }
.cr-tag {
  position: absolute; top: -10px; right: 14px; padding: 2px 10px; border-radius: 999px;
  background: var(--gold); color: var(--green-deep); font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.cr-pack-name { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cr-pack .cr-pack-credits { font: 600 30px/1.1 var(--display); font-variant-numeric: lining-nums tabular-nums; color: var(--green); margin-top: 4px; }
.cr-pack .cr-pack-price { font-size: 20px; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); margin-top: 8px; }
.cr-pack-rate { font-size: 12px; color: var(--muted); }
.cr-buy { margin-top: 14px; }
.cr-costs { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.cr-costs > summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--green); list-style: none; }
.cr-costs > summary::-webkit-details-marker { display: none; }
.cr-costs > summary::after { content: "+"; font-size: 18px; color: var(--gold-line); }
.cr-costs[open] > summary::after { content: "–"; }
.cr-costs .cr-table { margin: 0 16px 12px; width: calc(100% - 32px); }
.cr-activity { max-height: 300px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.cr-list { gap: 2px; }
.cr-list li { grid-template-columns: 32px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 0; border-radius: 10px; }
.cr-list li:hover { background: var(--ivory); }
.cr-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 15px; background: var(--ivory); color: var(--muted); }
.cr-dot.up { background: var(--sage); color: var(--green); }
.cr-what { display: grid; gap: 1px; min-width: 0; }
.cr-what b { font-weight: 600; font-size: 14px; color: var(--ink); }
.cr-what span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-delta { font-size: 15px; font-weight: 700; }
.cr-delta.up { color: var(--ok); }
.cr-delta.down { color: var(--ink); }
.cr-when { font-size: 12px; color: var(--faint); min-width: 64px; text-align: right; }
.cr-empty { margin: 0; padding: 18px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .cr-hero .cr-num { font-size: 44px; }
  .cr-list li { grid-template-columns: 28px 1fr auto; }
  .cr-when { display: none; }
}

/* ================= UI polish, round 2 (2026-11-03) ================= */

/* Step footer: sits at the end of the page instead of floating over the content while scrolling */
.stage-foot, .stage-view > .stage-foot {
  position: static; margin-left: 0; margin-right: 0; margin-top: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(27, 46, 37, 0.04); backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 12px 12px 12px 20px;
}
.stage-view { padding-bottom: 32px; }
@media (max-width: 860px) { .stage-view { padding-bottom: 20px; } .stage-foot { padding: 10px 10px 10px 14px; } }

/* Generation cards (isometric, decor, doodle, camera views): icon, percentage and label centred */
.prog-card:not(.prog-card--inline):not(.is-done) { align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.prog-card:not(.prog-card--inline):not(.is-done) .prog-card-ico { position: static; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line); color: var(--green); }
.prog-card:not(.prog-card--inline):not(.is-done) .prog-card-pct { position: static; font: 600 34px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; color: var(--green); }
.prog-card:not(.prog-card--inline):not(.is-done) .prog-card-lbl { position: static; max-width: 90%; white-space: normal; font-size: 13px; font-weight: 600; color: var(--muted); }
.prog-card.is-failed .prog-card-pct { display: none; }

/* Segmented controls (Keep / Remove / Erase a mark, tools): every option on one row */
.seg { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; gap: 4px; border-radius: 12px; background: var(--paper); }
.seg .chip { height: auto; min-height: 36px; padding: 6px 10px; border-radius: 9px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg .chip:hover { background: var(--ivory); color: var(--green); }
.seg .chip[aria-pressed="true"] { background: var(--green); color: var(--paper); box-shadow: 0 1px 3px rgba(27, 46, 37, 0.2); }
.btn-pair { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.btn-pair .btn-quiet { background: var(--card); border-color: var(--line-2); }
.btn-pair .btn-quiet:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); color: var(--green); }

/* Underlined text links become real buttons */
.link-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 4px 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--green);
  font-size: 13px; font-weight: 600; text-decoration: none; transition: background var(--t), border-color var(--t);
}
.link-btn.small { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.link-btn:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.auth-links { gap: 10px; }
.auth-link {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--green);
  font-size: 13px; font-weight: 600; text-decoration: none; transition: background var(--t), border-color var(--t);
}
.auth-link:hover { background: var(--champagne); border-color: var(--gold-line); }

/* Isometric card: actions sit on a proper row under the image, as real buttons */
.ov-panel .card-actions:not(:empty) { padding-top: 12px; border-top: 1px solid var(--line); }
.ov-panel .card-actions .btn-ghost, .card-actions .btn-ghost { border-color: var(--line-2); background: var(--card); color: var(--green); }
.card-actions .btn-ghost:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.overview.single { max-width: none; }

/* Comment pill: tidy input and real buttons for Decor / Upload / Place exactly / Redraw / Delete */
.pill-input:focus, .pill-input:focus-visible { outline: none; box-shadow: none; }
.pill-foot { gap: 6px; }
.pill-foot .btn { min-height: 30px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--green); font-weight: 600; }
.pill-foot .btn:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.pill-foot .btn.pill-del { color: var(--bad); }
.pill-foot .btn.pill-del:hover:not(:disabled) { background: #F6E3E0; border-color: var(--bad); }

/* Decor edit: many circled areas scroll inside the panel instead of stretching the page */
.area-list { max-height: min(48vh, 440px); overflow-y: auto; padding-right: 6px; margin-right: -6px; }
.area-card { gap: 6px; padding: 10px; border-color: var(--line); background: var(--card); }
.area-card.is-open { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.area-card .dc-textarea { min-height: 44px; }
.area-x { border: 1px solid var(--line-2); border-radius: 8px; padding: 2px 8px; color: var(--muted); }
.area-x:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); background: #F6E3E0; }

/* ================= UI polish, round 3 (2026-11-03) ================= */

/* Generation cards: sans-serif percentage (no old-style serif figures) */
.prog-card:not(.prog-card--inline):not(.is-done) .prog-card-pct { font: 700 28px/1 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.prog-card:not(.prog-card--inline):not(.is-done) .prog-card-lbl { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
/* Finished cards show only the picture: no leftover icon, 100% or label on top of it */
.prog-card.is-done:has(.prog-card-img) .prog-card-ico,
.prog-card.is-done:has(.prog-card-img) .prog-card-pct,
.prog-card.is-done:has(.prog-card-img) .prog-card-lbl { display: none; }

/* Decor edit: the picture stays in view while the long form on the right scrolls */
.ws { overflow: clip; }
.ws-split.edit { align-items: start; }
.ws-split.edit > .ws-canvas { position: sticky; top: 16px; align-self: start; }
.area-list { max-height: none; overflow: visible; padding-right: 0; margin-right: 0; }
.area-head .decor-ring-n.static { width: 22px; height: 22px; background: var(--green); color: var(--paper); font-size: 11px; }
.area-card .hint { margin-top: -2px; }

/* Apply takes the wide slot, Clear the narrow one */
.btn-pair:has(> .btn-primary) { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; gap: 6px; }
.btn-pair:has(> .btn-primary) > .btn-quiet { min-height: 34px; border-color: transparent; background: transparent; color: var(--muted); }
.btn-pair > .btn-primary { min-height: 44px; }

/* Text areas: same look as the other inputs, with a soft green focus ring */
.ws-form textarea, .field textarea, .dc-textarea {
  width: 100%; min-height: 72px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--ink);
  font: 14px/1.45 var(--sans); transition: border-color var(--t), box-shadow var(--t);
}
.ws-form textarea::placeholder, .field textarea::placeholder, .dc-textarea::placeholder { color: var(--faint); }
.ws-form textarea:hover:not(:disabled), .field textarea:hover:not(:disabled) { border-color: var(--line-3); }
.ws-form textarea:focus, .field textarea:focus, .dc-textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(42, 69, 56, 0.12); }
.ws-form textarea:disabled, .field textarea:disabled { background: var(--paper); opacity: 0.7; }
.whole-edit { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); gap: 10px; color: var(--green); font-weight: 600; font-size: 14px; }
.whole-edit .btn { width: 100%; }

/* ================= UI polish, round 4 (2026-11-03) ================= */

/* Decor edit: the form scrolls inside its own column, so the panel is only as tall as the screen
   and no empty space opens up under the picture */
.ws-split.edit > .ws-canvas { position: static; }
.ws-split.edit > .ws-form {
  max-height: max(440px, calc(100dvh - 230px)); overflow-y: auto; overscroll-behavior: contain;
  padding-right: 10px; margin-right: -10px;
}

/* Doodle footer: live status (with percentage) on the left, real buttons on the right */
.design-foot { min-height: 68px; gap: 16px; padding: 10px 16px; }
.design-msg { gap: 8px; color: var(--muted); }
.design-msg .msg-live {
  gap: 10px; padding: 6px 8px 6px 14px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--paper); color: var(--green); font-weight: 600; overflow: visible;
}
.design-msg .msg-live .live-dot { width: 8px; height: 8px; background: var(--gold); }
.design-msg .msg-live .tnum {
  padding: 3px 10px; border-radius: 999px; background: var(--green); color: var(--paper);
  font-size: 12px; font-weight: 700; min-width: 46px; text-align: center;
}
.design-actions { gap: 8px; }
.design-actions .btn-ghost { border: 1px solid var(--line-2); background: var(--card); color: var(--green); font-weight: 600; }
.design-actions .btn-ghost:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); color: var(--green); }
.design-actions .btn.is-busy { background: var(--paper); color: var(--green); border-color: var(--gold-line); }

/* Decor edit: version strip sits under the picture */
.ws-split.edit > .ws-canvas { flex-direction: column; align-items: stretch; gap: 14px; }
.ws-split.edit > .ws-canvas > .decor-canvas, .ws-split.edit > .ws-canvas > :first-child { align-self: center; }
.decor-versions-field { align-self: stretch; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--green); font-weight: 600; font-size: 13px; }
.decor-versions-field .decor-versions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; justify-content: flex-start; }
.decor-versions-field .decor-ver { width: 84px; padding: 4px; border-radius: 10px; background: var(--card); font-weight: 500; transition: border-color var(--t), box-shadow var(--t); }
.decor-versions-field .decor-ver img { border-radius: 6px; }
.decor-versions-field .decor-ver:hover { border-color: var(--gold-line); }
.decor-versions-field .decor-ver.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); color: var(--green); font-weight: 700; }

/* ================= UI polish, round 5 (2026-11-03) ================= */

/* Text areas grow with their text; no browser resize grip */
.ws-form textarea, .field textarea, .dc-textarea, .spec-notes, .decor-comment {
  resize: none; field-sizing: content; min-height: 72px; max-height: 220px; overflow-y: auto;
}
.area-card .dc-textarea { min-height: 56px; }

/* Number fields: themed + / − steppers instead of the spin arrows */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-step { position: relative; display: flex; width: 100%; }
.num-step > input { flex: 1; min-width: 0; padding-right: 48px; }
.num-btns { position: absolute; top: 4px; right: 4px; bottom: 4px; display: flex; flex-direction: column; gap: 2px; width: 34px; }
.num-btn {
  flex: 1; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); color: var(--green); font: 700 13px/1 var(--sans); cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.num-btn:hover { background: var(--champagne); border-color: var(--gold-line); }
.num-btn:active { background: var(--gold); }
.num-step:has(input:disabled) .num-btn { opacity: 0.45; pointer-events: none; }

/* Edit references: buttons on top, thumbnails in their own row underneath */
.area-refs { flex-direction: column; align-items: stretch; gap: 8px; }
.area-ref-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.area-ref-label { margin-right: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.area-ref-list { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--paper); }
.area-ref { width: 64px; height: 64px; border-radius: 8px; border-color: var(--line-2); box-shadow: 0 1px 3px rgba(27, 46, 37, 0.12); }
.area-ref button {
  top: 4px; right: 4px; width: 20px; height: 20px; display: grid; place-items: center; line-height: 1;
  background: rgba(27, 46, 37, 0.85); font-size: 14px; border-radius: 50%;
}
.area-ref button:hover:not(:disabled) { background: var(--bad); }

/* Presentation: one clean column of framed sections */
.present { background: var(--paper); }
.p-bar { gap: 12px; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.p-bar .brand-name { display: inline; font: 600 20px/1 var(--display); color: var(--green); letter-spacing: 0.02em; }
.p-bar .brand-sep { width: 1px; height: 20px; background: var(--line-2); }
.p-bar #present-close { border: 1px solid var(--line-2); background: var(--card); color: var(--green); }
.p-bar #present-close:hover { background: var(--champagne); border-color: var(--gold-line); }
.p-downloads { display: flex; gap: 8px; }
.p-downloads .btn:not(.btn-primary) { border: 1px solid var(--line-2); background: var(--card); color: var(--green); }
.p-body { max-width: 1160px; padding: 40px 32px 96px; gap: 28px; }
.p-hero {
  max-width: none; gap: 12px; padding: 44px 48px; border-radius: 20px; position: relative; overflow: hidden;
  background: var(--green); color: var(--paper);
}
.p-hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; border: 1px solid rgba(214, 177, 90, 0.3); pointer-events: none; }
.p-hero .eyebrow { color: var(--gold); letter-spacing: 0.18em; }
.p-hero h1 { font: 600 52px/1.05 var(--display); color: var(--paper); letter-spacing: 0; }
.p-hero .lead { max-width: 70ch; font-size: 16px; line-height: 1.6; color: rgba(251, 248, 241, 0.82); }
.p-stats { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.p-stats li { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 16px; border: 1px solid rgba(214, 177, 90, 0.45); border-radius: 999px; background: rgba(255, 255, 255, 0.06); font-size: 13px; color: var(--champagne); }
.p-stats strong { font: 700 18px/1 var(--sans); color: var(--paper); }
.p-section { gap: 20px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 1px 2px rgba(27, 46, 37, 0.04); }
.p-head { align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.p-num { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--champagne); color: var(--green); font: 700 13px/1 var(--sans); }
.p-head h2 { font: 600 28px/1.1 var(--display); color: var(--green); letter-spacing: 0; }
.p-head p { margin-top: 2px; font-size: 14px; }
.p-grid { gap: 16px; }
.p-grid.one { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) { .p-grid.three, .p-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.p-fig { gap: 8px; }
.p-fig figcaption { font-size: 13px; font-weight: 600; color: var(--green); }
.p-img { border-radius: 12px; border-color: var(--line); background: var(--paper); transition: box-shadow var(--t), transform var(--t); }
.p-img:hover { box-shadow: 0 10px 28px rgba(27, 46, 37, 0.12); transform: translateY(-1px); }
.p-fig.wide .p-img img { max-height: 68vh; background: var(--paper); }
.p-viewer { border-radius: 12px; }
.p-version { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.p-note { font-size: 14px; }
.p-credits { display: grid; gap: 14px; max-width: 560px; }
.p-credits-total { display: flex; align-items: baseline; gap: 12px; color: var(--muted); font-size: 15px; }
.p-credits-num { font: 700 44px/1 var(--sans); color: var(--green); letter-spacing: -0.02em; }
.p-credits-list { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.p-credits-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 14px; }
.p-credits-list li + li { border-top: 1px solid var(--line); }
.p-credits-list li:nth-child(odd) { background: var(--paper); }
.p-credits-list li span:last-child { font-weight: 700; color: var(--green); }
@media (max-width: 860px) {
  .p-body { padding: 20px 14px 64px; gap: 18px; }
  .p-hero { padding: 28px 22px; }
  .p-hero h1 { font-size: 34px; }
  .p-section { padding: 18px; }
}

/* ================= UI polish, round 6 (2026-11-03) ================= */

/* Presentation bar: green band like the Studio header; logo left, title centre, actions right */
.p-bar {
  height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 24px; background: var(--green); border-bottom: 1px solid var(--green-deep); color: var(--paper);
}
.p-logo { display: inline-flex; flex-direction: column; gap: 5px; justify-self: start; margin-left: 14px; transform: rotate(-4deg); }
.p-logo .lt { font: 500 18px/1 var(--display); letter-spacing: 0.2em; color: var(--gold); padding-left: 0.2em; white-space: nowrap; }
.p-logo .lu { height: 1px; background: var(--gold); margin: 0 -12%; }
.p-title { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.p-title-kicker { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.p-title-name { max-width: 42vw; font: 600 20px/1.1 var(--display); color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-bar > .p-downloads { justify-self: end; }
.p-bar .p-downloads, .p-bar #present-close { grid-row: 1; }
.p-bar { grid-template-areas: "logo title actions"; }
.p-bar > .p-logo { grid-area: logo; }
.p-bar > .p-title { grid-area: title; }
.p-bar > .p-downloads { grid-area: actions; display: flex; align-items: center; gap: 8px; margin-right: 92px; }
.p-bar > #present-close { grid-area: actions; justify-self: end; }
.p-bar .btn { min-height: 36px; border-radius: 10px; }
.p-bar .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--green-deep); }
.p-bar .btn-primary:hover:not(:disabled) { background: var(--champagne); border-color: var(--champagne); }
.p-bar .p-downloads .btn:not(.btn-primary), .p-bar #present-close {
  background: transparent; border: 1px solid rgba(239, 226, 188, 0.45); color: var(--paper);
}
.p-bar .p-downloads .btn:not(.btn-primary):hover:not(:disabled), .p-bar #present-close:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--champagne); color: var(--paper); }
.p-bar :focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; }
@media (max-width: 860px) {
  .p-bar { height: auto; padding: 10px 14px; grid-template-columns: 1fr auto; grid-template-areas: "logo actions" "title title"; row-gap: 8px; }
  .p-bar > .p-downloads { margin-right: 88px; }
  .p-title { align-items: flex-start; }
  .p-title-name { max-width: 90vw; }
}

/* Finished options: corner button opens the picture full size */
.prog-card-zoom {
  position: absolute; top: 10px; right: 10px; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line-2); color: var(--green);
  box-shadow: 0 2px 8px rgba(27, 46, 37, 0.15); cursor: zoom-in; opacity: 0; transition: opacity var(--t), background var(--t);
}
.prog-card:hover .prog-card-zoom, .prog-card:focus-within .prog-card-zoom, .prog-card-zoom:focus-visible { opacity: 1; }
.prog-card-zoom:hover { background: var(--champagne); }
@media (hover: none) { .prog-card-zoom { opacity: 1; } }

/* Decor: "Your uploads" in the left panel, draggable onto edit areas */
.ws-uploads { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); display: grid; gap: 10px; }
.ws-uploads.drop-over { border-color: var(--green); box-shadow: 0 0 0 2px rgba(42, 69, 56, 0.15); background: var(--ivory); }
.ws-uploads-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ws-uploads-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
.ws-uploads-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ws-up {
  aspect-ratio: 1; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--paper);
  cursor: grab; transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.ws-up:hover { border-color: var(--gold-line); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27, 46, 37, 0.12); }
.ws-up:active { cursor: grabbing; }
.ws-up img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ws-uploads-empty, .ws-uploads-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ws-uploads-empty { padding: 10px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; }
.area-card.drop-over { border-color: var(--green); background: var(--ivory); box-shadow: 0 0 0 2px rgba(42, 69, 56, 0.18); }

/* ================= UI polish, round 7 (2026-11-03) ================= */

/* Uploads panel: just the thumbnails (the how-to is in the tour) */
.ws-uploads { gap: 8px; padding: 10px; }
.ws-uploads-title { display: block; font-size: 11px; letter-spacing: 0.12em; }

/* Decor piece list: a real round remove button that never covers the name */
.ws-item-btn { padding-right: 40px; }
.ws-item-x {
  top: 50%; right: 8px; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--card); color: var(--muted);
  box-shadow: 0 1px 2px rgba(27, 46, 37, 0.08); transition: opacity var(--t), background var(--t), color var(--t), border-color var(--t);
}
.ws-item-x .ico { display: block; }
.ws-item-x:hover { background: #F6E3E0; border-color: var(--bad); color: var(--bad); }
@media (hover: none) { .ws-item-x { opacity: 1; } }

/* Version tiles: no dark frame; the current one gets a soft gold outline */
.decor-ver { border-color: var(--line); background: var(--card); }
.decor-ver img { background: var(--paper); border-radius: 6px; object-fit: contain; }
.decor-ver.is-on, .decor-versions-field .decor-ver.is-on {
  border-color: var(--gold-line); background: #FFFBF0; box-shadow: 0 0 0 2px rgba(214, 177, 90, 0.35); color: var(--green); font-weight: 700;
}

/* ================= UI polish, round 8 (2026-11-03) ================= */

/* Comment pill: decor angles sit under the comment as a slim row, clear of the send button */
.pill-extra .pill-angles {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; margin: 0; border-bottom: 1px solid var(--line);
}
.pill-extra .pill-angles[hidden] { display: none; }
.pill-extra .pill-angle {
  flex: 0 0 auto; width: 62px; gap: 2px; padding: 3px 3px 4px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--card); color: var(--muted); font-size: 10.5px; font-weight: 600; line-height: 1.2;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.pill-extra .pill-angle img { width: 100%; height: 40px; aspect-ratio: auto; object-fit: contain; border-radius: 5px; background: var(--paper); }
.pill-extra .pill-angle span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-extra .pill-angle:hover { border-color: var(--gold-line); background: var(--ivory); color: var(--green); }
.pill-extra .pill-angle.active { border-color: var(--green); background: #EEF2EC; color: var(--green); box-shadow: 0 0 0 1px var(--green); }

/* Picking one of several versions: compact 2x2 cards with a clear chosen state */
.scene-pick-modal { width: min(780px, 94vw); }
.scene-pick { gap: 12px; }
.scene-pick .prog-grid { width: 100%; gap: 14px; padding: 8px; }
.scene-pick .prog-card { width: 100%; aspect-ratio: 16 / 10; min-height: 0; }
.scene-pick .prog-card:not(.prog-card--inline):not(.is-done) { gap: 6px; padding: 12px; }
.scene-pick .prog-card:not(.prog-card--inline):not(.is-done) .prog-card-ico { width: 38px; height: 38px; }
.scene-pick .prog-card:not(.prog-card--inline):not(.is-done) .prog-card-pct { font-size: 22px; }
.scene-pick .prog-card:not(.prog-card--inline):not(.is-done) .prog-card-lbl { font-size: 11px; }
.scene-pick-step .prog-card { min-height: 220px; }
.scene-pick .btn-pair { align-items: center; }

/* A finished option keeps its name as a small chip, so the choice is easy to talk about */
.scene-pick .prog-card.is-done:has(.prog-card-img) .prog-card-lbl {
  display: block; z-index: 1; left: 10px; right: auto; bottom: 10px; max-width: calc(100% - 20px); padding: 4px 9px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--green); text-shadow: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}

/* Selectable option cards (every picker): hover lift, then a green ring and check on the chosen one */
button.prog-card.is-done { padding: 0; cursor: pointer; outline: 0 solid transparent; outline-offset: 3px; transition: outline-color var(--t), transform var(--t), box-shadow var(--t), opacity var(--t); }
button.prog-card.is-done:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(27, 46, 37, 0.16); }
button.prog-card.is-done:focus-visible { outline: 2px solid var(--gold-line); }
.prog-card.is-selected, button.prog-card.is-done.is-selected { outline: 3px solid var(--green); outline-offset: 3px; box-shadow: 0 0 0 7px rgba(214, 177, 90, 0.35); }
.prog-card.is-selected::after {
  content: ""; position: absolute; top: 10px; left: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFDF7' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat;
  box-shadow: 0 2px 6px rgba(27, 46, 37, 0.3); border: 2px solid #FFFDF7;
}
.prog-grid:has(.is-selected) button.prog-card.is-done:not(.is-selected) { opacity: 0.62; }
.prog-grid:has(.is-selected) button.prog-card.is-done:not(.is-selected):hover { opacity: 1; }

/* ================= UI polish, round 9 (2026-11-03) ================= */

/* Doodle footer: several runs (360 view, night mode, top view) show as chips side by side */
.design-msg { flex-wrap: wrap; row-gap: 6px; overflow: visible; }
.design-msg > .msg-live { flex: none; }

/* 360 viewer controls: light pill buttons on the picture instead of black blocks */
.viewer-ctrls { right: 12px; bottom: 12px; gap: 6px; padding: 4px; border-radius: 12px; background: rgba(255, 253, 247, 0.9); border: 1px solid var(--line-2); box-shadow: 0 4px 14px rgba(27, 46, 37, 0.18); backdrop-filter: blur(6px); }
.viewer-btn { min-width: 32px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--green); font: 600 16px/1 var(--sans); }
.viewer-btn:hover { background: var(--champagne); }
.viewer-btn:focus-visible { outline: 2px solid var(--gold-line); outline-offset: 1px; }
.viewer-btn-text { font-size: 12.5px; padding: 0 12px; }

/* Full-size view always opens above the presentation */
.modal-lightbox, body.presenting .modal { z-index: 90; }
.lightbox .modal-box { width: min(1280px, 100%); }
.lightbox-img { display: grid; place-items: center; background: var(--paper); border-radius: 12px; overflow: hidden; }
.lightbox-img img { display: block; width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 0; }

/* Camera views: right panel of stacked cards (top view, editor, cameras) */
.cam-split { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 24px; }
.cam-right { display: grid; gap: 12px; padding: 0; background: none; border: 0; border-radius: 0; }
.cam-box { display: grid; gap: 10px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.cam-box > .btn { justify-self: start; width: auto; }
.cam-box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cam-box-title { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
.cam-meta { margin: 0; font-size: 13px; color: var(--muted); }
.cam-count { min-width: 24px; height: 24px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-2); font-size: 12px; font-weight: 700; color: var(--green); }
.cam-chip { flex: none; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.cam-chip.ok { background: #EEF2EC; border-color: rgba(42, 69, 56, 0.25); color: var(--green); }
.cam-chip.warn { background: #FBF3E0; border-color: var(--gold-line); color: #8A6A1F; }
.cam-chip.live { background: var(--green); border-color: var(--green); color: var(--paper); }
.cam-chip.bad { background: #F6E3E0; border-color: var(--bad); color: var(--bad); }
.cam-top { background: linear-gradient(180deg, #FFFDF7, var(--card)); }
.cam-empty { margin: 0; padding: 10px 0 2px; font-size: 13px; color: var(--muted); }
.cam-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.cam-row {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.cam-row:hover { border-color: var(--gold-line); background: var(--ivory); }
.cam-row.is-on { border-color: var(--green); background: #EEF2EC; box-shadow: 0 0 0 1px var(--green); }
.cam-row-num { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: var(--paper); font-size: 12px; font-weight: 700; }
.cam-row-text { display: grid; min-width: 0; }
.cam-row-name { font-weight: 700; font-size: 13.5px; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-row-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-edit { border-color: rgba(42, 69, 56, 0.45); box-shadow: 0 8px 24px rgba(27, 46, 37, 0.08); }
.cam-draft-panel { gap: 12px; }
.cam-draft-panel .field { display: grid; gap: 6px; }
.cam-draft-panel .field > .small.muted { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cam-draft-panel input[type="text"] { height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); color: var(--ink); }
.cam-draft-panel input[type="text"]:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(42, 69, 56, 0.12); }
.cam-pane .cam-seg { gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); }
.cam-pane .cam-seg .seg-btn { border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--green); }
.cam-pane .cam-seg .seg-btn[aria-checked="true"] { background: var(--green); color: var(--paper); }
/* Lens: name over focal length, so four lenses fit a narrow panel without wrapping mid-label. */
.cam-pane .cam-lens .seg-btn { height: auto; min-height: 44px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.15; }
.cam-pane .cam-lens .lens-name { white-space: nowrap; }
.cam-pane .cam-lens .lens-mm { font-size: 11.5px; font-weight: 500; opacity: 0.8; white-space: nowrap; }
.cam-turn .btn { border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); color: var(--green); font-weight: 600; }
.cam-turn .btn:hover { background: var(--champagne); border-color: var(--gold-line); }
.cam-turn input[type="range"] { accent-color: var(--green); }
.cam-draft-panel > .small.muted { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--paper); font-size: 12px; line-height: 1.45; }
.cam-draft-panel .btn-pair { display: flex; gap: 8px; align-items: center; }
.cam-draft-panel .btn-pair .btn { width: auto; }
.cam-svg .cam-num { fill: var(--green); font-weight: 700; font-family: var(--sans); pointer-events: none; }
.cam-svg .cam-dot { stroke: var(--green); }

/* Camera result cards */
.cam-list { gap: 14px; margin-top: 20px; }
.cam-card { padding: 18px; border-radius: 14px; }
.cam-card.sel { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.cam-card-head .small.muted { margin: 2px 0 0; }
.cam-card-head .btn-pair .btn { border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--green); font-weight: 600; }
.cam-card-head .btn-pair .btn:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.cam-kept-img { border-radius: 12px; border-color: var(--line); max-width: 640px; }

/* ================= UI polish, round 10 (2026-11-03) ================= */

/* Doodle canvas: version stepper and day / night switch, top right of the picture */
.ver-bar {
  position: absolute; top: 12px; right: 12px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 4px;
  border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 253, 247, 0.94); box-shadow: 0 4px 14px rgba(27, 46, 37, 0.14); backdrop-filter: blur(6px);
}
.ver-bar[hidden] { display: none; }
.ver-nav { display: flex; align-items: center; gap: 2px; }
.ver-step { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--green); cursor: pointer; transition: background var(--t); }
.ver-step:hover:not(:disabled) { background: var(--champagne); }
.ver-step:disabled { opacity: 0.35; cursor: default; }
.ver-label { min-width: 62px; text-align: center; font-size: 13px; color: var(--muted); }
.ver-label strong { color: var(--green); font-weight: 700; }
.ver-dn { display: flex; gap: 2px; padding: 3px; border-left: 1px solid var(--line); padding-left: 8px; }
.ver-dn-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--green); font: 600 12.5px/1 var(--sans); cursor: pointer; transition: background var(--t), color var(--t);
}
.ver-dn-btn:hover { background: var(--champagne); }
.ver-dn-btn[aria-checked="true"] { background: var(--green); color: var(--paper); }
.ver-dn-btn[aria-checked="true"]:last-child { background: #1B2E25; color: #F3D98B; }

/* History: the whole card opens that version */
.hist { gap: 12px; padding: 10px; border-radius: 12px; background: var(--card); cursor: pointer; transition: border-color var(--t), background var(--t), box-shadow var(--t); }
.hist:hover { border-color: var(--gold-line); background: var(--ivory); }
.hist:focus-visible { outline: 2px solid var(--gold-line); outline-offset: 2px; }
.hist.shown { border-color: var(--green); background: #EEF2EC; box-shadow: 0 0 0 1px var(--green); }
.hist-thumb { width: 88px; height: 60px; border-radius: 8px; border-color: var(--line); }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.hist-title { white-space: nowrap; color: var(--green); }
.hist-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-left: auto; }
.hist-night { display: inline-flex; align-items: center; gap: 4px; background: #1B2E25; color: #F3D98B; border: 0; }
.hist-viewing { background: var(--green); color: var(--paper); border: 0; }

/* Step 1: venue type */
.venue-setting { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -4px 0 16px; }
.venue-setting-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.venue-setting .seg { display: inline-flex; width: auto; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); }
.venue-setting .seg-btn { padding: 6px 14px; border-radius: 7px; font-weight: 600; color: var(--green); }
.venue-setting .seg-btn[aria-checked="true"] { background: var(--green); color: var(--paper); }

/* ================= UI polish, round 11 (2026-11-03) ================= */

/* Option cards: the full-size button is always visible, with a label */
.prog-card-zoom { opacity: 1; width: auto; height: 30px; padding: 0 10px 0 8px; gap: 5px; display: inline-flex; align-items: center; border-radius: 999px; font: 700 12px/1 var(--sans); }
.prog-card-zoom:hover { background: var(--green); color: var(--paper); border-color: var(--green); }

/* Decor footer: one calm status line for the selected piece (step dots, step name, what is happening, %) */
.stage-foot.has-status .foot-text { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.dc-status { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; font-size: 13.5px; line-height: 1.35; color: var(--ink); }
.dc-status-steps { display: inline-flex; gap: 4px; flex: none; }
.dc-status-dot { width: 18px; height: 4px; border-radius: 99px; background: var(--line-2); }
.dc-status-dot.done { background: var(--green); }
.dc-status-dot.on { background: var(--gold); }
.dc-status.is-live .dc-status-dot.on { animation: dcPulse 1.4s ease-in-out infinite; }
@keyframes dcPulse { 50% { opacity: 0.4; } }
.dc-status-step { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 700; color: var(--green); white-space: nowrap; }
.dc-status-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-status-pct { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--green); color: var(--paper); font-size: 12px; font-weight: 700; }
.dc-status.is-ok .dc-status-text { color: var(--green); font-weight: 600; }
.dc-status.is-warn .dc-status-text { color: #8A6A1F; }
.foot-count { flex: none; font-size: 12.5px; padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
@media (max-width: 900px) { .dc-status-step, .foot-count { display: none; } .dc-status-text { white-space: normal; } }

/* ================= UI polish, round 12 (2026-11-03) ================= */

/* Venue type: two equal buttons on one line */
.venue-setting .seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; align-items: stretch; width: auto; }
.venue-setting .seg-btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; margin: 0; padding: 0 16px; line-height: 1; white-space: nowrap; font-size: 13.5px; }

/* Decor: "Back to the 4 versions" as a real button, or a quiet note when it is locked */
.repick-row { display: flex; }
.repick-row .btn { width: auto; }
.repick-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.repick-note .ico { flex: none; margin-top: 2px; color: var(--green); opacity: 0.7; }

/* Decor area cards: a soft gold outline when open, no heavy dark frame */
.area-card { border: 1px solid var(--line); box-shadow: none; }
.area-card.is-open { border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(214, 177, 90, 0.18); background: #FFFDF7; }
.area-card .dc-textarea, .area-card textarea { border: 1px solid var(--line-2); box-shadow: none; outline: none; }
.area-card textarea:focus, .area-card .dc-textarea:focus { border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(214, 177, 90, 0.18); outline: none; }

/* Testing accounts: money next to credits in the presentation */
.p-credits-money { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 12px; border: 1px dashed var(--gold-line); border-radius: 10px; background: #FFFBF0; font-size: 13px; color: var(--muted); }
.p-credits-money strong { color: var(--green); }

/* Camera cards (step 5): one header row, image + actions side by side, buttons one size */
.cam-card { gap: 14px; padding: 18px 20px; }
.cam-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; flex-wrap: nowrap; }
.cam-card-num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: var(--paper); font-size: 13px; font-weight: 700; }
.cam-card-title { min-width: 0; }
.cam-card-title .cam-name { margin: 0; }
.cam-card-meta { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-card-tools { display: flex; gap: 6px; }
.cam-card .btn { height: 34px; min-height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; width: auto; }
.cam-card .btn:not(.btn-primary) { border: 1px solid var(--line-2); background: var(--card); color: var(--green); }
.cam-card .btn:not(.btn-primary):hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.cam-card .btn-primary { padding: 0 18px; }
.cam-kept { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 20px; align-items: start; }
.cam-kept-img { max-width: none; width: 100%; aspect-ratio: 3 / 2; border-radius: 12px; border: 1px solid var(--line); }
.cam-kept-img img { width: 100%; height: 100%; object-fit: cover; }
.cam-kept-side { display: grid; gap: 6px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.cam-kept-title { margin: 0; font-weight: 700; color: var(--green); }
.cam-kept-note { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.cam-kept-actions { display: grid; gap: 8px; }
.cam-kept-actions .btn { width: 100%; justify-content: center; }
.cam-actions { justify-content: flex-end; gap: 8px; }
.cam-actions-again { margin-top: -4px; }
@media (max-width: 900px) {
  .cam-kept { grid-template-columns: 1fr; }
  .cam-card-head { grid-template-columns: auto minmax(0, 1fr); }
  .cam-card-head > .cam-chip { justify-self: start; grid-column: 2; }
  .cam-card-tools { grid-column: 1 / -1; }
}
.cam-draft-panel > .btn-quiet:last-child { justify-self: start; color: var(--bad); }

/* Edit photo inside a camera card (ADR-32): the kept photo with the marking tools beside it; stacked on small screens */
.cam-card .cam-edit { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.cam-card .cam-edit-canvas { display: flex; justify-content: center; min-width: 0; position: sticky; top: 16px; }
.cam-card .cam-edit-canvas .decor-canvas { max-width: 100%; }
.cam-card .cam-edit-canvas .decor-canvas img { width: auto; max-width: 100%; max-height: 62dvh; }
.cam-card .cam-edit-form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cam-card .cam-edit .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-card .btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--paper); }
.cam-card .cam-edit .area-list { max-height: min(40dvh, 440px); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; scrollbar-gutter: stable; }
.cam-edit-ref { display: inline-flex; align-items: center; gap: 8px; }
.cam-edit-ref img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); }
.cam-edit-pieces { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-edit-thumb { width: 22px; height: 22px; margin-right: 6px; border-radius: 4px; object-fit: cover; }
@media (max-width: 900px) {
  .cam-card .cam-edit { grid-template-columns: 1fr; }
  .cam-card .cam-edit-canvas { position: static; }
}

/* Decor (step 3): progress + next-step buttons in a compact bar beside the title */
.dc-head { align-items: flex-end; flex-wrap: wrap; }
.dc-topbar { display: grid; gap: 8px; width: min(440px, 100%); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.dc-topbar-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dc-topbar .dc-status { gap: 8px; font-size: 12.5px; }
.dc-topbar .dc-status-dot { width: 12px; }
.dc-topbar .dc-status-step { padding: 2px 8px; font-size: 11px; }
.dc-topbar .dc-status-text { color: var(--muted); }
.dc-topbar-count { flex: none; margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dc-topbar-count strong { color: var(--green); }
.dc-topbar-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dc-topbar-actions .btn { height: 34px; min-height: 34px; padding: 0 14px; width: auto; }
.dc-topbar-actions .btn-primary { flex: 1; }
@media (max-width: 900px) { .dc-topbar { width: 100%; } .dc-topbar .dc-status-step { display: inline; } }

/* Decor marking: the one-click removal first, the brush as the optional route */
.mk-auto { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.mk-auto .btn { width: 100%; justify-content: center; }
.mk-auto .hint { margin: 0; }
.mk-or { margin: 4px 0 0; }

/* Magic eraser thumbnails with a label beside them */
.ws-cutouts { gap: 0; }
.ws-cutout-row { align-items: center; gap: 10px; flex-wrap: nowrap; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ws-cutout { flex: none; border-color: var(--line-2); }
.ws-cutout:hover, .ws-cutout:focus-visible { border-color: var(--green); box-shadow: 0 0 0 2px rgba(42, 69, 56, 0.15); }
.ws-cutout-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(27, 46, 37, 0.55); color: var(--paper); font-size: 11px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.ws-cutout:hover .ws-cutout-hover, .ws-cutout:focus-visible .ws-cutout-hover { opacity: 1; }
.ws-cutout-text { min-width: 0; }
.ws-cutout-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--green); }
.ws-cutout-note { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }

/* Header account menu: who is signed in, Sign out inside */
.acct { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; max-width: 240px; padding: 0 10px 0 4px; border: 1px solid rgba(239, 226, 188, 0.4); border-radius: 999px; background: transparent; color: var(--champagne); cursor: pointer; font: inherit; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: rgba(239, 226, 188, 0.1); border-color: var(--champagne); }
.acct-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.acct-avatar { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--green-deep); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.acct-text { display: grid; min-width: 0; text-align: left; line-height: 1.15; }
.acct-name { font-size: 12.5px; font-weight: 600; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-email { font-size: 11px; color: rgba(239, 226, 188, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-caret { flex: none; width: 7px; height: 7px; margin: -3px 2px 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.acct-btn[aria-expanded="true"] .acct-caret { transform: rotate(-135deg); margin-top: 3px; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 264px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: 0 16px 40px rgba(27, 46, 37, 0.18); }
.acct-menu[hidden] { display: none; }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px; }
.acct-head .acct-avatar { width: 36px; height: 36px; font-size: 13px; background: var(--green); color: var(--paper); }
.acct-head-text { min-width: 0; }
.acct-head-name { margin: 0; font-weight: 700; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-head-email { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-label { margin: 0 8px 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.acct-item { display: flex; align-items: center; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--green); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; }
.acct-item:hover:not(:disabled), .acct-item:focus-visible { background: var(--champagne); outline: none; }
.acct-signout { color: var(--bad); }
@media (max-width: 760px) { .acct-text { display: none; } .acct-btn { padding: 0 6px 0 4px; } }

/* ================= Button system (design.md section 6) ================= */
/* Disabled main buttons keep their shape and read as "not yet", never as a muddy green. */
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { opacity: 1; background: var(--ivory); border-color: var(--line-strong); color: var(--faint); box-shadow: none; }
.btn:disabled:not(.btn-primary) { opacity: 0.5; }

/* Decor (step 3) bar beside the title: progress on the left, Back + the main button on the right, one size */
.dc-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; width: min(620px, 100%); padding: 12px 12px 12px 16px; }
.dc-topbar-info { display: grid; gap: 4px; min-width: 0; }
.dc-topbar-info .dc-status { min-width: 0; }
.dc-topbar-count { margin-left: 0; font-size: 12px; }
.dc-topbar-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dc-topbar-actions .btn { flex: none; width: auto; height: 36px; min-height: 36px; padding: 0 16px; border-radius: 8px; font-size: 13.5px; white-space: nowrap; }
.dc-topbar-actions .btn-primary { flex: none; padding: 0 18px; }
@media (max-width: 700px) {
  .dc-topbar { grid-template-columns: 1fr; }
  .dc-topbar-actions .btn-primary { flex: 1; }
}

/* Account menu: payments & invoices (ADR-26) */
.acct-item + .acct-signout { margin-top: 2px; }
.pay-modal .modal-box { width: min(720px, calc(100vw - 32px)); }
.pay { display: grid; gap: 14px; }
.pay-lead { margin: 0; font-size: 13.5px; color: var(--muted); }
.pay-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pay-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pay-when, .pay-what { display: grid; min-width: 0; line-height: 1.3; }
.pay-date { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.pay-time, .pay-credits { font-size: 12px; color: var(--muted); }
.pay-pack { font-weight: 700; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-amount { font-weight: 700; font-size: 14px; color: var(--ink); }
.pay-row .btn { height: 34px; min-height: 34px; padding: 0 14px; width: auto; border: 1px solid var(--line-2); background: var(--card); color: var(--green); }
.pay-row .btn:hover:not(:disabled) { background: var(--champagne); border-color: var(--gold-line); }
.pay-empty { display: grid; gap: 6px; justify-items: start; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--paper); }
.pay-empty-title { margin: 0; font-weight: 700; color: var(--green); }
@media (max-width: 640px) {
  .pay-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pay-when { grid-column: 1 / -1; }
}

/* Invoice preview (the printed copy uses its own styles in a hidden frame) */
.inv-modal .modal-box { width: min(780px, calc(100vw - 32px)); }
.inv-wrap { display: grid; gap: 16px; }
.inv-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }
.inv { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-size: 13.5px; }
.inv p { margin: 0; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--green); }
.inv-brand { font: 600 19px/1 var(--display); letter-spacing: 0.2em; color: var(--green); }
.inv-sub { margin-top: 6px !important; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.inv-title-box { text-align: right; }
.inv-title { font: 600 26px/1 var(--display); color: var(--green); }
.inv-no { margin-top: 6px !important; font-size: 12.5px; color: var(--muted); }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0; }
.inv-label { margin-bottom: 4px !important; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.inv-strong { font-weight: 700; }
.inv-muted { margin-top: 2px !important; font-size: 12.5px; color: var(--muted); }
.inv-kv { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; font-size: 13px; }
.inv-kv span:first-child { color: var(--muted); }
.inv-table { width: 100%; border-collapse: collapse; margin: 4px 0 16px; }
.inv-table th { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.inv-table td { padding: 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-table .num { width: 90px; text-align: right; }
.inv-table tfoot td { border-bottom: 0; font-weight: 700; font-size: 15px; color: var(--green); }
.inv-table tfoot .inv-sum td { font-weight: 400; font-size: 13px; padding-top: 6px; padding-bottom: 6px; color: var(--muted); }
.inv-seller { margin-top: 12px !important; }
.inv-ref { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.inv-foot { margin-top: 14px !important; font-size: 12px; color: var(--muted); }
.inv-actions { display: flex; justify-content: flex-end; }
@media (max-width: 640px) { .inv-meta { grid-template-columns: 1fr; } }

/* Topbar: the actions column takes the width its buttons need, so labels never wrap
   ("New project", "Replay tour"); the project name on the left shrinks first. */
.top { grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr); }
.top .btn, .top .credits-pill, .top .cost-pill { white-space: nowrap; flex: none; height: 32px; min-height: 32px; padding-block: 0; }
.top .brand { white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 1100px) { .top .logo { display: none; } .top { grid-template-columns: minmax(0, 1fr) max-content; } }

/* ================= Your projects (ADR-30) ================= */
.rail-projects { padding: 4px 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.rail-projects-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 8px 6px; }
.rail-h { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rail-projects .link-btn { font-size: 12px; }
.proj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.proj-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; cursor: pointer; text-align: left; color: var(--fg); transition: background var(--t), border-color var(--t);
}
.proj-item:hover { background: var(--ivory); }
.proj-item:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.proj-item.current { background: var(--ivory); border-color: var(--gold-line); }
.proj-thumb { flex: none; width: 44px; height: 33px; border-radius: 6px; object-fit: cover; background: var(--paper); border: 1px solid var(--line); }
.proj-thumb-empty { display: inline-block; }
.proj-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.proj-name { font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-done { color: var(--green); font-weight: 600; }
/* Dialog: larger cards, every project. */
.proj-dialog { display: flex; flex-direction: column; gap: 14px; }
.proj-dialog > .muted { margin: 0; }
.proj-list-wide { max-height: min(60vh, 520px); overflow-y: auto; gap: 6px; }
.proj-list-wide .proj-item { padding: 8px; border-color: var(--line); }
.proj-list-wide .proj-thumb { width: 88px; height: 66px; }
.proj-list-wide .proj-name { font-size: 14px; }
.proj-list-wide .proj-sub { white-space: normal; }
/* The rail is icons only below 1240px: the list is in the account menu there. */
@media (max-width: 1240px) { .rail-projects { display: none; } }
.proj-when { font-size: 11px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item.current .proj-when { color: var(--green); font-weight: 600; }
