:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e9f2;
  --brand: #2f6df6;
  --brand-dark: #1f55cc;
  --brand-soft: #eaf1ff;
  --teal: #0f9f8f;
  --teal-soft: #e4f7f4;
  --amber: #d97706;
  --amber-soft: #fff4e5;
  --red: #d64545;
  --red-soft: #ffeded;
  --green: #16855a;
  --green-soft: #e8f7ef;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(18, 38, 63, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: 0 0 230px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 18px 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.brand-title { font-weight: 600; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #475467; text-align: left; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.nav-item:hover { background: #f6f8fc; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 500; }
.nav-ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--line); }
.storage-note { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.main-wrap { flex: 1; min-width: 0; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.page-title { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 14px; align-items: center; }
.role-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.role-switch select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); }
.content { padding: 22px 26px 40px; }
.page { animation: fade .18s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.card-title { font-weight: 600; font-size: 15px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.stat-trend { font-size: 12px; color: var(--green); }
.stat-trend.warn { color: var(--amber); }
.btn { border: 0; border-radius: 9px; padding: 9px 14px; background: var(--brand); color: #fff; font-size: 13px; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost { background: #f2f5fa; color: var(--ink); }
.btn-ghost:hover { background: #e8edf6; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #ffdede; }
.btn-ok { background: var(--green); }
.btn-ok:hover { background: #106946; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 11px; background: #f2f5fa; color: #475467; margin: 1px 3px 1px 0; }
.tag.blue { background: var(--brand-soft); color: var(--brand-dark); }
.tag.teal { background: var(--teal-soft); color: var(--teal); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.green { background: var(--green-soft); color: var(--green); }
.badge { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 12px; font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 150px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #fff; width: 100%; }
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); }
.progress { height: 7px; background: #edf1f7; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.teal > span { background: var(--teal); }
.progress.amber > span { background: var(--amber); }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.check-item.done { background: #f7fcf9; border-color: #cbe9d9; }
.check-item.rejected { background: #fff8f8; border-color: #f3cccc; }
.check-item input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.check-main { flex: 1; min-width: 0; }
.check-title { font-size: 13px; }
.check-meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.core { color: var(--red); font-size: 11px; margin-left: 5px; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.step { padding: 6px 10px; border-radius: 8px; background: #f2f5fa; color: var(--muted); font-size: 12px; }
.step.active { background: var(--brand-soft); color: var(--brand-dark); }
.step.done { background: var(--green-soft); color: var(--green); }
.bar-row { display: grid; grid-template-columns: 110px 1fr 50px; gap: 10px; align-items: center; margin: 9px 0; font-size: 12px; }
.bar-track { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-fill.teal { background: var(--teal); }
.bar-fill.amber { background: var(--amber); }
.kpi-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kpi-row b { color: var(--ink); }
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.4); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; width: min(720px, 100%); max-height: 90vh; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 600; font-size: 16px; }
.icon-btn { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; background: #172033; color: #fff; padding: 11px 16px; border-radius: 10px; z-index: 200; font-size: 13px; box-shadow: var(--shadow); }
.quiz-q { margin-bottom: 14px; }
.quiz-q p { margin: 0 0 7px; }
.quiz-q label { display: block; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 5px; }
.note { border-left: 3px solid var(--brand); background: var(--brand-soft); padding: 10px 12px; border-radius: 0 8px 8px 0; color: #334661; font-size: 12px; line-height: 1.6; }
.split { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer; font-size: 13px; }
.mini-item.active { background: var(--brand-soft); border-color: #b9d0ff; color: var(--brand-dark); }
.join-page { max-width: 620px; margin: 36px auto 60px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px; }
.join-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.join-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.join-title { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.join-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; line-height: 1.6; }
.join-channel { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 5px 11px; font-size: 12px; margin-bottom: 18px; }
.join-success { text-align: center; padding: 26px 10px; }
.join-success-mark { width: 52px; height: 52px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 26px; margin: 0 auto 14px; }
.link-box { display: flex; gap: 8px; align-items: center; background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 12px; color: var(--muted); overflow: hidden; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.timeline-item { border-left: 2px solid var(--brand); padding-left: 12px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline-time { font-size: 11px; color: var(--muted); }
.timeline-text { margin-top: 3px; line-height: 1.6; }
.profile-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.profile-side { background: #f7f9fc; border-radius: 10px; padding: 14px; }
.profile-side .big { font-size: 22px; font-weight: 600; margin: 4px 0 10px; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:last-child { color: var(--muted); text-align: right; }
.risk-row { border-left: 3px solid var(--red); background: var(--red-soft); padding: 9px 12px; border-radius: 0 8px 8px 0; margin-bottom: 8px; font-size: 12px; }
.risk-row.handled { border-left-color: var(--green); background: var(--green-soft); }
.sop-steps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sop-step { background: #f2f5fa; border-radius: 6px; padding: 3px 7px; font-size: 11px; color: var(--muted); }
.ai-card { background: linear-gradient(135deg, #f3f7ff, #f7f3ff); border: 1px solid #dde6ff; }
.ai-item { display: flex; gap: 8px; font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
.ai-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: 0 0 6px; }
.code-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: #f2f5fa; padding: 2px 6px; border-radius: 5px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand-sub, .nav-item span:not(.nav-ico), .nav-item { font-size: 0; }
  .nav-ico { font-size: 16px; }
  .brand-title, .storage-note, #resetBtn { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
}
