/* ================ 基础 ================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: #2c3e50;
  background: #f5f7fa;
}
a { color: #3182ce; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f1f3f5;
  padding: 1px 5px;
  border-radius: 3px;
}
small { font-size: 12px; }
.muted { color: #8a95a3; }
.right { text-align: right; }
.small { font-size: 12px; }

/* ================ 顶栏 ================ */
.topbar {
  display: flex; align-items: center;
  padding: 0 24px; height: 54px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.brand { font-size: 16px; font-weight: 600; margin-right: 36px; }
.nav-links { flex: 1; display: flex; gap: 4px; }
.nav-links a {
  padding: 6px 14px; border-radius: 6px;
  color: #4a5568; font-weight: 500;
}
.nav-links a:hover { background: #edf2f7; text-decoration: none; }
.nav-links a.active { background: #ebf5ff; color: #2b6cb0; }
.user-box { display: flex; align-items: center; gap: 12px; color: #4a5568; }

.btn-mini {
  padding: 4px 10px; border-radius: 5px;
  background: #edf2f7; color: #4a5568;
  font-size: 12px;
}
.btn-mini:hover { background: #e2e8f0; text-decoration: none; }

/* ================ 布局 ================ */
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.container-full { max-width: 100%; padding: 0; }

.page-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.page-header h1 {
  margin: 0; font-size: 22px; font-weight: 600;
  flex: 1;
}

/* ================ 面板 ================ */
.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel h2 {
  margin: 0 0 14px; font-size: 15px; font-weight: 600;
  color: #2d3748;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ================ 统计卡片 ================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
}
.stat-card.severe  { border-left: 4px solid #e74c3c; }
.stat-card.warning { border-left: 4px solid #f39c12; }
.stat-card.suggest { border-left: 4px solid #3498db; }
.stat-label { font-size: 12px; color: #718096; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 600; color: #2d3748; }

.stat-row { display: flex; gap: 14px; }
.stat-mini {
  flex: 1;
  background: #f7fafc;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.stat-mini b { font-size: 20px; }
.stat-mini.severe  { border-left: 3px solid #e74c3c; }
.stat-mini.warning { border-left: 3px solid #f39c12; }
.stat-mini.suggest { border-left: 3px solid #3498db; }

/* ================ 时间范围 ================ */
.range-picker { display: flex; align-items: center; gap: 6px; }
.btn-range {
  padding: 4px 12px; border-radius: 5px;
  color: #4a5568; font-size: 12.5px;
  background: #edf2f7;
}
.btn-range:hover { background: #e2e8f0; text-decoration: none; }
.btn-range.active { background: #2b6cb0; color: #fff; }

.month-picker {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px;
  cursor: default;
}
.month-picker input[type="month"] {
  border: 0; background: transparent;
  color: inherit; font: inherit;
  padding: 1px 0; outline: none;
  cursor: pointer;
}
.month-picker.active input[type="month"] { color: #fff; }
/* WebKit 里输入框内部的日历图标随文字变色 */
.month-picker.active input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* ================ 表格 ================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}
.tbl th {
  color: #718096; font-weight: 500; font-size: 12px;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
}
.tbl tbody tr:hover { background: #f7fafc; }

/* ================ 进度条 ================ */
.bar-outer {
  display: inline-block; width: 140px; height: 8px;
  background: #edf2f7; border-radius: 4px; overflow: hidden;
  vertical-align: middle;
}
.bar-inner { height: 100%; border-radius: 4px; }
.bar-text { display: inline-block; width: 55px; text-align: right; font-size: 12px; color: #4a5568; }

/* ================ 分数 / 标签 ================ */
.score-pill {
  display: inline-block;
  min-width: 36px; padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px; font-weight: 600;
  color: #fff; background: #a0aec0;
  text-align: center;
}
.score-pill.good { background: #27ae60; }
.score-pill.mid  { background: #f39c12; }
.score-pill.bad  { background: #e74c3c; }
.score-pill.big { font-size: 15px; padding: 4px 14px; min-width: 60px; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 3px;
}
.tag-red    { background: #fed7d7; color: #c53030; }
.tag-yellow { background: #fefcbf; color: #b7791f; }
.tag-blue   { background: #bee3f8; color: #2b6cb0; }
.tag-green  { background: #c6f6d5; color: #276749; }

/* ================ Meta grid ================ */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 24px;
}
.meta-grid > div { font-size: 13px; }
.meta-grid label {
  display: block; font-size: 11px; color: #a0aec0;
  margin-bottom: 2px; letter-spacing: .3px;
}

/* ================ Raw output ================ */
.raw-output {
  background: #f7fafc; padding: 14px;
  border-radius: 6px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 500px;
}

/* ================ 空态 & 分页 ================ */
.empty { color: #a0aec0; padding: 22px; text-align: center; }
.pager {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px 0; font-size: 13px;
}
.pager a { color: #3182ce; }

/* ================ Flash ================ */
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}
.flash-error   { background: #fed7d7; color: #c53030; }
.flash-warning { background: #fefcbf; color: #b7791f; }
.flash-info    { background: #bee3f8; color: #2b6cb0; }

/* ================ 登录页 ================ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff;
  padding: 36px 32px 28px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
}
.login-brand {
  font-size: 22px; font-weight: 600;
  text-align: center; margin-bottom: 4px;
  color: #2d3748;
}
.login-sub {
  font-size: 13px; color: #718096;
  text-align: center; margin-bottom: 26px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; }
.login-form label span { font-size: 12px; color: #4a5568; }
.login-form input {
  padding: 10px 12px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 14px; outline: none;
  transition: border-color .15s;
}
.login-form input:focus { border-color: #667eea; }
.btn-primary {
  margin-top: 8px;
  padding: 11px;
  border: 0; border-radius: 6px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .92; }
.login-tip {
  margin-top: 18px; text-align: center;
  font-size: 12px; color: #a0aec0;
}
.login-tip code { background: #f1f3f5; padding: 1px 5px; border-radius: 3px; }
