:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1e2530;
  --muted: #6b7280;
  --primary: #2b6cb0;
  --primary-hover: #234e7d;
  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a20; --border: #262b34; --text: #e4e6ea;
    --muted: #8a93a1; --primary: #4c94e0; --primary-hover: #6ea9e7;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 90%; }
@media (prefers-color-scheme: dark) { code { background: rgba(255,255,255,.08); } }

.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { color: var(--text); font-weight: 600; font-size: 16px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav a { color: var(--text); }
.linkbtn { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; }
.linkbtn:hover { text-decoration: underline; }

.wrap { max-width: 1200px; margin: 32px auto; padding: 0 20px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 40px; }
.muted { color: var(--muted); }

/* -------- 首页 -------- */
.hero { font-size: 28px; margin: 0 0 8px; }
.hero-domain { color: var(--primary); }
.hero-sub { margin: 0 0 32px; font-size: 15px; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .service-grid { grid-template-columns: 1fr; }
}
.service-card {
  --card-color: var(--primary);
  display: block; padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--card-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  border-color: var(--card-color);
  text-decoration: none;
}
.service-icon { font-size: 32px; margin-bottom: 8px; line-height: 1; }
.service-name { font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.service-desc { color: var(--muted); font-size: 12px; margin-bottom: 10px; min-height: 1.5em; }
.service-status { font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot-up { background: var(--ok); }
.dot-down { background: var(--err); }
.dot-unknown { background: var(--muted); }

.section-title { margin: 40px 0 16px; font-size: 18px; color: var(--muted); font-weight: 500; }

.public-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .public-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .public-metrics { grid-template-columns: 1fr; }
}
.pm-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.pm-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.pm-value { font-size: 28px; font-weight: 600; line-height: 1.1; margin-bottom: 10px; }
.pm-bar {
  height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden;
  margin-bottom: 8px;
}
.pm-fill { height: 100%; width: 0; background: var(--ok); transition: width .3s, background .3s; }
.pm-sub { font-size: 12px; }

/* -------- 卡片 / 表格通用 -------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h1, .card h2 { margin-top: 0; }
.card.narrow { max-width: 420px; margin: 60px auto; }

.form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font: inherit; width: 100%; }
button, .btn { border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit;
  display: inline-block; line-height: 1.2; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.err { background: #fdecec; border: 1px solid #f5c2c7; color: #842029; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
@media (prefers-color-scheme: dark) {
  .err { background: #3a1a1c; border-color: #66272c; color: #f5b5ba; }
}

/* -------- 监控页 metric grid -------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.metric-card.clickable {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.metric-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  border-color: var(--primary);
}
.metric-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.metric-value { font-size: 24px; font-weight: 600; line-height: 1.2; margin-bottom: 6px; }
.metric-bar {
  height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden;
  margin-bottom: 6px;
}
.metric-fill {
  height: 100%; width: 0; background: var(--ok);
  transition: width .3s, background .3s;
}
.metric-sub { font-size: 12px; }

/* 副标题行:左温度 + 右风扇(同一行两端对齐) */
.metric-sub-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; gap: 8px;
}

/* 监控页头:标题 + 右上方运行时长 */
.status-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.uptime-inline { font-size: 14px; white-space: nowrap; }
.uptime-inline .muted { margin-right: 6px; }

/* 副标题里可点击的温度(点开温度曲线,stopPropagation 避免触发卡片占用图) */
.sub-clickable { cursor: pointer; }
.sub-clickable:hover { text-decoration: underline; }

/* -------- 表格 -------- */
.datatable { width: 100%; border-collapse: collapse; font-size: 14px; }
.datatable th, .datatable td {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px; text-align: left; vertical-align: middle;
}
.datatable th { color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--bg); }
.pill-ok   { color: #fff; background: var(--ok);   border-color: var(--ok); }
.pill-warn { color: #fff; background: var(--warn); border-color: var(--warn); }
.pill-err  { color: #fff; background: var(--err);  border-color: var(--err); }

/* 磁盘表列宽 */
.disk-table .col-mount { width: 10% }
.disk-table .col-dev   { width: 12%; }
.disk-table .col-type  { width: 6%; }
.disk-table .col-temp  { width: 6%; font-weight: 500; }
.disk-table .col-used  { width: 10%; text-align: right; }
.disk-table .col-total { width: 10%; text-align: right; }
.disk-table .col-usage { width: 46%; text-align: center; }

.temp-cool { color: var(--ok); }
.temp-warm { color: var(--warn); }
.temp-hot  { color: var(--err); font-weight: 600; }

.scale-btn {
  padding: 4px 10px; font-size: 13px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted); cursor: pointer;
}
.scale-btn:hover { border-color: var(--primary); color: var(--text); }
.scale-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 使用率胶囊(带 100% 框) */
.usage-bar {
  position: relative;
  width: 100%;
  min-width: 180px;
  height: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.usage-fill {
  position: absolute; inset: 0;
  height: 100%;
  border-radius: 999px 0 0 999px;
  transition: width .3s, background .3s;
}
.usage-text {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,.6);   /* 保证深浅色底都能看清 */
}
