/* Chengbuwan FreeSSL - 扁平工具风 */

:root {
  --ink: #1d2129;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #e5e6eb;
  --line-2: #f2f3f5;
  --brand: #1677ff;
  --brand-hover: #4096ff;
  --brand-weak: #e8f3ff;
  --bg: #f5f6f8;
  --ok: #389e0d;
  --ok-bg: #f6ffed;
  --ok-line: #b7eb8f;
  --warn: #d46b08;
  --warn-bg: #fff7e6;
  --warn-line: #ffd591;
  --err: #cf1322;
  --err-bg: #fff1f0;
  --err-line: #ffa39e;
}

* { box-sizing: border-box; }

/* 保证任何 hidden 元素真正不可见、不拦截点击 */
[hidden] { display: none !important; }

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

.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }

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

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.brand svg { flex: none; }
.brand b { font-weight: 700; color: var(--brand); }

.tabs { display: flex; gap: 26px; align-self: stretch; }
.tab {
  background: none;
  border: none;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  padding: 0 2px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

.pill {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  padding: 0 6px;
  border-radius: 8px;
  margin-left: 2px;
  vertical-align: 2px;
}

/* ---------- 主体 ---------- */

main.wrap { padding-top: 22px; padding-bottom: 44px; }

.page-head { margin: 2px 0 16px; }
.page-head h1 { font-size: 21px; font-weight: 600; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-3); font-size: 13.5px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 14px;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.step-head h2 { font-size: 15.5px; font-weight: 600; margin: 0; }
.step-num {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-weak);
  color: var(--brand);
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  flex: none;
}
.step-num.ok { background: var(--ok-bg); color: var(--ok); }

.lbl { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 14px 0 6px; }
.lbl .muted { font-weight: 400; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

textarea, select {
  width: 100%;
  border: 1px solid #d9dce3;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
select { height: 36px; }
textarea { padding: 8px 10px; min-height: 78px; resize: vertical; font: 13px/1.6 ui-monospace, Consolas, monospace; }
textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(22, 119, 255, .12); }

.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.check { display: flex; align-items: center; gap: 7px; margin: 14px 0 2px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); flex: none; }

.captcha-area { margin-top: 16px; }
.captcha-area .lbl { margin-top: 0; }
#captcha-box { min-height: 40px; display: flex; align-items: center; }
#captcha-box:empty::before { content: '加载中…'; color: var(--ink-3); font-size: 13px; }

.field-err { color: var(--err); font-size: 12.5px; margin: 6px 0 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border: 1px solid #d9dce3;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: none;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.big { width: 100%; height: 42px; font-size: 15px; font-weight: 500; margin-top: 16px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--brand); }
.btn.small { height: 28px; padding: 0 12px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: #d9dce3; color: var(--ink); }
.btn.primary:disabled:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- 提示与状态 ---------- */

.hint {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.hint code { background: var(--line-2); padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.hint ol, .hint ul { margin: 6px 0 0; padding-left: 20px; }

.banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: 6px;
  padding: 9px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.verify-status { margin-top: 12px; font-size: 13px; }
.verify-status:empty { margin-top: 0; }
.status-line {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.status-line.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.status-line.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.status-line.err { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }

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

.table-scroll { overflow-x: auto; }
.challenge-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.challenge-table th, .challenge-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.challenge-table th {
  background: #f7f8fa;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
code.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  background: var(--line-2);
  padding: 2px 6px;
  border-radius: 3px;
  word-break: break-all;
}
.copy-btn {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 6px;
  white-space: nowrap;
}
.copy-btn:hover { text-decoration: underline; }

/* ---------- 徽章 ---------- */

.badge {
  display: inline-block;
  padding: 0 8px;
  font-size: 12px;
  line-height: 20px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge.err { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.badge.mute { background: var(--line-2); border-color: var(--line); color: var(--ink-2); }

/* ---------- 签发结果 / 我的证书 ---------- */

#cert-info .cert-meta {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 16px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 13.5px;
}
#cert-info .cert-meta b { color: var(--ink-3); font-weight: 400; white-space: nowrap; }

.cert-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 16px;
  margin-bottom: 10px;
}
.cert-item .ci-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cert-item .ci-domains { font-weight: 600; font-size: 14px; word-break: break-all; }
.cert-item .ci-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.cert-item .ci-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cert-item .ci-actions .btn { height: 30px; padding: 0 12px; font-size: 12.5px; }

.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.list-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; }
.empty { color: var(--ink-3); text-align: center; padding: 28px 0; font-size: 13.5px; }

/* ---------- 页脚 / 浮层 ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 16px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  background: rgba(29, 33, 41, .92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  max-width: 86vw;
  z-index: 99;
}

@media (max-width: 640px) {
  .row3 { grid-template-columns: 1fr; }
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 8px 0; gap: 4px 16px; }
  .tabs { align-self: auto; gap: 18px; }
  .tab { padding: 6px 2px; }
  .page-head h1 { font-size: 19px; }
  .card { padding: 16px; }
}
