:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e6e8ef;
  --brand: #4f46e5; --brand-soft: #eef0ff; --ok: #0f9d6b; --ok-soft: #e6f6ef;
  --warn: #c2410c; --warn-soft: #fff4e5; --danger: #dc2626; --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
  --fact: #0f766e; --fact-soft: #e6f5f3; --assume: #b45309; --assume-soft: #fef3e2; --conv: #7c3aed; --conv-soft: #f3edff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select {
  font: inherit; color: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.65; }
textarea.grow { min-height: 0; resize: none; overflow: hidden; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); }
.brand-sub { color: var(--muted); font-weight: 500; }
.logo { font-size: 22px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #eef0f5; color: var(--muted); white-space: nowrap; }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.mock { background: var(--warn-soft); color: var(--warn); }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 34px; height: 34px; font-size: 16px; }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: #cfd3df; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.jev { background: #111827; border-color: #111827; color: #fff; }
.btn.ai { background: linear-gradient(135deg,#6366f1,#8b5cf6); border: 0; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 24px; margin: 0; letter-spacing: .01em; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 18px 0 8px; }

/* dashboard */
.dash-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-head p { margin: 4px 0 0; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { margin-left: 4px; opacity: .7; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #eef0f6; border-radius: var(--radius); padding: 10px; min-height: 160px; }
.col-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; padding: 2px 6px 10px; }
.card { background: var(--card); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer; border: 1px solid transparent; transition: transform .1s, border-color .15s; }
.card:hover { border-color: #c7cbf7; transform: translateY(-1px); }
.card-title { font-weight: 600; line-height: 1.5; margin-bottom: 8px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: #f1f2f6; color: var(--muted); }
.tag.imp-高 { background: #fde8e8; color: #b91c1c; } .tag.imp-中 { background: #fef3e2; color: #b45309; } .tag.imp-低 { background: #eef2f7; color: #475569; }
.tag.demo { background: var(--brand-soft); color: var(--brand); }
.tag.st { background: var(--ink); color: #fff; }
.progress { height: 4px; background: #eef0f5; border-radius: 4px; margin-top: 10px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.card-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.list th { color: var(--muted); font-weight: 500; background: #fafbfd; }
table.list tr:hover td { background: #fafbff; cursor: pointer; }

/* wizard */
.wz-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.wz-title { width: 100%; min-height: 0; resize: none; overflow: hidden; line-height: 1.4; font-size: 22px; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 4px 8px; margin-left: -8px; }
.wz-title:hover { border-color: var(--line); background: #fff; }
.wz-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.wz-meta select { width: auto; padding: 4px 28px 4px 10px; font-size: 13px; border-radius: 8px; }
.wz-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.stepper { position: sticky; top: 76px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.step-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink); font-size: 14px; }
.step-link:hover { background: #f5f6fa; }
.step-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.step-no { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #eef0f5; color: var(--muted); flex: none; }
.step-link.done .step-no { background: var(--ok); color: #fff; }
.step-link.active .step-no { background: var(--brand); color: #fff; }
.step-who { margin-left: auto; font-size: 11px; color: var(--muted); }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px; min-width: 0; }
.panel-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.guide { background: #f8f9ff; border: 1px solid #e3e6fb; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.guide b { color: var(--brand); }
.guide ul { margin: 6px 0 0; padding-left: 20px; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
.item.flag { border-color: #f5c38b; background: #fffaf3; }
.item-row { display: grid; grid-template-columns: 26px 1fr 120px auto auto; gap: 8px; align-items: start; }
.item-row > .item-no, .item-row > .btn { padding-top: 8px; }
.item-no { color: var(--muted); font-size: 13px; text-align: center; }
.item-sub { margin-top: 8px; padding-left: 34px; }
.jev { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: #f1f2f6; color: #374151; white-space: nowrap; }
.jev .conf { font-variant-numeric: tabular-nums; opacity: .8; }
.jev.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.jev.ok { background: var(--ok-soft); color: var(--ok); }
.type-事实 { color: var(--fact); } .type-假设 { color: var(--assume); } .type-惯例 { color: var(--conv); }
select.type-sel.v-事实 { background: var(--fact-soft); color: var(--fact); border-color: #bfe6df; }
select.type-sel.v-假设 { background: var(--assume-soft); color: var(--assume); border-color: #f6d9ac; }
select.type-sel.v-惯例 { background: var(--conv-soft); color: var(--conv); border-color: #ddd0fb; }
.yn { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.yn button { border: 0; background: #fff; padding: 6px 14px; font-size: 14px; color: var(--muted); }
.yn button.on-yes { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.yn button.on-no { background: #fde8e8; color: #b91c1c; font-weight: 600; }
.yn button + button { border-left: 1px solid var(--line); }
.qc { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.qc.flag { border-color: #f5c38b; background: #fffaf3; }
.qc .q { font-weight: 600; } .qc .q small { display: block; color: var(--muted); font-weight: 400; }
.verdict { padding: 14px 16px; border-radius: 12px; margin-top: 14px; font-weight: 600; }
.verdict.yes { background: var(--ok-soft); color: var(--ok); } .verdict.no { background: #f1f2f6; color: #475569; }
.why-chain { counter-reset: why; }
.why { display: grid; grid-template-columns: 30px 1fr 1fr 110px auto; gap: 8px; align-items: start; margin-bottom: 8px; position: relative; }
.why-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.ev-row { display: grid; grid-template-columns: 26px 1.3fr auto auto auto 1.2fr; gap: 8px; align-items: start; }
.bias { display: grid; grid-template-columns: 24px 260px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.bias input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.opt-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.opt-card.rec { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fm { display: grid; grid-template-columns: 1fr 90px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.metric { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ot { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.nav-foot { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.save-ind { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 6px 0 12px; }
.callout { font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); margin: 8px 0 12px; }
.callout.info { background: #eef4ff; color: #1d4ed8; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(640px, 100%); max-height: 88vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(920px, 100%); }
.modal pre { white-space: pre-wrap; word-break: break-word; background: #f8f9fb; border-radius: 10px; padding: 14px; font-size: 13px; line-height: 1.6; font-family: ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", monospace; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; margin-top: 8px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  main { padding: 14px; }
  .topbar { padding: 10px 14px; } .brand-sub, #pill-llm { display: none; }
  .wz-grid { grid-template-columns: 1fr; }
  .stepper { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .step-link { flex: none; } .step-who { display: none; }
  .panel { padding: 18px 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(5, 78vw); scroll-snap-type: x mandatory; } .col { scroll-snap-align: start; }
  .item-row { grid-template-columns: 22px 1fr; } .item-row > :nth-child(n+3) { grid-column: 2; justify-self: start; }
  .item-sub { padding-left: 0; }
  .why { grid-template-columns: 26px 1fr; } .why > :nth-child(n+3) { grid-column: 2; }
  .ev-row { grid-template-columns: 22px 1fr; } .ev-row > :nth-child(n+3) { grid-column: 2; justify-self: start; } .ev-row > :last-child { justify-self: stretch; }
  .bias { grid-template-columns: 24px 1fr; } .bias > :last-child { grid-column: 2; }
  .fm, .metric, .ot { grid-template-columns: 1fr; }
  .qc { grid-template-columns: 1fr; }
}

.login-box { max-width: 380px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 10px; }
