:root {
  --bg: #f3f0eb; --panel: #ffffff; --ink: #24211d; --muted: #8a8279; --line: #e4ddd2;
  --accent: #c8553d; --accent-soft: #f7e4de; --ok: #3f7a4b; --ok-soft: #e3efe4; --warn: #c27b1c; --warn-soft: #fbefd9;
  --chip: #f0ebe3; --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.6 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: 7px 14px; background: var(--chip); color: var(--ink); }
button:hover { filter: brightness(.97); }
button.primary { background: var(--ink); color: #fff; }
button.accent { background: var(--accent); color: #fff; }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); background: var(--chip); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.on { background: var(--accent); color: #fff; }
input, textarea, select { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; resize: vertical; min-height: 90px; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 顶栏 */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .04em; text-decoration: none; }
.crumb { color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps { display: flex; gap: 4px; margin: 0 auto; background: var(--chip); padding: 4px; border-radius: 10px; }
.steps button { background: transparent; padding: 6px 14px; color: var(--muted); }
.steps button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.steps button.done::after { content: " ✓"; color: var(--ok); }
.right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.cost { font-size: 12px; color: var(--muted); background: var(--chip); padding: 4px 10px; border-radius: 999px; }

/* 项目列表 */
.home { max-width: 1080px; margin: 32px auto; padding: 0 20px; }
.home .head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.link { cursor: pointer; transition: .15s; }
.card.link:hover { border-color: var(--accent); }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.newform { display: grid; gap: 8px; }

/* 第一步布局 */
.step1 { display: grid; grid-template-columns: 210px 1fr; height: calc(100vh - 56px); }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; overflow: auto; }
.rail button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; padding: 9px 10px; margin-bottom: 2px; color: var(--ink); }
.rail button .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); font-size: 12px; color: var(--muted); flex: none; }
.rail button.done .n { background: var(--ok); color: #fff; }
.rail button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rail button.on .n { background: var(--accent); color: #fff; }
.rail .tip { margin: 14px 8px 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.stage { overflow: auto; padding: 18px 22px 30px; }
.stage h2 { font-size: 18px; }
.stage .lead { color: var(--muted); margin: 4px 0 14px; max-width: 760px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.bar .grow { flex: 1; }

/* 画布 */
.canvas { position: relative; background: #fbf9f5; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.canvas svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.canvas .tools { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2; }
.canvas .tools button { background: rgba(255,255,255,.95); box-shadow: 0 1px 4px rgba(0,0,0,.12); padding: 5px 10px; font-size: 13px; }
.canvas .tools button.on { background: var(--accent); color: #fff; }
.canvas .hint { position: absolute; bottom: 10px; left: 10px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.9); padding: 3px 8px; border-radius: 6px; }
.room-name { fill: #2b2723; font-weight: 600; pointer-events: none; }
.fur-label { fill: #4a443d; pointer-events: none; }
.wall.clickable { cursor: pointer; }
.wall.clickable:hover { stroke: var(--accent); stroke-width: 40; }
.circle-box { fill: rgba(200,85,61,.08); stroke: #c8553d; stroke-width: 30; stroke-dasharray: 90 50; }

/* 上传 */
.drop { border: 2px dashed #cfc6b9; border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); background: var(--panel); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--accent); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumbs img { height: 220px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* 稿 */
.drafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.draft { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: .15s; }
.draft:hover { border-color: var(--accent); }
.draft.picked { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.draft .mini { height: 230px; background: #fbf9f5; }
.draft .mini svg { width: 100%; height: 100%; }
.draft .body { padding: 10px 12px; }
.draft .body b { font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--accent-soft); color: var(--accent); }

/* 调稿 */
.adjust { display: grid; grid-template-columns: 1fr 360px; gap: 14px; height: calc(100vh - 56px - 120px); min-height: 520px; }
.adjust .canvas { height: 100%; }
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.panel h3 { font-size: 14px; margin-bottom: 6px; }
.versions { display: flex; flex-wrap: wrap; gap: 6px; }
.versions button { padding: 4px 10px; font-size: 12px; }
.chat { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.msg { padding: 8px 11px; border-radius: 10px; max-width: 95%; line-height: 1.6; font-size: 13px; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; }
.msg.ai { align-self: flex-start; background: var(--chip); }
.compose textarea { min-height: 64px; }
.rule-offer { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 10px; font-size: 13px; }
.issues { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.issues li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.issues li.warn::before { content: "⚠ "; color: var(--warn); }
.issues li.ok::before { content: "✓ "; color: var(--ok); }

/* 抽屉 */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 30; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.08); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow: auto; padding: 14px 16px; }
.rule { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.rule.off { opacity: .5; }
.rule .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rule textarea { min-height: 52px; }
.cat { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 40; max-width: 80vw; }
.toast.err { background: var(--accent); }
.loading { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.loading::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.soon { max-width: 760px; margin: 40px auto; }
.soon ol { line-height: 2; }
.guide h3 { margin: 16px 0 6px; font-size: 15px; }
.guide li { margin: 4px 0; }
@media (max-width: 1000px) {
  .step1 { grid-template-columns: 1fr; height: auto; }
  .rail { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail button { width: auto; white-space: nowrap; }
  .rail .tip { display: none; }
  .adjust { grid-template-columns: 1fr; height: auto; }
  .adjust .canvas { height: 60vh; }
  .steps button { padding: 6px 8px; font-size: 12px; }
}
.side .check { flex: 0 1 auto; max-height: 38%; overflow: auto; }
.side .panel { flex-shrink: 0; }
.side .chat, .side .check { flex-shrink: 1; }

/* 第二步 */
h3.sec { font-size: 15px; margin: 22px 0 8px; }
.face-main { display: grid; grid-template-columns: 1fr 470px; gap: 12px; height: 560px; }
.face-main .canvas { height: 100%; }
.plist { overflow: auto; min-height: 0; }
.ptable { display: grid; gap: 6px; }
.prow { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.prow.on { border-color: var(--accent); background: var(--accent-soft); }
.prow input, .prow select { padding: 4px 6px; font-size: 13px; }
.prow input.c { width: 62px; }
.refs { display: grid; gap: 10px; }
.ref { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.ref img { width: 100%; height: 170px; object-fit: cover; border-radius: 6px; }
.ref-body { display: grid; gap: 8px; }
.ref .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ref-drop { display: grid; place-items: center; padding: 18px; text-align: center; }
@media (max-width: 700px) { .ref { grid-template-columns: 1fr; } }
.ref input { padding: 5px 8px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { padding: 2px 8px; font-size: 12px; border-radius: 999px; }
.round { margin: 12px 0 16px; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-top: 6px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile img { width: 100%; display: block; cursor: zoom-in; background: #eee; }
.tile .bar { margin: 6px 8px; }
.tile.final { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.tile.base { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tile.wait, .tile.fail { min-height: 170px; display: grid; place-items: center; padding: 10px; }
.composer { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; border-color: var(--accent); }
.composer > .markwrap { width: 380px; position: relative; flex: none; }
.markwrap img { width: 100%; border-radius: 8px; display: block; }
.markcv { position: absolute; left: 0; top: 0; pointer-events: none; border-radius: 8px; }
.markcv.on { pointer-events: auto; cursor: crosshair; outline: 2px dashed #e01b1b; }
.sw { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 18, 16, .82); z-index: 50; display: grid; place-items: center; }
.lb-inner { max-width: 94vw; max-height: 94vh; display: grid; gap: 8px; }
.lb-stack { position: relative; }
.lb-stack img { max-width: 94vw; max-height: 86vh; display: block; border-radius: 6px; }
.lb-stack img.over { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.lb-bar { color: #fff; justify-content: center; }
@media (max-width: 1000px) { .face-main { grid-template-columns: 1fr; height: auto; } .face-main .canvas { height: 60vh; } .composer { flex-direction: column; } .composer > .markwrap { width: 100%; } }
.top button, .brand, .cost { white-space: nowrap; }
@media (max-width: 760px) {
  .top { height: auto; flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  .crumb { display: none; }
  .steps { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .steps button { white-space: nowrap; }
  .right { gap: 2px; }
}

/* 报价单 */
.qwrap { overflow: auto; margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.qt { border-collapse: collapse; width: 100%; font-size: 13px; }
.qt th, .qt td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap; }
.qt th { background: #dcebfa; position: sticky; top: 0; }
.qt td.nm { text-align: left; white-space: normal; min-width: 180px; }
.qt td.ds { text-align: left; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.qt input { width: 74px; padding: 3px 5px; font-size: 13px; text-align: right; }
.qt tr.qsec td { background: #dcebfa; text-align: left; font-weight: 600; }
.qt tr.zero { color: #b9b2a8; }
.qsum { margin-top: 10px; max-width: 640px; }
.qsum td:first-child { text-align: left; }
.qt tr.qtotal td { font-size: 16px; font-weight: 700; background: var(--accent-soft); }
.card.arch { opacity: .55; }
.btnlink { text-decoration: none; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.btnlink:hover { color: var(--ink); background: var(--chip); }
/* 深化方案表：长文字要换行（.qt 默认不换行，是给报价表用的） */
.qt.scheme-rooms td { white-space: normal; text-align: left; vertical-align: top; line-height: 1.55; padding: 6px 8px; overflow-wrap: anywhere; }
.qt.scheme-rooms td:first-child { text-align: center; font-weight: 600; }

/* 板块行里的“一拆二 / 复制 / 合并”：做成看得见的小按钮 */
.ptools button { border: 1px solid #cfc6b8; background: #fff; border-radius: 6px; padding: 3px 12px; color: #3b352e; font-size: 13px; }
.ptools button:hover { border-color: #c8553d; color: #c8553d; }
.pdim input.d { width: 64px; }
.pchip { cursor: pointer; background: var(--chip, #efe9e0); display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; }
.pchip .px { color: #9a948b; font-weight: 400; padding: 0 5px; border-radius: 999px; }
.pchip .px:hover { background: #c8553d; color: #fff; }
.askbox:empty { display: none; }
.askcard { border: 1px solid #e3c9a8; background: #fffaf2; border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; margin-top: 4px; }
.askq .chips { margin-top: 4px; gap: 6px; }
.askq .chip { font-size: 13px; padding: 4px 10px; }
.lockbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; padding: 6px 8px; border-radius: 6px; background: #f6f2ec; font-size: 13px; }
.lockbar.on { background: #eef4ec; color: #35593a; }
.plist.locked .prow input:not(.pn), .plist.locked .prow select:not(.pm), .plist.locked .prow button, .plist.locked .addp { pointer-events: none; opacity: .55; }
.eref-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.eref { display: inline-flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.eref img { height: 70px; border-radius: 6px; }
.eref select { font-size: 12px; padding: 2px 4px; }

.askcard .asknote { background: #fff4d6; border: 1px solid #f0c36d; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; font-weight: 600; }
.askcard .asknote button { margin-left: 6px; }

.palette { border: 1px solid #e3c9a8; background: #fffaf2; border-radius: 8px; padding: 8px 10px; margin: 6px 0 8px; display: grid; gap: 6px; }
.pslot { display: flex; align-items: center; gap: 6px; }
.pslot .sw { width: 18px; height: 18px; border-radius: 4px; border: 1px solid #0002; flex: none; }
.pslot .lk { flex: 1; min-width: 0; }
.pslot .pref { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; cursor: pointer; }
