:root {
  --bg: #ffffff;
  --surface: #faf9f7;
  --surface-2: #f4f3f0;
  --border: #e6e4df;
  --border-strong: #d6d3cd;
  --text: #1f1e1d;
  --text-2: #6b6862;
  --text-3: #93908a;
  --accent: #2aaf72;
  --accent-soft: #e7f6ee;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --critical: #dc2626;
  --critical-soft: #fdeaea;
  --prod: #3d7dd8;
  --test: #2aaf72;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 18, 15, .04), 0 4px 16px rgba(20, 18, 15, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a19;
    --surface: #232221;
    --surface-2: #2b2928;
    --border: #383634;
    --border-strong: #4a4744;
    --text: #f2f0ec;
    --text-2: #b3afa8;
    --text-3: #8c8781;
    --accent: #3ec785;
    --accent-soft: #1d3329;
    --warn: #f0a63c;
    --warn-soft: #3a2c17;
    --critical: #f26a6a;
    --critical-soft: #3d2222;
    --prod: #6ba4ee;
    --test: #3ec785;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 28px 20px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.brand .sub {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

.meta { display: flex; align-items: center; gap: 18px; }
.meta-item { display: flex; flex-direction: column; }
.meta-item .label { font-size: 11px; color: var(--text-3); letter-spacing: .04em; }
.meta-item .value { font-size: 14px; font-variant-numeric: tabular-nums; }

.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--surface-2); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }

/* 告警 */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px;
}
.alert.critical { background: var(--critical-soft); border-color: var(--critical); color: var(--critical); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert.info { color: var(--text-2); }
.alert .env-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.alert.critical .env-tag, .alert.warn .env-tag { background: transparent; border-color: currentColor; color: inherit; }

/* 环境卡片 */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.env-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.env-name { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-prod { background: var(--prod); }
.dot-test { background: var(--test); }
.env-host { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.badge {
  font-size: 11px; padding: 2px 9px; border-radius: 20px;
  border: 1px solid var(--border-strong); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge.bad { background: var(--critical-soft); border-color: var(--critical); color: var(--critical); }
.badge.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 4px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--text-3); }
.stat .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v small { font-size: 11px; font-weight: 400; color: var(--text-3); }

.meter { margin-top: 12px; }
.meter-row { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 8px; }
.meter-row .name { width: 62px; color: var(--text-2); }
.meter-row .bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.meter-row .fill { height: 100%; border-radius: 4px; background: var(--accent); }
.meter-row .fill.warn { background: var(--warn); }
.meter-row .fill.critical { background: var(--critical); }
.meter-row .num { width: 92px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; color: var(--text-3);
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* 图表 */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.chart-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.chart-title { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.chart svg { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }

/* 详情分区 */
.env-detail { margin-bottom: 4px; }
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; margin-bottom: 12px;
}
.sub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .sub-grid { grid-template-columns: 1fr; } }

.panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.panel h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; }
.kv .k { color: var(--text-3); }
.kv .v { font-variant-numeric: tabular-nums; }

pre.logtail {
  margin: 6px 0 0; padding: 8px 10px; background: var(--surface-2);
  border-radius: 6px; font-size: 11.5px; color: var(--text-2);
  white-space: pre-wrap; word-break: break-all; max-height: 76px; overflow: auto;
}

.empty { color: var(--text-3); font-size: 13px; padding: 20px 0; text-align: center; }

footer {
  max-width: 1180px; margin: 0 auto; padding: 0 28px 40px;
  color: var(--text-3); font-size: 12px;
}
