/* ============================================================
   股票系统 v3 · 基础样式
   无构建步骤、无外链（CSP 只允许 'self'）
   ============================================================ */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1b2430;
  --muted: #6b7785;
  --brand: #1f4e79;
  --brand-weak: #eaf1f8;
  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --warn: #9a6700;
  --warn-bg: #fff4e0;
  --crit: #b42318;
  --crit-bg: #fde8e6;
  --up: #c62828;
  --down: #1a7f37;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

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

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

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.inline { display: inline; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: #12212f;
  color: #e6edf3;
  border-bottom: 1px solid #0d1a25;
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
}
.brand {
  color: #fff; font-weight: 600; font-size: 15px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: #b9c7d4; padding: 6px 12px; border-radius: 7px;
  font-size: 13px; white-space: nowrap;
}
.nav-link:hover { background: #1c3042; color: #fff; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { color: #8fa3b5; font-size: 12px; }

/* ---------------- 容器 ---------------- */
.container {
  max-width: 1200px; margin: 0 auto;
  padding: 22px 20px 60px;
}

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; margin: 0; }
.page-head-actions { display: flex; align-items: center; gap: 12px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.card-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.card-hero .score-row { margin-bottom: 8px; }

.grid-hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 820px) {
  .grid-hero { grid-template-columns: 1fr; }
}

/* ---------------- 评分 ---------------- */
.score-row {
  display: flex; align-items: center; gap: 16px;
}
.score-row-wide { margin-bottom: 18px; }
.score {
  font-size: 44px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 6px 4px;
}
.score-ok { color: var(--ok); }
.score-warn { color: var(--warn); }
.score-critical { color: var(--crit); }
.score-meta { display: flex; flex-direction: column; gap: 6px; }

/* ---------------- 徽标 / 药丸 ---------------- */
.pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-critical { background: var(--crit-bg); color: var(--crit); }

.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
}
.dot-critical { background: var(--crit); }
.dot-warn { background: var(--warn); }
.dot-ok { background: var(--ok); }

.issue-list { margin: 6px 0 0; padding-left: 0; list-style: none; }
.issue-list li {
  padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.issue-list li:last-child { border-bottom: none; }

/* ---------------- 统计块 ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 520px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: #fafbfc; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.stat-num {
  font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--muted); }

/* ---------------- 表格 ---------------- */
.table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.table th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 12px; text-transform: none;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 8px 10px; border-bottom: 1px solid #f0f3f7;
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table-compact td, .table-compact th { padding: 6px 10px; }
.row-critical { background: #fffafa; }
.row-warn { background: #fffdf7; }

/* ---------------- 表单 / 按钮 ---------------- */
.btn {
  display: inline-block; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-family: inherit; line-height: 1.2;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f2f5f9; text-decoration: none; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover { background: #173d5e; border-color: #173d5e; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 8px; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font-family: inherit;
}
.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, .12);
}
.input-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 24px; letter-spacing: 8px; text-align: center;
  padding: 12px;
}

/* ---------------- 提示 ---------------- */
.alert {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
  font-size: 13px; border: 1px solid transparent;
}
.alert-error { background: var(--crit-bg); color: var(--crit); border-color: #f5c6c0; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a8; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.hint code { background: #f2f5f9; padding: 1px 5px; border-radius: 4px; }

/* ---------------- 登录页 ---------------- */
.auth-wrap {
  max-width: 420px; margin: 6vh auto 0;
}
.auth-wrap-wide { max-width: 760px; }
.auth-card { padding: 26px; }
.auth-title { font-size: 20px; margin: 0 0 6px; }
.auth-sub { margin: 0 0 20px; font-size: 13px; }

/* ---------------- TOTP 绑定 ---------------- */
.setup-grid {
  display: grid; grid-template-columns: 240px 1fr; gap: 24px;
  align-items: start; margin-bottom: 18px;
}
@media (max-width: 620px) { .setup-grid { grid-template-columns: 1fr; } }
.qr-box {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; display: flex; align-items: center; justify-content: center;
}
.qr-box svg { width: 100%; height: auto; display: block; }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 13px; }
.steps li { margin-bottom: 4px; }
.secret-box {
  background: #f7f9fb; border: 1px dashed var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px;
}
.secret { font-size: 14px; letter-spacing: 1px; word-break: break-all; }

.codes-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin: 18px 0 22px;
}
@media (max-width: 520px) { .codes-grid { grid-template-columns: 1fr; } }
.recovery-code {
  background: #f7f9fb; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; text-align: center; font-size: 15px; letter-spacing: 1px;
}

/* ---------------- 页脚 ---------------- */
.footer {
  max-width: 1200px; margin: 0 auto; padding: 18px 20px 30px;
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--border);
}
