:root {
  --bg: #f5f7fa; --panel: #ffffff; --ink: #1f2937; --muted: #6b7280;
  --line: #e5e7eb; --brand: #c0202e; --brand2: #b45309; --accent: #2563eb;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --info: #0891b2;
  --s: #dc2626; --a: #ea580c; --b: #ca8a04; --obs: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #fca5a533; border-color: var(--brand); }

/* 登录 */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#7f1d1d11,#1e3a8a11); }
.login-card { width: 360px; background: var(--panel); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; }
.login-card label { display: block; margin: 12px 0 4px; color: var(--muted); }
.login-card input { width: 100%; }
.btn-primary { width: 100%; margin-top: 20px; background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 11px; font-weight: 600; }
.btn-primary:hover { background: #a31622; }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* 布局 */
#app-view { display: none; }
.topbar { height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 20px; position: sticky; top: 0; z-index: 10; }
.topbar .logo { font-weight: 700; font-size: 16px; color: var(--brand); margin-right: 28px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.active { background: #fde8ea; color: var(--brand); }
.nav a:hover { color: var(--brand); }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.userbox button { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; color: var(--ink); }
.content { padding: 22px; max-width: 1280px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { margin: 0 0 14px; font-size: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 900px){ .grid2,.grid3{ grid-template-columns:1fr; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 24px; font-weight: 700; }
.kpi .l { color: var(--muted); margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
tbody tr:hover { background: #fafafa; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.g-S { background:#fee2e2; color:#b91c1c; } .g-A{ background:#ffedd5; color:#c2410c; } .g-B{ background:#fef9c3; color:#a16207; } .g-观察{ background:#f1f5f9; color:#475569; } .g-风险{ background:#fecaca; color:#991b1b; } .g-数据不足{ background:#f1f5f9; color:#94a3b8; }
.pill-ok{ background:#dcfce7;color:#15803d;} .pill-off{ background:#f1f5f9;color:#94a3b8;}
.btn-sm { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.btn-sm.danger { color: var(--bad); border-color: #fecaca; }
.btn-sm.primary { background: var(--brand); color: #fff; border: 0; }
.btn { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 500; }
.btn.primary { background: var(--brand); color: #fff; border: 0; }
.muted { color: var(--muted); }
.bar { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; border: 0; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.modal-bg { position: fixed; inset: 0; background: #0006; display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 22px; width: 460px; max-width: 92vw; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.flex { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.note { background:#fffbeb; border:1px solid #fde68a; color:#92400e; padding:10px 14px; border-radius:10px; font-size:13px; margin-bottom:14px;}
.pos { color: var(--ok); } .neg { color: var(--bad); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.advice { white-space: pre-wrap; line-height: 1.7; background:#f8fafc; border:1px solid var(--line); border-radius:10px; padding:14px; }
