:root {
  --brand: #406FD9;
  --brand-dark: #3159b3;
  --brand-light: #eaf1ff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7fb;
  --card: #ffffff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.06);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(circle at 12% 20%, rgba(64, 111, 217, 0.10), transparent 42%),
    radial-gradient(circle at 88% 80%, rgba(64, 111, 217, 0.08), transparent 40%),
    #f5f7fb;
}

.login-wrap {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(31, 41, 55, 0.10);
}

.brand-panel {
  position: relative;
  overflow: hidden;
  padding: 52px 48px;
  color: #fff;
  background: linear-gradient(155deg, #4a7ae4 0%, #406FD9 45%, #2d51ab 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.brand-panel::before { width: 420px; height: 420px; right: -150px; top: -140px; }
.brand-panel::after { width: 300px; height: 300px; left: -120px; bottom: -120px; }

.brand-panel > * { position: relative; z-index: 1; }

.brand-logo img { height: 38px; display: block; }

.brand-hero { margin-top: 24px; }
.brand-hero h1 { font-size: 32px; line-height: 1.35; margin: 0 0 14px; font-weight: 700; letter-spacing: 0.5px; }
.brand-hero p { font-size: 15px; opacity: 0.88; margin: 0; max-width: 420px; }

.feature-list { list-style: none; padding: 0; margin: 34px 0 0; }
.feature-list li { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; opacity: 0.95; }
.feature-list svg { width: 18px; height: 18px; flex: 0 0 18px; }

.brand-footer { font-size: 12px; opacity: 0.72; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 18px; }

.login-panel { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-inner { width: 100%; margin: 0 auto; }
.login-panel h2 { font-size: 26px; margin: 0 0 6px; font-weight: 700; }
.login-panel .subtle { color: var(--muted); margin: 0 0 32px; font-size: 14px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: #374151; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #9ca3af; }
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(64,111,217,.12); }

.login-row { display: flex; align-items: center; justify-content: space-between; margin: -2px 0 24px; font-size: 13px; }
.login-row label { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.login-row input { accent-color: var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: #f9fafb; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

.demo-hint {
  margin-top: 26px;
  padding: 12px 14px;
  background: var(--brand-light);
  border: 1px solid #cfe0ff;
  border-radius: 9px;
  font-size: 12.5px;
  color: #35508c;
}
.demo-hint strong { color: var(--brand-dark); }

.login-footer { margin-top: 26px; font-size: 12px; color: #9ca3af; text-align: center; line-height: 1.8; }

.alert-error {
  display: none;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: #991b1b;
  font-size: 13px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar-brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.sidebar-brand img { height: 28px; }
.sidebar-brand .sys { font-size: 13px; font-weight: 700; color: var(--brand-dark); line-height: 1.2; }
.sidebar-brand .sys small { display: block; font-size: 10px; font-weight: 500; color: #9ca3af; }
.nav { padding: 18px 12px; flex: 1; }
.nav-group-title { font-size: 11px; color: #9ca3af; padding: 0 10px 8px; text-transform: uppercase; letter-spacing: .06em; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 14px;
  margin-bottom: 4px;
}
.nav-item:hover { background: #f3f6fc; text-decoration: none; color: var(--brand-dark); }
.nav-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid var(--line); font-size: 11px; color: #9ca3af; line-height: 1.7; }

.main { margin-left: 236px; min-height: 100vh; }
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 15;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
}
.demo-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

.content { padding: 28px; max-width: 1440px; }
.page-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.page-desc { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.stat-card .trend { font-size: 12px; color: var(--muted); }
.stat-card .trend.up { color: var(--success); }
.stat-card .trend.warn { color: var(--warning); }
.stat-icon { float: right; width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--brand-light); color: var(--brand); }
.stat-icon svg { width: 18px; height: 18px; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .more { font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid #f1f3f6; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfcff; }
td .sub { display: block; color: #9ca3af; font-size: 11px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: var(--success-bg); color: #15803d; }
.badge-yellow { background: var(--warning-bg); color: #b45309; }
.badge-red { background: var(--danger-bg); color: #b91c1c; }
.badge-blue { background: var(--info-bg); color: #0369a1; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar input[type="text"], .toolbar select {
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.toolbar .spacer { flex: 1; }

.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.doc-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.doc-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.doc-icon svg { width: 21px; height: 21px; }
.doc-card h4 { margin: 0; font-size: 15px; }
.doc-card p { margin: 0; color: var(--muted); font-size: 12.5px; flex: 1; }
.doc-meta { font-size: 11.5px; color: #9ca3af; }

.diag-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid #f1f3f6; }
.diag-item:last-child { border-bottom: none; }
.diag-icon { width: 40px; height: 40px; border-radius: 9px; background: #f3f6fc; display: flex; align-items: center; justify-content: center; color: var(--brand); }
.diag-icon svg { width: 20px; height: 20px; }
.diag-info { flex: 1; }
.diag-info strong { display: block; font-size: 14px; }
.diag-info span { font-size: 12px; color: var(--muted); }

/* Modal */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 24px 60px rgba(0,0,0,.2); overflow: hidden; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: #9ca3af; cursor: pointer; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.diag-steps { list-style: none; padding: 0; margin: 0; }
.diag-steps li { padding: 8px 0 8px 30px; position: relative; font-size: 13px; }
.diag-steps li::before { content: "✓"; position: absolute; left: 4px; color: var(--success); font-weight: 700; }
.diag-result { margin-top: 16px; padding: 12px 14px; background: var(--success-bg); color: #166534; border-radius: 8px; font-size: 13px; }

.empty-note { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

.demo-footer-note { margin-top: 8px; font-size: 12px; color: #9ca3af; text-align: center; }

@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; min-height: auto; }
  .brand-panel { display: none; }
  .login-panel { padding: 40px 28px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 18px; }
}
