/* 铝构家 · 铝型材家具设计软件 v1.0
   界面样式：深色工作台 + 暖橙强调色 */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0b0c0d;
  --bg-2: #101112;
  --panel: #161718;
  --panel-2: #1c1d1e;
  --panel-3: #232425;
  --line: rgba(255,255,255,.075);
  --line-2: rgba(255,255,255,.14);
  --text: #ecebe8;
  --text-2: #a8a6a1;
  --text-3: #71706c;
  --accent: #f0a35e;
  --accent-hi: #f6bd8a;
  --accent-lo: #dc8a42;
  --accent-soft: rgba(240,163,94,.12);
  --good: #83c08e;
  --warn: #e2b25e;
  --bad: #e0796a;
  --canvas: radial-gradient(120% 90% at 50% 0%, #191a1b 0%, #101112 55%, #0b0c0d 100%);
  --grid-line: rgba(255,255,255,.055);
  --glass: rgba(22,23,24,.86);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.3);
  --shadow-md: 0 14px 38px rgba(0,0,0,.42);
  --shadow-lg: 0 34px 90px rgba(0,0,0,.62);
  --radius: 10px;
  --header-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html[data-theme="light"] {
  --bg: #f3f1ec;
  --bg-2: #f7f5f0;
  --panel: #ffffff;
  --panel-2: #f7f6f2;
  --panel-3: #eeebe4;
  --line: rgba(30,26,20,.1);
  --line-2: rgba(30,26,20,.18);
  --text: #1d1b18;
  --text-2: #615d56;
  --text-3: #928d84;
  --accent: #e08c43;
  --accent-hi: #f0aa6d;
  --accent-lo: #c9762e;
  --accent-soft: rgba(224,140,67,.13);
  --good: #3f8f52;
  --warn: #a97a1e;
  --bad: #b8503f;
  --canvas: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f6f4ef 55%, #eeece6 100%);
  --grid-line: rgba(40,34,26,.09);
  --glass: rgba(255,255,255,.9);
  --shadow-sm: 0 2px 10px rgba(60,48,30,.08);
  --shadow-md: 0 14px 38px rgba(60,48,30,.12);
  --shadow-lg: 0 34px 90px rgba(60,48,30,.2);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(140,134,124,.3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,134,124,.5); }
::-webkit-scrollbar-track { background: transparent; }

.boot {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 10px;
  text-align: center; background: var(--bg);
}
.boot-logo { font-size: 26px; font-weight: 800; letter-spacing: .12em; }
.boot-sub { font-size: 10px; letter-spacing: .3em; color: var(--text-3); }
.boot-bar { width: 160px; height: 2px; background: var(--line); margin: 16px auto 0; overflow: hidden; border-radius: 2px; }
.boot-bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: boot 1.1s ease infinite; }
@keyframes boot { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }

.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 13px; height: 13px; }
.ico-lg { width: 19px; height: 19px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  display: flex; align-items: center; z-index: 40;
  padding-right: 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--line);
}
.logo { width: 208px; padding-left: 20px; display: flex; flex-direction: column; gap: 1px; flex: none; }
.logo-name { font-size: 19px; font-weight: 800; letter-spacing: .12em; line-height: 1.1; }
.logo-sub { font-size: 9px; letter-spacing: .14em; color: var(--text-3); }
.topbar-tools { display: flex; align-items: center; gap: 2px; }
.tbtn {
  height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  transition: background .16s, color .16s;
}
.tbtn:hover { background: rgba(128,124,116,.14); color: var(--text); }
.tbtn .caret { width: 10px; height: 10px; opacity: .7; }
.tbtn.icon-only { padding: 0 8px; }
.tbtn[disabled] { opacity: .32; pointer-events: none; }
.save-group { position: relative; display: flex; align-items: center; }
.save-group .tbtn.icon-only { width: 24px; padding: 0 4px; }
.nav-rail.collapsed { width: 64px; }
.nav-rail.collapsed .nav-head { justify-content: center; padding: 12px 0; }
.nav-rail.collapsed .nav-head > span,
.nav-rail.collapsed .nav-group,
.nav-rail.collapsed .nav-item .txt { display: none; }
.nav-rail.collapsed .nav-item { width: 48px; margin: 2px auto; padding: 0; justify-content: center; }
.nav-rail.collapsed .nav-item.active::before { display: none; }
.vsep { width: 1px; height: 20px; background: var(--line); margin: 0 8px; }
.proj-info {
  margin-left: 16px; font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.proj-info b { color: var(--text-2); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.rtool {
  border: 0; background: transparent; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 8px; font-size: 9px; letter-spacing: .04em;
  transition: color .16s, background .16s;
}
.rtool:hover { color: var(--text); background: rgba(128,124,116,.12); }
.rtool .ico { width: 18px; height: 18px; }
.rtool.on { color: var(--accent); }
.account-pill {
  margin-left: 8px; height: 32px; padding: 0 12px 0 4px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--panel);
  display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2);
  max-width: 150px;
}
.account-pill:hover { border-color: rgba(240,163,94,.5); color: var(--text); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #3a3b3c, #232425); color: var(--accent);
  font-size: 9.5px; font-weight: 700; flex: none; border: 1px solid var(--line-2);
}
.account-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 190px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px; display: none;
}
.menu.open { display: block; animation: pop .14s ease; }
.menu button {
  width: 100%; border: 0; background: transparent; text-align: left; color: var(--text-2);
  font-size: 12px; padding: 9px 10px; border-radius: 6px; display: flex; align-items: center; gap: 9px;
}
.menu button:hover { background: var(--panel-2); color: var(--text); }
.menu .divider { height: 1px; background: var(--line); margin: 5px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------------- 工作区 ---------------- */
.workspace {
  position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; padding: 6px 8px 8px; background: var(--bg);
}
.nav-rail {
  width: 208px; flex: none; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow-y: auto; overflow-x: hidden; padding-bottom: 12px;
}
.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 14px 8px 16px; font-size: 11.5px; font-weight: 600; color: var(--text);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.nav-collapse { border: 0; background: transparent; color: var(--text-3); padding: 3px; border-radius: 5px; }
.nav-collapse:hover { background: var(--panel-2); color: var(--text); }
.nav-group { padding: 15px 16px 5px; font-size: 9px; letter-spacing: .12em; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 37px; margin: 1px 8px; padding: 0 11px;
  border: 0; background: transparent; border-radius: 7px; color: var(--text-2);
  font-size: 12px; text-align: left; width: calc(100% - 16px); position: relative;
  transition: background .15s, color .15s;
}
.nav-item .ico { color: var(--text-3); transition: color .15s; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item:hover .ico { color: var(--text-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hi); }
.nav-item.active .ico { color: var(--accent); }
.nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 2px;
  border-radius: 2px; background: var(--accent);
}
.nav-item .tag { margin-left: auto; font-size: 8.5px; color: var(--accent); border: 1px solid rgba(240,163,94,.35); padding: 1px 4px; border-radius: 4px; }

.viewport {
  position: relative; flex: 1; min-width: 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--canvas);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.viewport::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 70% at 50% 45%, transparent 55%, rgba(0,0,0,.22) 100%);
}
html[data-theme="light"] .viewport::after { background: radial-gradient(80% 70% at 50% 45%, transparent 55%, rgba(120,105,80,.08) 100%); }
.scene-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: 10.5px; color: var(--text-3); background: var(--glass); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 20px; backdrop-filter: blur(10px); z-index: 3;
  pointer-events: none; white-space: nowrap;
}
.scene-hint b { color: var(--accent); font-weight: 500; }

.viewcube-wrap { position: absolute; top: 18px; right: 20px; z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vc-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--glass); backdrop-filter: blur(8px); color: var(--text-2);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.vc-btn:hover { color: var(--accent); border-color: rgba(240,163,94,.45); }
.cube-scene { width: 92px; height: 92px; perspective: 420px; display: grid; place-items: center; }
.cube {
  position: relative; width: 52px; height: 52px; transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(38deg); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.cube .face {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 9px; color: #5f5b53; background: linear-gradient(145deg, #fbfaf7, #e8e5de);
  border: 1px solid rgba(0,0,0,.12); cursor: pointer; user-select: none; backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.cube .front { transform: translateZ(26px); }
.cube .back { transform: rotateY(180deg) translateZ(26px); }
.cube .left { transform: rotateY(-90deg) translateZ(26px); }
.cube .right { transform: rotateY(90deg) translateZ(26px); }
.cube .top { transform: rotateX(90deg) translateZ(26px); }
.cube .bottom { transform: rotateX(-90deg) translateZ(26px); }
.cube .face:hover { color: #c9762e; }
.shortcut-card {
  position: absolute; right: 18px; bottom: 16px; width: 272px; max-height: calc(100% - 150px);
  overflow-y: auto; z-index: 5; padding: 12px 14px 14px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(14px); box-shadow: var(--shadow-md);
}
.shortcut-card.collapsed .sc-body { display: none; }
body.tool-open .shortcut-card { display: none; }
body.tool-open .measure-pill { right: 348px; }
.sc-head {
  display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent;
  width: 100%; padding: 0 0 8px; color: var(--accent); font-size: 10px; letter-spacing: .02em;
}
.sc-body { border-top: 1px solid var(--line); padding-top: 8px; }
.sc-group { font-size: 9.5px; color: var(--text-3); margin: 10px 0 4px; letter-spacing: .03em; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; font-size: 10px; color: var(--text-2); }
.sc-row span { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.kbd {
  font-size: 9px; line-height: 1.2; padding: 3px 5px; border-radius: 4px; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.sc-foot { margin-top: 10px; font-size: 9px; color: var(--text-3); border-top: 1px solid var(--line); padding-top: 7px; }
.measure-pill {
  position: absolute; right: 300px; bottom: 18px; z-index: 5; height: 34px;
  display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; border-radius: 18px;
  border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(10px);
  color: var(--text-2); font-size: 11px; box-shadow: var(--shadow-sm);
}
.measure-pill:hover, .measure-pill.on { color: var(--accent); border-color: rgba(240,163,94,.45); }

/* ---------------- 操作台 ---------------- */
.tool-panel {
  position: absolute; top: 16px; right: 16px; width: 322px; z-index: 8;
  max-height: calc(100% - 32px); overflow-y: auto;
  background: var(--glass); border: 1px solid var(--line-2); border-radius: 12px;
  backdrop-filter: blur(18px); box-shadow: var(--shadow-lg);
  padding: 16px 16px 14px;
  animation: panelIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes panelIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.tp-group { font-size: 9px; letter-spacing: .12em; color: var(--text-3); }
.tp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tp-head h2 { margin: 3px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.tp-close { border: 0; background: transparent; color: var(--text-3); padding: 4px; border-radius: 5px; }
.tp-close:hover { background: var(--panel-2); color: var(--text); }
.tp-section { border-top: 1px solid var(--line); padding: 13px 0; }
.tp-section:first-of-type { border-top: 0; padding-top: 0; }
.tp-label { font-size: 10px; color: var(--text-3); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.tp-label b { color: var(--text-2); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field > label { font-size: 10.5px; color: var(--text-2); }
.field .hint { font-size: 9.5px; color: var(--text-3); line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.input, select.input, textarea.input {
  width: 100%; height: 34px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); padding: 0 10px; font-size: 11.5px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 9px 10px; resize: vertical; }
.input:hover { border-color: var(--line-2); }
.input:focus { border-color: rgba(240,163,94,.65); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-unit { position: relative; }
.input-unit .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--text-3); }
.input-unit .input { padding-right: 30px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 14px) 15px, calc(100% - 10px) 15px; background-size: 4px 4px; background-repeat: no-repeat; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button {
  flex: 1; height: 28px; border: 0; background: transparent; color: var(--text-3);
  font-size: 10.5px; border-radius: 5px; white-space: nowrap;
}
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.seg button:hover { color: var(--text-2); }
.preview-box {
  border: 1px solid var(--line); border-radius: 8px; background: var(--canvas);
  height: 132px; position: relative; overflow: hidden;
}
.preview-box canvas { width: 100%; height: 100%; display: block; }
.preview-cap { position: absolute; left: 10px; bottom: 8px; font-size: 9px; color: var(--text-3); }
.preview-tag { position: absolute; right: 8px; top: 8px; font-size: 8.5px; color: var(--accent); border: 1px solid rgba(240,163,94,.3); padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.2); }
.tp-actions { margin-top: 6px; display: flex; flex-direction: column; gap: 7px; }
.tp-note { font-size: 9.5px; color: var(--text-3); line-height: 1.55; }
.tp-teach {
  border: 0; background: transparent; color: var(--text-3); font-size: 10px;
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 0;
}
.tp-teach:hover { color: var(--accent); }
.stat-row { display: flex; justify-content: space-between; font-size: 10.5px; padding: 4px 0; color: var(--text-3); }
.stat-row b { color: var(--text); font-weight: 600; }
.obj-list { display: flex; flex-direction: column; gap: 5px; max-height: 180px; overflow: auto; }
.obj-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 7px;
  border: 1px solid transparent; background: var(--panel-2); font-size: 11px; color: var(--text-2);
}
.obj-item:hover { border-color: var(--line-2); }
.obj-item.on { border-color: rgba(240,163,94,.5); background: var(--accent-soft); color: var(--text); }
.obj-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-item .meta { margin-left: auto; font-size: 9px; color: var(--text-3); }

/* ---------------- 通用控件 ---------------- */
.btn {
  height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text); font-size: 11.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #f5b884, #e8944f); border-color: transparent;
  color: #241708; font-weight: 600; box-shadow: 0 6px 18px rgba(232,148,79,.22);
}
.btn.primary:hover { background: linear-gradient(180deg, #f8c493, #ea9b58); }
.btn.dark { background: #242526; border-color: #343536; color: #f3f1ec; }
.btn.ghost { border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--bad); border-color: rgba(224,121,106,.32); }
.btn.danger:hover { background: rgba(224,121,106,.1); }
.btn.block { width: 100%; }
.btn.lg { height: 42px; font-size: 12.5px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 10.5px; border-radius: 6px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line);
  background: transparent; color: var(--text-2); display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; color: var(--text-2); }
.switch input { display: none; }
.switch i {
  width: 32px; height: 18px; border-radius: 10px; background: var(--panel-3); position: relative;
  transition: background .18s; border: 1px solid var(--line-2);
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #b9b5ad; transition: transform .18s, background .18s;
}
.switch input:checked + i { background: var(--accent); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(14px); background: #231708; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 14px; font-size: 10px; color: var(--text-2);
  background: transparent;
}
.chip:hover { border-color: rgba(240,163,94,.45); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: rgba(240,163,94,.55); color: var(--accent-hi); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px;
  border-radius: 4px; font-size: 9px; background: var(--panel-3); color: var(--text-2);
}
.badge.good { background: rgba(131,192,142,.12); color: var(--good); }
.badge.warn { background: rgba(226,178,94,.12); color: var(--warn); }
.badge.bad { background: rgba(224,121,106,.12); color: var(--bad); }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.muted { color: var(--text-3); }
.small { font-size: 10px; }
.tiny { font-size: 9px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------------- 弹窗 / 提示 ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(8,8,8,.58); backdrop-filter: blur(7px); padding: 24px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  width: 440px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2); border-radius: 14px; padding: 24px;
  box-shadow: var(--shadow-lg); animation: rise .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.dialog-head p { margin: 4px 0 0; font-size: 10.5px; color: var(--text-3); }
.dialog-close { border: 0; background: transparent; color: var(--text-3); padding: 4px; border-radius: 5px; }
.dialog-close:hover { background: var(--panel-3); color: var(--text); }
.dialog-actions { display: flex; gap: 8px; margin-top: 20px; }
.dialog-actions .btn { flex: 1; }
.dialog.wide { width: 720px; }
.dialog.xwide { width: 920px; }
.form-error {
  margin-top: 10px; font-size: 10.5px; color: var(--bad); background: rgba(224,121,106,.08);
  border: 1px solid rgba(224,121,106,.24); border-radius: 6px; padding: 8px 10px;
}
.form-ok { color: var(--good); background: rgba(131,192,142,.08); border-color: rgba(131,192,142,.24); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  border: 0; background: transparent; color: var(--text-3); font-size: 11.5px; padding: 9px 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; }
.code-row .btn { width: 104px; flex: none; font-size: 10.5px; }

.toast-stack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 460px;
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px;
  box-shadow: var(--shadow-lg); animation: toastIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast .ti { color: var(--accent); margin-top: 1px; }
.toast.error .ti { color: var(--bad); }
.toast.success .ti { color: var(--good); }
.toast .tt { font-size: 11.5px; color: var(--text); font-weight: 500; }
.toast .td { font-size: 10px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.toast .tx { margin-left: auto; border: 0; background: transparent; color: var(--text-3); padding: 2px; }

.teach-modal { width: min(960px, calc(100vw - 48px)); }
.teach-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 26px; }
.teach-visual { border-radius: 10px; background: radial-gradient(circle at 50% 30%, #37342f, #201f1d); min-height: 340px; display: grid; place-items: center; padding: 22px; position: relative; }
.teach-visual img { max-width: 100%; border-radius: 8px; }
.teach-steps { display: flex; flex-direction: column; gap: 8px; }
.teach-step { border: 1px solid var(--line); border-radius: 8px; padding: 12px 13px; background: var(--panel); }
.teach-step.on { border-color: rgba(240,163,94,.45); background: var(--accent-soft); }
.teach-step h4 { margin: 0 0 4px; font-size: 11px; display: flex; gap: 8px; align-items: center; }
.teach-step h4 span { color: var(--accent); font-variant-numeric: tabular-nums; }
.teach-step p { margin: 0; font-size: 10px; color: var(--text-3); line-height: 1.6; }

/* ---------------- 首页 / 欢迎 ---------------- */
.welcome {
  position: fixed; inset: 0; z-index: 50; background: #b7b3ac; overflow: hidden;
  color: #14130f;
}
.welcome-img {
  position: absolute; inset: 0; background: url('/assets/img/hero.jpg?v=2') center right / cover no-repeat;
  transform: scale(1.01);
}
.welcome::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(204,201,195,.97) 0%, rgba(203,200,194,.92) 32%, rgba(196,193,187,.42) 58%, rgba(180,177,171,.05) 78%);
}
html[data-theme="light"] .welcome::after {
  background: linear-gradient(90deg, rgba(244,241,235,.98) 0%, rgba(242,239,233,.94) 34%, rgba(236,232,225,.42) 60%, rgba(230,226,219,.05) 80%);
}
.welcome-head { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: flex-start; padding: 26px 34px; }
.welcome .logo-name { font-size: 24px; letter-spacing: .14em; color: #17150f; }
.welcome .logo-sub { color: rgba(23,21,15,.5); font-size: 10px; letter-spacing: .18em; }
.welcome-head .spacer { flex: 1; }
.welcome-tools { display: flex; align-items: center; gap: 4px; }
.welcome-tools .wtool {
  border: 0; background: transparent; color: rgba(23,21,15,.62); font-size: 9.5px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px;
}
.welcome-tools .wtool:hover { background: rgba(23,21,15,.06); color: #17150f; }
.welcome-tools .wtool .ico { width: 18px; height: 18px; }
.welcome-account {
  margin-left: 6px; display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
  background: #17150f; color: #f5f1e8; border: 0; border-radius: 6px; font-size: 10.5px; letter-spacing: .04em;
}
.welcome-account .avatar { width: 20px; height: 20px; margin-right: 7px; background: #2c2820; border-color: rgba(255,255,255,.14); }
.welcome-copy {
  position: relative; z-index: 2; padding: clamp(120px, 19vh, 210px) 0 0 8.5vw; max-width: 640px;
}
.welcome-kicker { font-size: 10px; letter-spacing: .34em; color: rgba(23,21,15,.5); margin-bottom: 18px; }
.welcome h1 {
  margin: 0; font-size: clamp(52px, 6.4vw, 86px); line-height: 1.02; letter-spacing: -.035em;
  font-weight: 900; color: #14120d;
}
.welcome h1 em { font-style: normal; color: #a25f24; }
.welcome p.lead { margin: 22px 0 0; font-size: clamp(13px, 1.2vw, 16px); color: rgba(23,21,15,.62); max-width: 420px; }
.welcome-cta { display: flex; align-items: center; gap: 12px; margin-top: 34px; }
.welcome-cta .btn { height: 50px; padding: 0 30px; font-size: 14px; border-radius: 8px; }
.welcome-cta .btn.primary { box-shadow: 0 14px 34px rgba(190,116,48,.3); }
.welcome-cta .btn.dark { background: #1c1a15; color: #f7f3ea; border-color: transparent; }
.welcome-cta .btn.dark:hover { background: #26231c; }
.welcome-note { margin-top: 22px; font-size: 10px; color: rgba(23,21,15,.42); letter-spacing: .04em; }
.welcome-foot {
  position: absolute; left: 34px; right: 34px; bottom: 22px; z-index: 3;
  display: flex; align-items: center; gap: 22px; font-size: 9.5px; color: rgba(23,21,15,.45);
}
.welcome-foot .spacer { flex: 1; }
html[data-theme="dark"] .welcome { color: #f2efe9; background: #101010; }
html[data-theme="dark"] .welcome::after { background: linear-gradient(90deg, rgba(15,15,15,.97) 0%, rgba(15,15,15,.9) 34%, rgba(15,15,15,.35) 62%, rgba(15,15,15,.05) 82%); }
html[data-theme="dark"] .welcome h1 { color: #f4f1ea; }
html[data-theme="dark"] .welcome h1 em { color: var(--accent); }
html[data-theme="dark"] .welcome p.lead { color: rgba(244,241,234,.62); }
html[data-theme="dark"] .welcome .logo-name { color: #f4f1ea; }
html[data-theme="dark"] .welcome .logo-sub { color: rgba(244,241,234,.45); }
html[data-theme="dark"] .welcome-tools .wtool { color: rgba(244,241,234,.6); }
html[data-theme="dark"] .welcome-tools .wtool:hover { color: #fff; background: rgba(255,255,255,.07); }
html[data-theme="dark"] .welcome-account { background: #242424; color: #f6f2ea; }
html[data-theme="dark"] .welcome-foot { color: rgba(244,241,234,.35); }
html[data-theme="dark"] .welcome-kicker { color: rgba(244,241,234,.4); }

/* ---------------- 页面通用（工程 / 清单 / 设置） ---------------- */
.page {
  position: fixed; inset: 0; z-index: 45; overflow-y: auto;
  background: var(--bg); animation: fade .18s ease;
}
.page-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 0 30px; height: var(--header-h); background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.page-head .logo { width: auto; padding: 0; }
.page-head .logo-name { font-size: 16px; }
.page-head .logo-sub { font-size: 8px; }
.page-back {
  height: 32px; border: 1px solid var(--line-2); border-radius: 7px; background: transparent;
  color: var(--text-2); font-size: 11px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
}
.page-back:hover { color: var(--text); background: var(--panel-2); }
.page-title { font-size: 12px; color: var(--text-2); margin-left: 4px; }
.page-head .spacer { flex: 1; }
.page-body { max-width: 1320px; margin: 0 auto; padding: 34px 30px 80px; }
.page-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.page-hero p { margin: 8px 0 0; font-size: 12px; color: var(--text-3); }
.page-hero .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-box { position: relative; width: 260px; }
.search-box .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box .input { padding-left: 32px; }
.section-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
}
.section-card + .section-card { margin-top: 14px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 14px; font-weight: 650; }
.section-title .sub { font-size: 10px; color: var(--text-3); }
.section-title .spacer { flex: 1; }

/* 工程卡片 */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s; cursor: pointer;
}
.project-card:hover { transform: translateY(-3px); border-color: rgba(240,163,94,.35); box-shadow: var(--shadow-md); }
.project-thumb { height: 176px; position: relative; background: var(--canvas); border-bottom: 1px solid var(--line); overflow: hidden; }
.project-thumb canvas, .project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb .pt-index { position: absolute; top: 10px; left: 12px; font-size: 9px; color: var(--text-3); letter-spacing: .1em; }
.project-thumb .pt-rev { position: absolute; top: 9px; right: 10px; font-size: 8.5px; color: var(--text-3); border: 1px solid var(--line); padding: 2px 5px; border-radius: 4px; background: var(--glass); }
.project-meta { padding: 13px 15px 14px; }
.project-meta h3 { margin: 0; font-size: 13px; font-weight: 600; }
.project-meta .pm-sub { margin-top: 5px; font-size: 9.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.project-card .pm-actions { display: flex; gap: 2px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 9px; }
.project-card .pm-actions button { border: 0; background: transparent; color: var(--text-3); font-size: 9.5px; padding: 3px 7px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; }
.project-card .pm-actions button:hover { background: var(--panel-2); color: var(--text); }
.empty-state { text-align: center; padding: 70px 20px; border: 1px dashed var(--line-2); border-radius: 12px; }
.empty-state .es-ico { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--text-3); }
.empty-state h3 { margin: 0 0 6px; font-size: 14px; }
.empty-state p { margin: 0 0 16px; font-size: 11px; color: var(--text-3); }

/* 清单 */
.bom-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-bottom: 18px; }
.bom-title h1 { margin: 6px 0 6px; font-size: 28px; font-weight: 800; }
.bom-title p { margin: 0; font-size: 10.5px; color: var(--text-3); line-height: 1.7; }
.bom-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; align-content: start; padding-top: 6px; }
.bom-meta div { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.bom-meta b { color: var(--text-2); font-weight: 500; }
.bom-tools { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bom-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; }
.bom-cat { padding: 8px 0 2px; display: flex; gap: 4px; flex-wrap: wrap; }
.bom-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bom-row { display: grid; grid-template-columns: 28px 1.6fr 1fr 70px 90px 90px; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.bom-row:last-child { border-bottom: 0; }
.bom-row.head { background: var(--panel-2); color: var(--text-3); font-size: 9.5px; letter-spacing: .04em; }
.bom-row.off { opacity: .45; }
.bom-name { font-weight: 500; }
.bom-spec { font-size: 9.5px; color: var(--text-3); margin-top: 2px; }
.bom-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.bom-check { width: 14px; height: 14px; accent-color: var(--accent); }
.bom-summary { display: flex; align-items: center; gap: 22px; padding: 16px 18px; margin-top: 14px; border: 1px solid rgba(240,163,94,.3); background: var(--accent-soft); border-radius: 10px; }
.bom-summary .bs-label { font-size: 10px; color: var(--text-3); }
.bom-summary .bs-val { font-size: 20px; font-weight: 700; color: var(--accent-hi); font-variant-numeric: tabular-nums; }
.bom-summary .spacer { flex: 1; }
.price-wait { color: var(--text-3); }
.inline-select { height: 28px; width: 82px; text-align: right; padding: 0 6px; }

/* 检查 */
.check-hero { display: flex; align-items: center; gap: 18px; padding: 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 14px; }
.check-ring { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 700; border: 3px solid var(--good); color: var(--good); flex: none; }
.check-ring .ico { width: 30px; height: 30px; stroke-width: 1.9; }
.check-ring.warn { border-color: var(--warn); color: var(--warn); }
.check-ring.bad { border-color: var(--bad); color: var(--bad); }
.check-item { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.check-item:last-child { border-bottom: 0; }
.check-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--text-3); flex: none; }
.check-ico.good { color: var(--good); }
.check-ico.warn { color: var(--warn); }
.check-ico.bad { color: var(--bad); }
.check-body h4 { margin: 0; font-size: 11.5px; font-weight: 550; }
.check-body p { margin: 3px 0 0; font-size: 10px; color: var(--text-3); line-height: 1.6; }

/* 渲染页 */
.render-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.render-stage { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--canvas); min-height: 540px; position: relative; display: grid; place-items: center; }
.render-stage img { max-width: 100%; max-height: 540px; display: block; }
.render-stage .rs-empty { color: var(--text-3); font-size: 11px; text-align: center; }

/* 设置页 */
.settings-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; align-items: start; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .sr-name { font-size: 11.5px; }
.setting-row .sr-desc { font-size: 9.5px; color: var(--text-3); margin-top: 3px; }
.setting-row .sr-control { flex: none; }

/* 账号页 */
.account-hero { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 16px; }
.account-hero .avatar { width: 52px; height: 52px; font-size: 18px; }
.account-hero h2 { margin: 0; font-size: 17px; }
.account-hero p { margin: 4px 0 0; font-size: 10.5px; color: var(--text-3); }

/* 教学 / 其他 */
.tips { font-size: 10px; color: var(--text-3); line-height: 1.7; border-left: 2px solid var(--line-2); padding-left: 10px; }
.settings-grid .seg button { min-width: 56px; }
.settings-grid select.input { width: 160px; }
.page-body .section-card .field:last-child { margin-bottom: 0; }
.teach-visual canvas { width: 100%; height: 340px; display: block; }

/* 响应式 */
@media (max-width: 1180px) {
  .logo { width: 176px; }
  .nav-rail { width: 184px; }
  .shortcut-card { width: 244px; }
  .measure-pill { right: 272px; }
  .tool-panel { width: 300px; }
  .proj-info { max-width: 150px; }
}
@media (max-width: 980px) {
  .shortcut-card { display: none; }
  .measure-pill { right: 18px; }
  .rtool span { display: none; }
  .proj-info { display: none; }
  .bom-hero, .render-layout, .settings-grid { grid-template-columns: 1fr; }
  .teach-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav-rail { width: 64px; }
  .nav-head { padding: 12px 0; justify-content: center; }
  .nav-head > span, .nav-group, .nav-item .txt, .nav-collapse { display: none; }
  .nav-item { justify-content: center; padding: 0; width: 48px; margin: 2px auto; }
  .logo { width: 130px; padding-left: 12px; }
  .logo-sub { display: none; }
  .topbar-tools .tbtn span { display: none; }
  .tool-panel { left: 72px; right: 12px; width: auto; }
}

