:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #e4e9f2;
  --txt: #1b2434;
  --muted: #6b7a90;
  --brand: #2f6bff;
  --brand-dark: #1e4fd8;
  --navy: #0e1729;
  --navy-soft: #17233a;
  --great: #16a34a;
  --good: #2f6bff;
  --mid: #d98a04;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 34, 68, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
ul { margin: 0; padding-left: 18px; }
code { background: #eef2f9; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- 应用框架 ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: linear-gradient(180deg, #0e1729 0%, #101c33 100%);
  color: #cbd7ea;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  gap: 22px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, #2f6bff, #6f9bff);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
}
.brand-text strong { display: block; color: #f2f6ff; font-size: 14px; }
.brand-text small { display: block; color: #7f92ad; font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: #b9c7dc; font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(47,107,255,.18); color: #fff; box-shadow: inset 0 0 0 1px rgba(47,107,255,.35); }
.nav-icon { width: 16px; height: 16px; opacity: .9; }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.tenant-badge {
  display: flex; gap: 10px; align-items: center;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px; padding: 10px 12px;
}
.tenant-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #38d39f; flex: none; }
.tenant-badge strong { display: block; color: #e8effc; font-size: 13px; }
.tenant-badge small { color: #8b9db8; font-size: 11.5px; }

.main { margin-left: 248px; padding: 26px 30px 48px; min-height: 100vh; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 20px; flex-wrap: wrap;
}
.topbar h1 { font-size: 21px; letter-spacing: .2px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px;
  font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow);
}
.pill strong { color: var(--brand); font-size: 14px; }

/* ---------- 卡片与网格 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }

.grid { display: grid; gap: 18px; }
.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)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: .5px; margin-top: 6px; }
.stat .foot { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.accent { background: linear-gradient(135deg, #2258e6, #4a83ff); border-color: transparent; color: #fff; }
.stat.accent .label, .stat.accent .foot { color: rgba(255,255,255,.78); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--txt); }
.btn-ghost:hover { border-color: #c9d4e6; background: #f8faff; }
.btn-danger { background: #fff; border-color: #f3c9c9; color: var(--bad); }
.btn-danger:hover { background: #fff5f5; }
.btn-dark { background: rgba(255,255,255,.09); color: #dce6f7; border-color: rgba(255,255,255,.14); }
.btn-dark:hover { background: rgba(255,255,255,.16); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input, input[type="text"], input[type="password"], input[type="email"], input[type="url"], select, textarea {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--txt);
  font: inherit; font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47,107,255,.18); border-color: #9fb9ff; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1 1 280px; margin-bottom: 0; }

/* ---------- 提示条 ---------- */
.alert { padding: 11px 15px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: #effaf3; border-color: #b7ebc9; color: #12703a; }
.alert-error { background: #fff3f3; border-color: #f6c7c7; color: #a51d1d; }
.alert-warn { background: #fff9ec; border-color: #f7dfae; color: #8a5a00; }
.alert-info { background: #eff4ff; border-color: #c9daff; color: #1e4aa8; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-pass { background: #e9f9ef; color: #12703a; }
.badge-warn { background: #fff5e2; color: #8a5a00; }
.badge-fail { background: #fdecec; color: #a51d1d; }
.badge-soft { background: #eef2f9; color: #4a5872; }

.grade { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; font-weight: 700; font-size: 13px; color: #fff; }
.grade-A { background: var(--great); }
.grade-B { background: var(--good); }
.grade-C { background: var(--mid); }
.grade-D { background: var(--bad); }

.score-chip { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 700; font-size: 15px; }
.score-chip.great { color: var(--great); }
.score-chip.good { color: var(--good); }
.score-chip.mid { color: var(--mid); }
.score-chip.bad { color: var(--bad); }
.score-chip span { font-size: 11px; font-weight: 500; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: #fafbfe; }
.table tr:last-child td { border-bottom: 0; }
.table .url { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; }
.table .actions form { display: inline; }

/* ---------- 报告 ---------- */
.report-head { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.gauge {
  --value: 0;
  --tone: var(--brand);
  width: 168px; height: 168px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--tone) calc(var(--value) * 1%), #e8eef9 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.gauge::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.gauge-inner { position: relative; z-index: 1; text-align: center; }
.gauge-score { display: block; font-size: 42px; font-weight: 700; line-height: 1.1; }
.gauge-grade { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.report-meta { display: flex; gap: 26px; flex-wrap: wrap; }
.report-meta div { min-width: 120px; }
.report-meta .k { color: var(--muted); font-size: 12px; }
.report-meta .v { font-weight: 600; font-size: 13.5px; margin-top: 2px; }

.check-list { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  display: flex; gap: 14px; align-items: flex-start; background: #fff;
}
.check-item .meta { flex: none; width: 130px; }
.check-item .meta .name { font-weight: 600; font-size: 13.5px; }
.check-item .meta .weight { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.check-item .body { flex: 1; min-width: 0; }
.check-item .msg { font-size: 13px; }
.check-item .tip { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.check-item.fail { border-left: 3px solid var(--bad); }
.check-item.warn { border-left: 3px solid #e8a712; }
.check-item.pass { border-left: 3px solid #22c55e; }

.group-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; font-size: 14px; font-weight: 600; }
.group-title:first-child { margin-top: 0; }
.group-title .count { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* ---------- 趋势柱 ---------- */
.trend { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding: 6px 2px 0; }
.trend .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .bar {
  width: 100%; max-width: 42px; border-radius: 7px 7px 4px 4px;
  background: linear-gradient(180deg, #6f9bff, #2f6bff);
  min-height: 6px; transition: height .3s ease;
}
.trend .bar.great { background: linear-gradient(180deg, #4ade80, #16a34a); }
.trend .bar.mid { background: linear-gradient(180deg, #f5c453, #d98a04); }
.trend .bar.bad { background: linear-gradient(180deg, #f87171, #dc2626); }
.trend .val { font-size: 11.5px; color: var(--muted); }
.trend .day { font-size: 11px; color: var(--muted); white-space: nowrap; }

.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: 12px; background: #fbfcff; }

.tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.tips li { margin: 4px 0; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--txt); }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }

/* ---------- 登录/注册 ---------- */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
  background: radial-gradient(1200px 600px at 10% 0%, #1b2b4d 0%, #0b1220 55%, #070c16 100%);
  color: #e8eefb;
}
.auth-card {
  width: 100%; max-width: 940px;
  background: #fff; color: var(--txt);
  border-radius: 20px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr;
  box-shadow: 0 30px 80px rgba(4, 10, 24, .45);
}
.auth-side {
  background: linear-gradient(155deg, #12315e, #1e4fd8 55%, #2f6bff);
  color: #fff; padding: 38px 34px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
}
.auth-side h2 { font-size: 22px; line-height: 1.45; }
.auth-side p { color: rgba(255,255,255,.8); font-size: 13px; margin-top: 10px; }
.auth-side ul { color: rgba(255,255,255,.85); font-size: 12.5px; margin-top: 4px; }
.auth-side li { margin: 7px 0; }
.auth-side .brand-mark { width: 46px; height: 46px; font-size: 14px; }
.auth-form { padding: 36px 34px; }
.auth-form h1 { font-size: 20px; margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-form .field label { font-size: 12.5px; }
.auth-foot { color: var(--muted); font-size: 12.5px; margin-top: 18px; text-align: center; }
.auth-foot a { font-weight: 500; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .sidebar {
    position: static; width: 100%; flex-direction: column; gap: 14px;
    padding: 16px 18px; border-radius: 0 0 18px 18px;
  }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .sidebar-foot form { width: auto; }
  .sidebar-foot .btn-block { width: auto; }
  .main { margin-left: 0; padding: 20px 16px 40px; }
  .auth-card { grid-template-columns: 1fr; max-width: 460px; }
  .auth-side { display: none; }
}
@media (max-width: 720px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .report-head { gap: 18px; }
  .gauge { width: 132px; height: 132px; }
  .gauge-score { font-size: 34px; }
  .check-item { flex-direction: column; gap: 8px; }
  .check-item .meta { width: auto; }
  .table .url { max-width: 220px; }
}
/* ---------- 用量进度 / 迷你列表 ---------- */
.progress { height: 8px; border-radius: 999px; background: #edf1f8; overflow: hidden; margin: 8px 0 12px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2f6bff, #6f9bff); }

.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px dashed var(--line);
  color: var(--txt); font-size: 13px;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { text-decoration: none; background: #fafbff; }
.mini-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- 解决方案路线图与逐项方案 ---------- */
.roadmap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.roadmap-col { background: #fbfcff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; }
.roadmap-head { margin-bottom: 10px; }
.prio { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.prio-p0 { background: #fdecec; color: #a51d1d; }
.prio-p1 { background: #fff5e2; color: #8a5a00; }
.prio-p2 { background: #eef2f9; color: #4a5872; }
.roadmap-list { margin: 0; padding-left: 18px; font-size: 13px; }
.roadmap-list li { margin: 6px 0; display: flex; justify-content: space-between; gap: 8px; }
.roadmap-list a { flex: 1; }
.solution-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.solution { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.solution-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.solution-impact { font-size: 13px; }
.solution-steps { margin: 0; padding-left: 20px; font-size: 13px; }
.solution-steps li { margin: 4px 0; }
.solution-verify { font-size: 13px; color: #12703a; background: #effaf3; border: 1px solid #b7ebc9; border-radius: 8px; padding: 8px 11px; }
.code-block { margin: 0; background: #0e1728; color: #dbe7ff; border-radius: 10px; padding: 13px 15px; overflow: auto; font-size: 12.5px; line-height: 1.65; }
.code-block code { background: none; color: inherit; padding: 0; font-size: 12.5px; }

@media (max-width: 980px) {
  .roadmap { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 权重提升建议 ---------- */
.advice-list { display: flex; flex-direction: column; gap: 14px; }
.advice-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.advice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.advice-head strong { font-size: 14px; }
.advice-why { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ---------- 后台 tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.tab { padding: 8px 16px; border-radius: 9px; font-size: 13.5px; color: var(--muted); }
.tab:hover { background: #f5f8ff; color: var(--txt); text-decoration: none; }
.tab.is-active { background: var(--brand); color: #fff; font-weight: 500; }

/* ---------- 打印 / 存为 PDF ---------- */
@media print {
  .sidebar, .topbar, .tabs, .no-print, .pager { display: none !important; }
  body { background: #fff; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .code-block { background: #f5f7fb; color: #111; }
  a { color: #000; text-decoration: none; }
  .gauge::after { background: #fff; }
}
