:root {
  --bg: #f8f7f4; --card: #ffffff; --line: #e6e3dc; --line2: #f0eee9;
  --ink: #1d1c1a; --ink2: #55524c; --ink3: #8d8a82;
  --accent: #1d4f7c; --accent-soft: #eaf1f7; --accent-ink: #163d60;
  --ok: #2f7d57; --ok-soft: #e7f3ec; --warn: #a8690f; --warn-soft: #fbf1dd;
  --bad: #b23a2e; --bad-soft: #fbeae7; --info: #2c62a3; --info-soft: #e8f0fa; --mute-soft: #f1efea;
  --radius: 10px; --shadow: 0 1px 2px rgba(30, 28, 24, .04), 0 6px 20px rgba(30, 28, 24, .05);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #cfe0ef; }

/* ---------- 布局 ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; height: 100vh; }
.nav { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 12px 12px; overflow-y: auto; }
.brand { padding: 0 10px 18px; border-bottom: 1px solid var(--line2); margin-bottom: 12px; }
.brand b { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.35; letter-spacing: .5px; }
.brand span { font-size: 12px; color: var(--ink3); }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink2); margin-bottom: 2px; }
.nav a.item:hover { background: var(--mute-soft); text-decoration: none; color: var(--ink); }
.nav a.item.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a.item i { width: 18px; text-align: center; font-style: normal; opacity: .8; }
.nav .grow { flex: 1; }
.nav .who { border-top: 1px solid var(--line2); padding: 12px 10px 4px; font-size: 13px; }
.nav .who b { display: block; }
.nav .who span { color: var(--ink3); font-size: 12px; }
.nav .who .row { margin-top: 8px; gap: 12px; }
.demo-tag { margin: 0 10px 10px; padding: 4px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 12px; text-align: center; }
.main { overflow-y: auto; min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 60px; }
.page.wide { max-width: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-family: var(--serif); font-size: 26px; letter-spacing: .5px; }
.head .sub { color: var(--ink3); font-size: 13px; margin-top: 4px; }
.crumb { font-size: 13px; color: var(--ink3); margin-bottom: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--ink3); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- 组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.card.link { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: #c9c4b8; transform: translateY(-1px); }
.section { margin-top: 26px; }
.section > h2 { font-family: var(--serif); font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.section > h2 .count { font-family: var(--sans); font-size: 12px; color: var(--ink3); font-weight: 400; }
.empty { padding: 28px; text-align: center; color: var(--ink3); border: 1px dashed var(--line); border-radius: var(--radius); background: transparent; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--mute-soft); border-color: #cfcabd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #e4b9b3; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--mute-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; background: var(--mute-soft); color: var(--ink2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: var(--info-soft); color: var(--info); }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c9c5bb; }
.dot.ok { background: var(--ok); } .dot.warn { background: #d49a2a; } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
table.tb { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.tb th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink2); background: #faf9f6; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tb td { padding: 9px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.tb tr:last-child td { border-bottom: none; }
table.tb tr.click { cursor: pointer; }
table.tb tr.click:hover td { background: #fbfaf7; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: none; background: none; padding: 9px 14px; cursor: pointer; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink3); } .kv dd { margin: 0; }
.stat { text-align: left; }
.stat b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.2; }
.stat span { color: var(--ink3); font-size: 12.5px; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--info-soft); color: #264a78; font-size: 13px; }
.note.warn { background: var(--warn-soft); color: #7a4d0b; } .note.bad { background: var(--bad-soft); color: #8a2c23; } .note.ok { background: var(--ok-soft); color: #23603f; }
pre.code, code.code { font-family: var(--mono); font-size: 12.5px; background: #f4f2ed; border: 1px solid var(--line); border-radius: 6px; }
pre.code { padding: 10px 12px; overflow-x: auto; margin: 6px 0; white-space: pre-wrap; word-break: break-all; }
code.code { padding: 1px 5px; }

/* ---------- 表单与弹窗 ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: 12.5px; color: var(--ink2); }
.field .hint { font-size: 12px; color: var(--ink3); }
.input, select.input, textarea.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; }
textarea.input { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 79, 124, .12); }
.input.sm { height: 28px; padding: 0 8px; font-size: 13px; border-radius: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.mask { position: fixed; inset: 0; background: rgba(28, 26, 22, .34); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 100; overflow-y: auto; }
.dialog { width: 480px; max-width: 100%; background: var(--card); border-radius: 12px; box-shadow: 0 20px 60px rgba(20, 18, 14, .25); }
.dialog.wide { width: 760px; } .dialog.xl { width: 980px; }
.dialog > header { padding: 16px 20px 0; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.dialog > .body { padding: 14px 20px 4px; max-height: 68vh; overflow-y: auto; }
.dialog > footer { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.dialog .err { color: var(--bad); font-size: 13px; margin: 4px 0 8px; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { padding: 10px 14px; border-radius: 8px; background: #23211e; color: #fff; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 380px; animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login.over { position: fixed; inset: 0; z-index: 200; background: var(--bg); }
.login .intro { padding: 12vh 8vw; background: linear-gradient(160deg, #f1ede4 0%, #e8eef3 100%); border-right: 1px solid var(--line); }
.login .intro h1 { font-family: var(--serif); font-size: 36px; line-height: 1.35; letter-spacing: 1px; }
.login .intro p { color: var(--ink2); max-width: 460px; margin-top: 16px; font-size: 15px; }
.login .intro .chain { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink2); font-size: 13px; }
.login .intro .chain span { padding: 5px 12px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); border-radius: 16px; }
.login .intro .chain em { font-style: normal; color: var(--ink3); }
.login .panel { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 340px; }
.login form h2 { font-family: var(--serif); font-size: 22px; margin-bottom: 20px; }

/* ---------- 流水线与状态 ---------- */
.pipe { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.pipe .stage { flex: 1 1 0; min-width: 150px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; position: relative; transition: border-color .12s, box-shadow .12s; }
.pipe .stage:hover { border-color: #c9c4b8; }
.pipe .stage.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 79, 124, .1); }
.pipe .stage .no { font-size: 11px; color: var(--ink3); }
.pipe .stage b { display: block; font-size: 14.5px; margin: 1px 0 4px; }
.pipe .stage .who { font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe .stage .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--ink3); }
.pipe .stage.mine::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.steps { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.steps .s { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; background: var(--mute-soft); color: var(--ink2); }
.steps .s.mine { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.st-todo { background: var(--mute-soft) !important; color: var(--ink3) !important; }
.st-doing { background: var(--info-soft) !important; color: var(--info) !important; }
.st-review { background: var(--warn-soft) !important; color: var(--warn) !important; }
.st-rework { background: var(--bad-soft) !important; color: var(--bad) !important; }
.st-done { background: var(--ok-soft) !important; color: var(--ok) !important; }
.lstate { display: flex; align-items: center; gap: 0; font-size: 12px; }
.lstate span { padding: 3px 10px; background: var(--mute-soft); color: var(--ink3); border-right: 1px solid #fff; }
.lstate span:first-child { border-radius: 11px 0 0 11px; } .lstate span:last-child { border-radius: 0 11px 11px 0; border-right: none; }
.lstate span.past { background: var(--ok-soft); color: var(--ok); }
.lstate span.now { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 项目工坊 ---------- */
.studio { display: flex; flex-direction: column; height: 100vh; }
.studio .top { padding: 14px 24px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.studio .top h1 { font-family: var(--serif); font-size: 20px; }
.studio .people { display: flex; gap: 6px; flex-wrap: wrap; }
.person { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 4px; border: 1px solid var(--line); border-radius: 13px; font-size: 12.5px; background: #fff; }
.person .av { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.person.on .av { background: var(--ok); color: #fff; }
.person small { color: var(--ink3); }
.studio .strip { padding: 12px 24px 6px; }
.studio .work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 8px 24px 20px; }
.studio .work > .left { overflow-y: auto; min-width: 0; padding-right: 2px; }
.studio .work > .right { overflow-y: auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.files { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.files .f { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line2); }
.files .f:last-child { border-bottom: none; }
.files .f:hover { background: #fbfaf7; }
.files .f .ic { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; letter-spacing: .3px; }
.files .f .nm { flex: 1; min-width: 0; cursor: pointer; }
.files .f .nm b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files .f .nm span { font-size: 12px; color: var(--ink3); }
.files .f .act { display: flex; gap: 2px; opacity: .25; transition: opacity .12s; }
.files .f:hover .act { opacity: 1; }
.ic.k-doc { background: #5b7fa6; } .ic.k-board { background: #c0703a; } .ic.k-scene { background: #3f8f7a; } .ic.k-twin { background: #7559a8; }
.ic.k-code { background: #556070; } .ic.k-img { background: #b0902f; } .ic.k-bin { background: #9a968d; }
.feed { font-size: 13px; }
.feed .e { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.feed .e:last-child { border-bottom: none; }
.feed .e .t { color: var(--ink3); font-size: 12px; white-space: nowrap; }
.feed .e .via { font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--mute-soft); color: var(--ink2); margin-left: 4px; }
.feed .e.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #fff6d6; } to { background: transparent; } }

/* ---------- 编辑器宿主 ---------- */
.ehost { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; }
.ehost .bar { height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.ehost .bar .path { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ehost .bar .path span { color: var(--ink3); font-weight: 400; }
.ehost .banner { flex: none; padding: 8px 14px; background: var(--warn-soft); color: #7a4d0b; font-size: 13px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #ecd9ae; }
.ehost iframe { flex: 1; border: none; width: 100%; background: #fff; }
.ehost .viewer { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 20px; }
.ehost .viewer img { max-width: 100%; max-height: 100%; box-shadow: var(--shadow); background: #fff; }

@media (max-width: 1100px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio .work { grid-template-columns: 1fr; }
  .studio .work > .right { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  .login { grid-template-columns: 1fr; } .login .intro { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .page { padding: 18px 14px 40px; }
}
