:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #172321;
  --muted: #687875;
  --line: #dfe8e5;
  --line-dark: #c9d7d3;
  --teal: #0b6b61;
  --teal-2: #159080;
  --teal-soft: #e5f3f0;
  --mint: #cce8e2;
  --amber: #b66b18;
  --amber-soft: #fff4df;
  --red: #b9403d;
  --red-soft: #feeeec;
  --blue: #31699b;
  --blue-soft: #eaf2fa;
  --shadow: 0 10px 30px rgba(23, 58, 52, 0.06);
  --radius: 14px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, select, textarea, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.prototype-banner {
  height: 30px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #124a44; color: #d9efeb; font-size: 12px; font-weight: 600; letter-spacing: .03em;
  position: fixed; inset: 0 0 auto 0; z-index: 50;
}
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #7de1cf; box-shadow: 0 0 0 4px rgba(125,225,207,.14); }
.app-shell { min-height: 100vh; padding-top: 30px; display: flex; }

.sidebar {
  width: 254px; position: fixed; z-index: 30; inset: 30px auto 0 0; display: flex; flex-direction: column;
  padding: 25px 16px 18px; color: #dbece8; background: linear-gradient(175deg, #102d2a 0%, #0d2724 56%, #09201e 100%);
  border-right: 1px solid rgba(255,255,255,.06);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #dff4ef; }
.brand-mark svg { width: 22px; fill: var(--teal); }
.brand strong { display: block; font-size: 17px; letter-spacing: .08em; color: #fff; }
.brand span { display: block; margin-top: 3px; font-size: 11px; color: #92aca7; }
.main-nav { display: grid; gap: 5px; padding: 22px 0; }
.nav-item { position: relative; border: 0; border-radius: 9px; padding: 11px 12px; display: flex; align-items: center; gap: 12px; text-align: left; color: #a9bfba; background: transparent; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(27,150,132,.31), rgba(27,150,132,.11)); box-shadow: inset 3px 0 #48c4b2; }
.nav-icon { width: 19px; font-size: 19px; text-align: center; font-weight: 400; }
.nav-item em { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; color: #102d2a; background: #7fe0d0; font-style: normal; font-size: 11px; font-weight: 800; }
.sidebar-note { margin-top: auto; padding: 13px; border: 1px solid rgba(125,224,208,.16); border-radius: 10px; display: flex; gap: 10px; background: rgba(67,165,150,.07); }
.note-icon { flex: 0 0 22px; height: 22px; border: 1px solid #4d9489; border-radius: 50%; display: grid; place-items: center; color: #78c9bc; font-size: 12px; }
.sidebar-note strong { display: block; margin-bottom: 4px; font-size: 11px; color: #d9efeb; }
.sidebar-note span { display: block; color: #77918c; font-size: 10px; line-height: 1.55; }
.sidebar-user { margin-top: 15px; padding: 16px 5px 0; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 9px; }
.avatar { flex: 0 0 33px; height: 33px; border-radius: 9px; display: grid; place-items: center; background: #bde3dc; color: #10584f; font-weight: 800; }
.sidebar-user strong { display: block; color: #e3efec; font-size: 11px; }
.sidebar-user span { display: block; width: 130px; margin-top: 3px; overflow: hidden; color: #728d87; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-user button { margin-left: auto; border: 0; color: #78918d; background: none; }

.main-content { width: calc(100% - 254px); margin-left: 254px; }
.topbar { height: 68px; position: sticky; top: 30px; z-index: 20; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.breadcrumb span, .breadcrumb b { color: #9aa7a4; font-weight: 400; }
.breadcrumb strong { color: #34423f; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.role-switcher { height: 38px; padding: 0 5px 0 12px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 9px; background: #fafcfb; }
.role-switcher span { font-size: 11px; color: var(--muted); }
.role-switcher select { border: 0; outline: 0; color: #31433f; background: transparent; font-size: 12px; font-weight: 700; }
.icon-button { width: 36px; height: 36px; position: relative; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #4c625d; }
.icon-button span { width: 5px; height: 5px; position: absolute; top: 8px; right: 8px; border-radius: 50%; background: #ef765d; }
.system-state { display: flex; align-items: center; gap: 7px; color: #59706b; font-size: 11px; }
.system-state i { width: 7px; height: 7px; border-radius: 50%; background: #25a58f; box-shadow: 0 0 0 4px #e2f4f0; }
.mobile-menu { display: none; }
.page-container { max-width: 1540px; margin: 0 auto; padding: 26px 30px 60px; }

.page-heading { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 0 0 6px; color: #172926; font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.heading-actions { display: flex; gap: 10px; }
.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.btn { min-height: 38px; padding: 9px 16px; border: 1px solid var(--line-dark); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: #fff; color: #344844; font-size: 12px; font-weight: 700; transition: .18s; }
.btn:hover { transform: translateY(-1px); border-color: #9ebbb5; box-shadow: 0 5px 12px rgba(19,77,68,.07); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.btn-primary { border-color: var(--teal); background: var(--teal); color: #fff; }
.btn-primary:hover { border-color: #075c53; background: #075c53; }
.btn-danger { border-color: #e2aaa6; color: var(--red); background: #fffafa; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-small { min-height: 31px; padding: 6px 11px; font-size: 11px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

/* ===== 以下为补全样式（卡片内容 / 弹窗 / 时间线 / 看板组件） ===== */
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 800; color: #22332f; letter-spacing: 0; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

.grid-2 { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.kpi-value { margin-top: 6px; color: #14302b; font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi-value small { margin-left: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.kpi-value.tone-red { color: var(--red); }
.kpi-value.tone-amber { color: var(--amber); }
.kpi-value.tone-teal { color: var(--teal); }
.kpi-sub { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 9px; border: 1px solid rgba(11,107,97,.16); border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge-amber { border-color: rgba(182,107,24,.2); background: var(--amber-soft); color: var(--amber); }
.badge-red { border-color: rgba(185,64,61,.2); background: var(--red-soft); color: var(--red); }
.badge-blue { border-color: rgba(49,105,155,.2); background: var(--blue-soft); color: var(--blue); }
.badge-mint { border-color: rgba(11,107,97,.14); background: var(--mint); color: #0a5a50; }
.badge-gray { border-color: var(--line-dark); background: var(--surface-soft); color: var(--muted); }

.field-select, .form-field select { height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--line-dark); border-radius: 8px; background: #fff; color: #2e403c; font-size: 12px; font-weight: 600; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23687875' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field-select:focus, .form-field select:focus, .form-field textarea:focus { outline: 0; border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(21,144,128,.14); }
.case-line { margin-bottom: 4px; }
.state-line { margin-top: 14px; padding: 9px 12px; border: 1px dashed var(--line-dark); border-radius: 8px; background: var(--surface-soft); color: #455a55; font-size: 11px; font-weight: 600; }

.pipeline { display: grid; gap: 2px; margin-top: 6px; }
.pstep { display: flex; align-items: flex-start; gap: 12px; padding: 8px 2px; }
.pstep-dot { flex: 0 0 20px; height: 20px; margin-top: 1px; position: relative; border: 2px solid var(--line-dark); border-radius: 50%; background: #fff; }
.pstep-dot::after { content: ""; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 900; }
.pstep.done .pstep-dot { border-color: var(--teal); background: var(--teal); }
.pstep.done .pstep-dot::after { content: "✓"; }
.pstep.active .pstep-dot { border-color: var(--teal-2); box-shadow: 0 0 0 4px rgba(21,144,128,.16); }
.pstep.active .pstep-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--teal-2); }
.pstep-name { font-size: 12px; font-weight: 700; color: #2c403c; }
.pstep.pending .pstep-name { color: #93a5a1; }
.pstep.active .pstep-name { color: var(--teal); }
.pstep-desc { margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.timeline { display: grid; gap: 8px; }
.tl-item { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.tl-time { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tl-title { font-size: 12px; font-weight: 700; color: #253834; }
.tl-code { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 5px; background: var(--teal-soft); color: var(--teal-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 9px; font-weight: 600; }
.tl-detail { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.decision-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }

.task-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.task-row + .task-row { margin-top: 8px; }
.task-title { font-size: 12px; font-weight: 800; color: #22332f; }
.task-sub { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.task-side { flex: 0 0 auto; }

.kv { display: grid; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.kv-row b { color: #22332f; font-weight: 700; text-align: right; }

.funnel { display: grid; gap: 10px; margin-top: 4px; }
.funnel-row { display: grid; grid-template-columns: 72px 1fr 30px; align-items: center; gap: 12px; }
.funnel-label { color: #455a55; font-size: 11px; font-weight: 700; }
.funnel-bar { height: 12px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; background: var(--teal-2); }
.funnel-fill.tone-amber { background: #d99a3d; }
.funnel-fill.tone-blue { background: var(--blue); }
.funnel-fill.tone-teal { background: var(--teal); }
.funnel-val { color: #344844; font-size: 11px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--line-dark); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: #2c403c; }
.table tr:last-child td { border-bottom: 0; }
.muted-cell { color: var(--muted); font-size: 11px; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty.compact { padding: 22px 12px; }
.empty-icon { width: 42px; height: 42px; margin: 0 auto 10px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-soft); font-size: 17px; color: #7d938e; }
.empty p { margin: 0; font-size: 11px; line-height: 1.7; }

/* ===== 弹窗 ===== */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(9, 32, 28, .46); backdrop-filter: blur(3px); }
.modal { width: min(560px, 100%); border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(9, 42, 37, .3); overflow: hidden; }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 4px 0 0; font-size: 16px; font-weight: 800; color: #1b2b28; letter-spacing: -.01em; }
.modal header .eyebrow { margin-bottom: 0; }
.modal header button { width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #5c716c; font-size: 15px; line-height: 1; }
.modal-content { padding: 18px 22px 4px; }
.form-field { display: grid; gap: 7px; }
.form-field label { color: #3d514c; font-size: 11px; font-weight: 800; }
.form-field textarea { min-height: 84px; padding: 10px 12px; border: 1px solid var(--line-dark); border-radius: 8px; background: #fbfdfc; color: #24352f; font-size: 12px; line-height: 1.6; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 18px; border-top: 1px solid var(--line); margin-top: 16px; }

/* ===== Toast ===== */
.toast-region { position: fixed; top: 44px; right: 20px; z-index: 70; display: grid; gap: 10px; justify-items: end; }
.toast { min-width: 250px; max-width: 340px; padding: 12px 16px; border-radius: 12px; background: #102d2a; color: #e6f4f1; box-shadow: 0 14px 34px rgba(9, 42, 37, .35); opacity: 0; transform: translateX(16px); transition: .3s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.hide { opacity: 0; transform: translateY(-6px); }
.toast strong { display: block; margin-bottom: 3px; font-size: 12px; }
.toast span { display: block; color: #9dbcb6; font-size: 11px; line-height: 1.55; }

/* ===== 响应式 ===== */
@media (max-width: 1120px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .mobile-menu { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #4c625d; font-size: 15px; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: 0 0 44px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .main-content { width: 100%; margin-left: 0; }
  .page-container { padding: 20px 16px 50px; }
  .topbar { padding: 0 16px; }
  .role-switcher span { display: none; }
  .system-state { display: none; }
  .decision-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}