/* ============================================================
   Pulse · 服务器状态监控面板
   ============================================================ */

:root {
  --bg:            #0b0f16;
  --bg-soft:       #101725;
  --surface:       #131b2a;
  --surface-2:     #172032;
  --border:        #22304a;
  --border-soft:   #1b2536;
  --text:          #e7edf7;
  --text-dim:      #8fa1bd;
  --text-mute:     #61728c;

  --accent:        #4f8cff;
  --accent-2:      #6ee7f0;
  --ok:            #3ddc97;
  --warn:          #ffb547;
  --danger:        #ff5c72;

  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.55);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 600px at 12% -12%, rgba(79,140,255,.16), transparent 62%),
    radial-gradient(900px 520px at 92% 0%, rgba(110,231,240,.10), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }

p { margin: 0; }

code, .mono { font-family: var(--mono); font-size: .92em; }

.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.stale { color: #ff8b9b; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 26px;
  height: 60px;
  background: rgba(11,15,22,.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7c5cff 55%, var(--accent-2));
  box-shadow: 0 6px 18px -6px rgba(79,140,255,.9);
}

.brand-mark.lg {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  margin: 0 auto 14px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 15px; }
.brand-text em {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: .04em;
}

.topnav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.topnav a {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: background .16s, color .16s;
}

.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--surface-2); color: var(--text); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  border-left: 1px solid var(--border-soft);
  min-height: 28px;
}


/* ---------- 布局 ---------- */

.container {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 26px 56px;
}

body.centered .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 0;
}

.container.narrow { max-width: 420px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head-main { display: flex; align-items: flex-start; gap: 10px; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; font-size: 13px; }

/* 标题 + 状态标签：用 flex 让标签基线与标题文字对齐（不再靠 inline 元素碰运气） */
.page-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  line-height: 1.3;
}
.page-title-text { min-width: 0; overflow-wrap: anywhere; }


.back {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 8px;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  transition: .16s;
}
.back:hover { color: var(--text); border-color: var(--border); background: var(--surface-2); }

.footer {
  padding: 18px 26px 26px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
}

/* ---------- 卡片 ---------- */

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0)) , var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card + .card,
.card + .stat-row,
.stat-row + .card,
.chart-grid + .card,
.card + .chart-grid { margin-top: 18px; }

/* 网格内部由 gap 控制间距，不能再叠加相邻兄弟的 margin */
.grid > .card + .card,
.chart-grid > .card + .card,
.stat-row > .stat-card + .stat-card { margin-top: 0; }

.card-title { font-size: 14px; margin-bottom: 14px; }
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title-row .card-title { margin: 0; }

.empty { text-align: center; padding: 46px 26px; }
.empty h1, .empty h2 { margin-bottom: 8px; }
.empty .empty-icon {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.empty p { margin-bottom: 18px; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, transform .08s, color .16s;
}

.btn:hover { background: #1d283c; border-color: #2c3d5c; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 42px; }

.btn-primary {
  background: linear-gradient(180deg, #5a94ff, #3f7bf0);
  border-color: #4a83f5;
  color: #fff;
  box-shadow: 0 8px 22px -12px rgba(79,140,255,1);
}
.btn-primary:hover { background: linear-gradient(180deg, #6b9fff, #4b86f5); border-color: #5b8ff8; }

.btn-ghost { background: transparent; border-color: var(--border-soft); color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: rgba(255,92,114,.1); border-color: rgba(255,92,114,.3); color: #ff8b9b; }
.btn-danger:hover { background: rgba(255,92,114,.18); border-color: rgba(255,92,114,.5); color: #ffa3b0; }

.inline { display: inline-flex; margin: 0; }

/* ---------- 表单 ---------- */

.stack { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.field > span,
.field > label { font-size: 12.5px; font-weight: 550; color: var(--text-dim); }
.field .req { color: var(--danger); font-weight: 700; }
/* 字段下方的说明文字：弱于字段标题 */
.field > .field-hint { font-weight: 400; font-size: 11.5px; line-height: 1.6; color: var(--text-mute); }

.field input,
.field select {
  height: 40px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid #2b3a55;
  background: #0d1420;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .16s, box-shadow .16s;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5L6 8.5L10 4.5' fill='none' stroke='%238fa1bd' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}

.field input::placeholder { color: #55647c; }
.field input:hover,
.field select:hover { border-color: #364866; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,140,255,.16);
}

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 0; min-width: 180px; }

.form-card { max-width: 660px; margin: 0 auto; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }

/* 编辑页：表单卡片与信息卡片同宽 */
.page-stack { max-width: 660px; margin: 0 auto; }

/* ---------- 登录 ---------- */

.auth-wrap { display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 390px; padding: 34px 30px 30px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head h1 { font-size: 20px; }
.auth-head p { margin-top: 6px; font-size: 13px; }

/* ---------- 提示 ---------- */

.alert {
  padding: 11px 15px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.alert-success { border-color: rgba(61,220,151,.32); background: rgba(61,220,151,.09); color: #86f0c0; }
.alert-error   { border-color: rgba(255,92,114,.32); background: rgba(255,92,114,.09); color: #ff9dab; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge-ok   { border-color: rgba(61,220,151,.35); color: #6fe9b4; background: rgba(61,220,151,.1); }
.badge-warn { border-color: rgba(255,181,71,.35); color: #ffc46e; background: rgba(255,181,71,.1); }

/* ---------- 服务器卡片列表 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.server-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}

.server-card:hover {
  border-color: #2c3d5c;
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 18px 40px -18px rgba(0,0,0,.75);
}

.server-card.is-online { border-left: 2px solid rgba(61,220,151,.55); }
.server-card.is-offline { border-left: 2px solid rgba(255,92,114,.35); }
.server-card.is-offline .bar i { background: #3a4557; }
.server-card.is-offline .metric-value { color: var(--text-dim); }
.server-card.is-offline .net em,
.server-card.is-offline .server-card-foot .small { color: var(--text-mute); }
.server-card.is-offline .server-card-foot { border-top-color: var(--border-soft); }
.server-card.is-offline:hover { border-left-color: rgba(255,92,114,.6); }

.server-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.server-title h2 { font-size: 15.5px; margin-bottom: 3px; }
.server-title p { font-size: 12px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status.on { color: #6fe9b4; background: rgba(61,220,151,.1); border: 1px solid rgba(61,220,151,.28); }
.status.on i { box-shadow: 0 0 0 3px rgba(61,220,151,.18); animation: pulse 2.4s ease-in-out infinite; }
.status.off { color: #ff8b9b; background: rgba(255,92,114,.09); border: 1px solid rgba(255,92,114,.26); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(61,220,151,.16); }
  50%      { box-shadow: 0 0 0 5px rgba(61,220,151,.04); }
}

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.metric { display: flex; flex-direction: column; gap: 5px; }
.metric-label { font-size: 11px; color: var(--text-mute); letter-spacing: .03em; text-transform: uppercase; }
.metric-value { font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }

.bar {
  height: 4px;
  border-radius: 99px;
  background: #1c2637;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s ease;
}

.server-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
}

.net { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.net em { font-style: normal; color: var(--accent-2); }
.net em:last-of-type { color: #a78bfa; margin-left: 6px; }

.no-data { padding: 14px 0; text-align: center; }

/* ---------- KEY 展示 ---------- */

.key-card { border-color: rgba(255,181,71,.3); background: linear-gradient(180deg, rgba(255,181,71,.06), transparent), var(--surface); }

.key-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #0a101a;
  border: 1px solid var(--border);
}
.key-box code {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--accent-2);
  letter-spacing: .02em;
}

/* 置顶大号 KEY 卡片：一眼能看清完整 KEY */
.key-card-hero {
  margin-bottom: 20px;
  padding: 22px 24px;
  border-color: rgba(255,181,71,.45);
  background:
    radial-gradient(700px 220px at 6% -40%, rgba(255,181,71,.16), transparent 70%),
    var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 22px 44px -24px rgba(255,181,71,.35);
}

.key-hero-head { display: flex; flex-direction: column; gap: 8px; }
.key-hero-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-hero-title h2 { font-size: 17px; }
.key-hero-tip { font-size: 13px; color: var(--text-dim); max-width: 82ch; }
.key-hero-tip strong { color: #ffc46e; }

.key-box-hero {
  margin-top: 16px;
  padding: 16px 18px;
  gap: 14px;
  border-color: rgba(255,181,71,.35);
  background: #080d15;
}
.key-box-hero code {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 600;
  color: #ffd699;
  letter-spacing: .04em;
  /* 完整显示，不省略、不换行；窄屏时横向滚动 */
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.key-hero-foot {
  margin-top: 13px;
  font-size: 12px;
  color: var(--text-mute);
}


/* ---------- 详情页 ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 17px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent), var(--surface);
  box-shadow: var(--shadow);
}

.stat-label { font-size: 11.5px; color: var(--text-mute); letter-spacing: .04em; }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.chart-card { padding: 18px 18px 12px; }

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chart-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-mute); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.cpu  { background: var(--accent); }
.dot.mem  { background: var(--accent-2); }
.dot.disk { background: var(--warn); }
.dot.up   { background: var(--accent-2); }
.dot.down { background: #a78bfa; }

.chart-body { position: relative; height: 190px; }
.chart-body canvas { width: 100%; height: 100%; display: block; }

/* ---------- 键值列表 ---------- */

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 9px 18px;
  margin: 0;
  font-size: 13px;
}
.kv dt { color: var(--text-mute); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv code {
  padding: 2px 7px;
  border-radius: 6px;
  background: #0a101a;
  border: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--accent-2);
}

/* ---------- 表格 ---------- */

.table-card { padding: 6px 0 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .04em;
  padding: 10px 18px;
  border-bottom: 1px solid #26334a;
  background: rgba(255,255,255,.022);
  white-space: nowrap;
}
.table td {
  padding: 11px 18px;
  border-bottom: 1px solid #1f2a3d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }

.link { color: var(--accent); }
.link:hover { text-decoration: underline; }

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
}

/* ---------- 代码块 ---------- */

pre {
  margin: 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}

.raw {
  padding: 14px;
  background: #080d15;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: #b9c9e3;
  max-height: 460px;
  overflow: auto;
}

/* ---------- Markdown 文档 ---------- */

.docs { max-width: 900px; margin: 0 auto; }
.docs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
}
.docs-head h1 { font-size: 21px; }
.docs-head p { margin-top: 5px; font-size: 13px; }
.docs-head .btn { flex: none; }

.md { font-size: 13.5px; line-height: 1.75; color: #ccd8ea; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); margin: 26px 0 10px; }
.md h1 { font-size: 21px; }
.md h2 {
  font-size: 17px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.md h3 { font-size: 14.5px; }
.md h4 { font-size: 13.5px; color: var(--text-dim); }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 22px; }
.md li { margin: 5px 0; }
.md hr { border: none; border-top: 1px solid var(--border-soft); margin: 24px 0; }
.md a { color: var(--accent); }
.md a:hover { text-decoration: underline; }
.md code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #0a101a;
  border: 1px solid var(--border-soft);
  color: var(--accent-2);
  font-size: 12px;
}
.md .md-code {
  padding: 15px 16px;
  margin: 12px 0;
  background: #080d15;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: #b9c9e3;
}
.md .md-code code { background: none; border: none; padding: 0; color: inherit; font-size: 12px; }
.md blockquote {
  margin: 12px 0;
  padding: 10px 15px;
  border-left: 3px solid var(--accent);
  background: rgba(79,140,255,.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
}

.md-table { overflow-x: auto; margin: 14px 0; }
.md-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.md-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 600;
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.md-table td {
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  vertical-align: top;
}
.md-table code { white-space: nowrap; }

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .docs-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .docs-head .btn { align-self: flex-start; }
  .topbar { gap: 10px; padding: 0 12px; height: auto; min-height: 54px; flex-wrap: wrap; }
  .brand-text { font-size: 14px; }
  .brand-text em { display: none; }
  .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
  .topnav { gap: 0; margin-left: 0; order: 3; width: 100%; padding-bottom: 8px; }
  .topnav a { padding: 6px 8px; font-size: 12.5px; }
  .topbar-right { margin-left: auto; border-left: none; padding-left: 0; }
  .container { padding: 18px 12px 40px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 20px; }
  .chart-grid { gap: 12px; }
  .chart-body { height: 165px; }
  .card { padding: 16px; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dt { margin-top: 9px; }
  .kv dd { margin-bottom: 3px; }
  .table th, .table td { padding: 10px 12px; }
  .table { font-size: 12px; }
  .page-head h1 { font-size: 19px; }
  .page-head-actions { width: 100%; }
  .chart-card { padding: 15px 14px 10px; }
}

@media (max-width: 420px) {
  .topnav a { font-size: 12px; padding: 6px 6px; }
  .stat-row { grid-template-columns: 1fr; }
}

/* ============================================================
   安装向导
   ============================================================ */

body.centered .container.narrow { max-width: 620px; }

.install-wrap { width: 100%; padding: 32px 0 48px; }

.install-head { text-align: center; margin-bottom: 22px; }
.install-head h1 { font-size: 21px; }
.install-head p { margin-top: 6px; font-size: 13px; }

.install-card { margin-bottom: 16px; }

.check-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.check-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}
.check-list li:last-child { border-bottom: none; }
.check-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.check-list li.ok .check-icon { background: rgba(61,220,151,.16); color: #6fe9b4; }
.check-list li.bad .check-icon { background: rgba(255,92,114,.16); color: #ff8b9b; }
.check-label { color: var(--text-dim); }
.check-value { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--text); }
.check-hint { flex-basis: 100%; padding-left: 26px; font-size: 11.5px; color: #ff8b9b; }

.install-card .card-title { font-size: 13px; color: var(--text-dim); }
/* 只用直接子元素：.field-row 内部的兄弟 .field 由 flex 排版，不能再加 margin，
   否则同一行的第二个输入框会整体下沉 14px，出现"没对齐"的观感 */
.install-card > .field + .field,
.install-card > .field-row + .field,
.install-card > .field + .field-row,
.install-card > .field-row + .field-row { margin-top: 14px; }
.install-card .field-row { align-items: flex-start; }
.install-card .field-row > .field + .field { margin-top: 0; }

.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: linear-gradient(180deg, #5a94ff, #3f7bf0); border-color: #4a83f5; }

/* ============================================================
   自绘弹窗（替代 window.confirm / alert / prompt）
   ============================================================ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4,7,12,.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .16s ease;
}

.modal-mask.is-open { opacity: 1; }

.modal {
  width: 100%;
  max-width: 420px;
  padding: 22px 22px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0)), var(--surface-2);
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 30px 60px -20px rgba(0,0,0,.85);
  transform: translateY(8px) scale(.985);
  transition: transform .18s cubic-bezier(.2,.8,.3,1);
}

.modal-mask.is-open .modal { transform: translateY(0) scale(1); }

.modal-title { font-size: 16px; margin-bottom: 10px; }
.modal-body { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }
.modal-body code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #0a101a;
  border: 1px solid var(--border-soft);
  color: var(--accent-2);
  font-size: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-danger { background: linear-gradient(180deg, #ff6b7f, #ef4d64); border-color: #f25d72; color: #fff; }
.modal-danger:hover { background: linear-gradient(180deg, #ff7d8f, #f75c72); border-color: #ff7d8f; }

/* 弹窗内的小提示条 */
.modal-note {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid rgba(255,181,71,.3);
  background: rgba(255,181,71,.08);
  color: #ffc46e;
}

@media (max-width: 720px) {
  .modal { padding: 18px 16px 14px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .key-box-hero { flex-direction: column; align-items: stretch; }
  .key-box-hero code {
    font-size: 15px;
    /* 窄屏改用换行，保证整条 KEY 一眼看全（而不是被裁掉/需要横向滚动） */
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    overflow-x: visible;
  }
}

