:root {
  --bg: #e4e1d8;
  --paper: #fbf9f4;
  --ink: #16181c;
  --muted: #5f635c;
  --line: #d8d3c6;
  --side: #12161c;
  --side-soft: #1c2430;
  --cream: #f3efe4;
  --accent: #b8923e;
  --accent-deep: #7c6124;
  --good: #1c6b48;
  --bad: #8e2438;
  --warn: #8a6230;
  --info: #2a3d6e;
  --shadow: 0 18px 40px rgba(18, 22, 28, 0.08);
  --serif: Palatino, "Palatino Linotype", "Songti SC", PMingLiU, serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(980px 420px at 100% -8%, rgba(184, 146, 62, 0.18), transparent 58%),
    radial-gradient(720px 380px at -12% 110%, rgba(76, 52, 130, 0.1), transparent 52%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 420px) 1fr; }
.login-side { background: var(--side); color: var(--cream); padding: 48px 36px; display: flex; flex-direction: column; justify-content: space-between; }
.mark { font-family: var(--serif); font-size: 42px; letter-spacing: 0.08em; }
.login-side p { line-height: 1.7; color: #e4dcc8; }
.flow-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.flow-line span { border: 1px solid rgba(246, 239, 228, 0.35); padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.login-main { padding: 36px; }
.login.sheet { grid-template-columns: 1fr; }
.login.sheet .login-main { max-width: 820px; margin: 0 auto; }
.login-main h1 { font-family: var(--serif); font-weight: 600; font-size: 32px; margin: 0 0 8px; }
.handbook-block { margin-top: 14px; }
.handbook-block p { white-space: pre-wrap; line-height: 1.7; margin: 0; }
.group { margin-top: 22px; }
.group h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.person { text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; box-shadow: var(--shadow); }
.person:hover { border-color: #c9a45a; }
.person b { display: block; font-size: 18px; }
.person small { color: var(--muted); display: block; margin-top: 4px; line-height: 1.45; }
.person em { font-style: normal; color: var(--accent); font-size: 12px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.side { background: var(--side); color: var(--cream); padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; box-shadow: inset -1px 0 0 rgba(212, 181, 106, 0.55); }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px; }
.brand i { font-style: normal; font-family: var(--serif); width: 42px; height: 42px; display: grid; place-items: center; color: #1a1408; background: linear-gradient(155deg, #f0dc96, #b8923e 55%, #7c6124); border-radius: 8px; }
.brand strong { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: 0.08em; }
.brand span { color: #c9c3b4; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: 4px; }
.nav-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; background: transparent; color: #b7b1a4; border: 0; padding: 8px 12px; font-size: 12px; letter-spacing: 0.14em; cursor: pointer; font-weight: 600; border-radius: 8px; }
.nav-toggle:hover { background: rgba(255,255,255,0.04); }
.nav-toggle::after { content: '▸'; letter-spacing: 0; font-size: 11px; }
.nav-group.open .nav-toggle::after { content: '▾'; }
.nav-sub { display: none; padding-left: 8px; }
.nav-group.open .nav-sub { display: flex; flex-direction: column; gap: 2px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; color: #f4f0e6; }
.nav a:hover { background: var(--side-soft); }
.nav a.active { background: linear-gradient(90deg, rgba(212, 181, 106, 0.28), rgba(255,255,255,0.03) 74%); box-shadow: inset 2px 0 0 #d4b56a; }
.who { margin-top: auto; background: rgba(255,255,255,0.04); border-radius: 10px; padding: 12px; border: 1px solid rgba(212, 181, 106, 0.28); }
.who b { display: block; }
.who span { color: #c9c3b4; font-size: 12px; }
.who button, .who a.admin-entry { margin-top: 8px; width: 100%; background: transparent; color: var(--cream); border: 1px solid rgba(246,239,228,.3); border-radius: 8px; padding: 6px; text-align: center; text-decoration: none; display: block; box-sizing: border-box; }

.main { padding: 22px 28px 48px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.top h1 { font-family: var(--serif); font-size: 34px; margin: 0; font-weight: 600; }
.top p { margin: 6px 0 0; color: var(--muted); }
.bell { text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.card, .panel, .person, .table-wrap, .list a.row { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.card { padding: 14px 16px; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { border-color: #c9a45a; }
a.card.jump em { display: block; margin-top: 8px; color: var(--muted); font-style: normal; font-size: 13px; }
.cards.jumps { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card span, .muted { color: var(--muted); }
.card strong { display: block; margin-top: 6px; font-family: var(--serif); font-size: 28px; font-variant-numeric: tabular-nums; color: var(--accent-deep); }
.card small { color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
.panel { padding: 16px; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin: 0 0 12px; font-family: var(--serif); font-weight: 600; }
.form h3 { margin-top: 18px; font-size: 16px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list a.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; text-decoration: none; }
.list a.row:hover { border-color: #c9a45a; }
.row b { display: block; }
.row span { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.filters a, .chip { text-decoration: none; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 10px; color: var(--ink); }
.filters a.on { background: var(--ink); color: var(--cream); }

.bars { height: 180px; display: flex; align-items: flex-end; gap: 4px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar span { display: block; width: 100%; background: linear-gradient(#f0dc96, var(--accent-deep)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar em { font-style: normal; font-size: 10px; color: var(--muted); margin-top: 4px; }
.pairs { height: 210px; display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.pair { flex: 1; min-width: 28px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.pair-cols { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.pair i { display: block; width: 42%; border-radius: 5px 5px 2px 2px; }
.pair i.in { background: linear-gradient(#7dbe9a, var(--good)); }
.pair i.out { background: linear-gradient(#e7a0b0, var(--bad)); }
.pair em { font-style: normal; font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.mix { display: flex; flex-direction: column; gap: 8px; }
.mix div { display: grid; grid-template-columns: 72px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.mix b { display: block; height: 10px; border-radius: 999px; background: var(--accent); }
.mix b.out { background: var(--bad); }
.mix b.mid { background: var(--info); }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.legend i.in { background: var(--good); }
.legend i.out { background: var(--bad); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table-wrap { overflow: auto; }
.sheet-preview { max-height: 440px; }
.sheet-preview th, .sheet-preview td { white-space: nowrap; font-size: 13px; vertical-align: top; }
.sheet-preview th { position: sticky; top: 0; background: var(--paper); z-index: 1; }
.sheet-preview th small { display: block; margin-top: 2px; font-weight: 400; color: var(--muted); }
.sheet-preview th small.miss { color: var(--warn); }
.sheet-preview td.line, .sheet-preview th.line { position: sticky; left: 0; background: var(--cream); z-index: 2; }

.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: #e7e3d8; white-space: nowrap; }
.pill[data-s="待派单"], .pill[data-s="待确认"], .pill[data-s="待批酬劳"], .pill[data-s="待核"], .pill[data-s="待接单"] { background: #f4e4c4; color: var(--warn); }
.pill[data-s="制作中"], .pill[data-s="处理中"], .pill[data-s="已确认应付"] { background: #d9e6f2; color: var(--info); }
.pill[data-s="待验收"], .pill[data-s="待对客交付"] { background: #ece4f4; color: #4c3578; }
.pill[data-s="已交付"], .pill[data-s="已通过"], .pill[data-s="已结算"], .pill[data-s="已核验"], .pill[data-s="已关闭"], .pill[data-s="已核定"] { background: #d9efe3; color: var(--good); }
.pill[data-s="已退回"], .pill[data-s="已驳回"], .pill[data-s="逾期"], .pill[data-s="已取消"] { background: #f8d7e1; color: var(--bad); }
.pill[data-s="售后处理中"], .pill[data-s="部分结算"] { background: #fde7d4; color: #9a3412; }

.work { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv div { background: #f4f1e8; border-radius: 10px; padding: 10px; }
.kv span { display: block; color: var(--muted); font-size: 12px; }
.prose { white-space: pre-wrap; line-height: 1.65; }
.files a { display: inline-flex; margin: 4px 8px 0 0; padding: 6px 8px; border-radius: 8px; background: #f3f0e7; text-decoration: none; }
.callout { background: #f3ecda; border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 10px; }
.form { display: flex; flex-direction: column; gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 10px; }
textarea { min-height: 84px; resize: vertical; }
.btn { border: 0; border-radius: 8px; padding: 9px 12px; background: #171b22; color: #f6edd6; box-shadow: inset 0 -2px 0 #d4b56a; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.bad { background: var(--bad); }
.btn.good { background: var(--good); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); font-size: 12px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: white; padding: 12px 14px; border-radius: 12px; max-width: 360px; z-index: 5; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.phase { width: 100%; }
.note { font-size: 13px; color: var(--muted); line-height: 1.55; }

.smart { background: #f6f3ea; border: 1px dashed #d4c298; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.smart-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.smart textarea { min-height: 90px; }
.smart-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.smart-file { flex-direction: row; align-items: center; cursor: pointer; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 10px; color: var(--ink); }
.smart-file input { display: none; }
.smart-row .btn { margin-left: auto; }
.ai-filled { background: #fff4c7 !important; border-color: #e3b341 !important; }
.next { border: 2px solid var(--accent); }
.next-tag { display: inline-block; background: var(--accent); color: white; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.next h3 { margin: 8px 0 10px; }
.more summary { cursor: pointer; font-weight: 600; }
.more[open] summary { margin-bottom: 12px; }
.cand { padding: 6px 0; flex-wrap: wrap; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .login, .shell, .grid-2, .work, .split { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 2; padding: 12px 12px 8px; gap: 8px; }
  .nav { flex-direction: row; overflow: auto; gap: 8px; }
  .nav-group { flex: 0 0 auto; margin-top: 0; }
  .nav-sub, .nav-group.open .nav-sub { flex-direction: row; padding-left: 0; }
  .nav a, .nav-toggle { white-space: nowrap; }
  .who { display: none; }
  .main { padding: 16px; }
  .top h1 { font-size: 28px; }
}
.warn-row td { background: #fdf1f4; }
b.warn { color: var(--bad); }
.search select { min-width: 140px; }
.pager { margin-top: 12px; align-items: center; }
.crumb { margin: 0 0 12px; color: var(--muted); }
.crumb a { color: var(--accent-deep); }
.ask-log { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.ask-msg { padding: 10px 14px; border-radius: 12px; max-width: 85%; line-height: 1.7; }
.ask-msg b { display: block; font-size: 12px; opacity: .7; margin-bottom: 4px; }
.ask-msg.user { align-self: flex-end; background: #efe6cf; }
.ask-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid #e3ddd0; }
.ask-empty { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ask-empty p { width: 100%; margin: 0 0 4px; }
.ask-msg h4 { margin: 10px 0 4px; font-size: 15px; }
.ask-msg p { margin: 4px 0; }
.ask-msg ul, .ask-msg ol { margin: 4px 0; padding-left: 22px; }
.ask-msg code { background: #efece4; padding: 1px 4px; border-radius: 4px; }
.ask-src { margin-top: 8px; font-size: 12px; color: #7d776c; }
.ask-src a { margin-right: 10px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 88px; }
.kb-item { border-top: 1px solid #e3ddd0; padding: 12px 0; }
.kb-item h3 { margin: 0 0 6px; font-size: 16px; }
.kb-item .kb-text { white-space: pre-wrap; }
