/* ===================================================================
   CF SaaS 优选 - 样式表
   无外部依赖，深色主题，支持移动端
   =================================================================== */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c232c;
  --surface-3: #232c37;
  --border:    #2b3541;
  --border-2:  #3a4757;
  --text:      #e6edf3;
  --muted:     #8b98a5;
  --dim:       #6b7885;

  --accent:    #4c8dff;
  --accent-2:  #3a7bf0;
  --accent-dim: #1e3a63;

  --ok:        #3fb950;
  --ok-dim:    #16351f;
  --warn:      #d29922;
  --warn-dim:  #3a2d0d;
  --err:       #f85149;
  --err-dim:   #3d1a18;
  --info:      #58a6ff;
  --info-dim:  #12304d;

  --radius:    10px;
  --radius-sm: 7px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--mono); font-size: 13px; }

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

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.brand-sub {
  font-size: 11px;
  color: var(--dim);
  margin-top: 3px;
  font-family: var(--mono);
}

.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav-group {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dim);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-dim); color: #cfe2ff; font-weight: 500; }
.nav .icon { width: 16px; text-align: center; opacity: .85; }

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--dim);
}
.sidebar-foot a { color: var(--muted); }
.sidebar-foot a:hover { color: var(--text); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content { padding: 22px 24px 60px; max-width: 1180px; width: 100%; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
}
.card-head h2 { font-size: 13.5px; margin: 0; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ---------------- 统计 ---------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.1; font-family: var(--mono); }
.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.err { color: var(--err); }
.stat-value.info { color: var(--info); }
.stat-value.accent { color: var(--accent); }

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge.ok     { color: var(--ok);     background: var(--ok-dim);     border-color: #1f5a2b; }
.badge.warn   { color: var(--warn);   background: var(--warn-dim);   border-color: #57430f; }
.badge.err    { color: var(--err);    background: var(--err-dim);    border-color: #632724; }
.badge.info   { color: var(--info);   background: var(--info-dim);   border-color: #1c4770; }
.badge.accent { color: var(--accent); background: var(--accent-dim); border-color: #26507f; }
.badge.gray   { color: var(--muted);  background: var(--surface-3);  border-color: var(--border-2); }
.badge.plain::before { display: none; }

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

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
td.actions { text-align: right; white-space: nowrap; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, opacity .12s;
  line-height: 1.3;
}
.btn:hover { background: var(--surface-3); border-color: #4a5a6d; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-2); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--accent); }
.btn-danger { color: var(--err); border-color: #632724; background: transparent; }
.btn-danger:hover { background: var(--err-dim); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border-color: var(--border); }

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

.form-row { margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
label.lbl {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
label.lbl .req { color: var(--err); }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,141,255,.15);
}
input::placeholder { color: var(--dim); }
textarea { resize: vertical; min-height: 70px; }
select { cursor: pointer; }

.field-help { font-size: 12px; color: var(--dim); margin-top: 5px; line-height: 1.5; }

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

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.check input { margin-top: 3px; accent-color: var(--accent); }

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

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}
.alert.ok   { background: var(--ok-dim);   border-color: #1f5a2b;  color: #7ee787; }
.alert.warn { background: var(--warn-dim); border-color: #57430f;  color: #e3b341; }
.alert.err  { background: var(--err-dim);  border-color: #632724;  color: #ff9c96; }
.alert.info { background: var(--info-dim); border-color: #1c4770;  color: #9cc9ff; }
.alert strong { font-weight: 600; }
.alert code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 4px; }

/* ---------------- 代码/复制块 ---------------- */

.copy-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 10px;
}
.copy-row .copy-label {
  flex: 0 0 88px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  font-size: 11.5px;
  color: var(--dim);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.copy-row .copy-value {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
  color: #a5d6ff;
  min-width: 0;
}
.copy-row button {
  flex: 0 0 auto;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 13px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.copy-row button:hover { background: var(--surface-3); color: var(--text); }
.copy-row button.done { color: var(--ok); }

pre.block {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  overflow-x: auto;
  margin: 0 0 12px;
  color: #a5d6ff;
  line-height: 1.65;
}

/* ---------------- 步骤 ---------------- */

.steps { list-style: none; padding: 0; margin: 0; }
.steps > li {
  position: relative;
  padding: 0 0 22px 38px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li .dot {
  position: absolute;
  left: -13px;
  top: -2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--mono);
}
.steps > li.done .dot { background: var(--ok-dim); border-color: var(--ok); color: var(--ok); }
.steps > li.current .dot { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.steps > li.error .dot { background: var(--err-dim); border-color: var(--err); color: var(--err); }
.steps > li .step-title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.steps > li .step-desc { font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.steps > li.pending .step-title { color: var(--dim); }

/* ---------------- 键值对展示 ---------------- */

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------------- 空状态 ---------------- */

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: .5; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* ---------------- 独立页（登录/安装/指引） ---------------- */

.standalone {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(76,141,255,.09), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(63,185,80,.06), transparent 45%),
    var(--bg);
}
.panel {
  width: 100%;
  max-width: 470px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.panel.wide { max-width: 720px; }
.panel-title { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.panel-sub { font-size: 13px; color: var(--muted); margin: 0 0 22px; line-height: 1.6; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dim);
  font-weight: 600;
  margin: 24px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.section-title:first-child { margin-top: 0; }

/* ---------------- 工具 ---------------- */

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.mb8 { margin-bottom: 8px; }
.mb16 { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .nav { display: flex; flex-wrap: wrap; padding: 8px; gap: 4px; }
  .nav-group { display: none; }
  .nav a { margin-bottom: 0; }
  .sidebar-foot { display: none; }
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dt { margin-top: 8px; }
}
