/* i30 API — 纯白底、无渐变、全站自适应 */
:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --fg: #0f172a;
  --fg-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #eff6ff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; font-weight: 650; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0 0 1em; color: var(--fg-2); }
small { color: var(--muted); }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--fg); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--fg-2); padding: 8px 12px; border-radius: 8px; font-size: 14px;
}
.nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--fg); }
.nav a.active { color: var(--fg); background: var(--bg-soft); font-weight: 600; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none; margin-left: auto; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--fg); margin: 3px auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--fg);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { color: var(--err); border-color: #fecaca; }
.btn-danger:hover { background: var(--err-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 卡片 / 栅格 ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3, .card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg-soft); }
.table tbody tr:hover { background: var(--bg-soft); }
.table td.wrap { white-space: normal; }
.table .num { font-variant-numeric: tabular-nums; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--fg-2); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; font-size: 14px; color: var(--fg);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; font-family: inherit;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-2); }
.check input { width: 16px; height: 16px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--ok-soft); border-color: #a7f3d0; color: var(--ok); }
.alert-error { background: var(--err-soft); border-color: #fecaca; color: var(--err); }
.alert-info { background: var(--accent-soft); border-color: #bfdbfe; color: var(--accent-2); }

/* ---------- 首页 ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent-2); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: 42px; margin-bottom: 16px; }
.hero .lead { font-size: 17px; color: var(--muted); margin-bottom: 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.code-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); overflow: hidden; }
.code-card .code-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.code-card pre { margin: 0; padding: 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.8; color: var(--fg-2); white-space: pre; }

.code-pre { margin: 0; padding: 16px; overflow-x: auto; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12.5px; line-height: 1.8; color: var(--fg-2); white-space: pre; }
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 28px; }
.section-head p { margin: 0; }

.feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; }
.feature-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-2); display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 14px; }
.feature h3 { font-size: 16px; }
.feature p { margin: 0; font-size: 14px; color: var(--muted); }

.steps { counter-reset: step; display: grid; gap: 18px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num { flex: 0 0 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--fg-2); }
.step h4 { margin: 4px 0 4px; font-size: 15px; }
.step p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px 64px; }
.auth-card { width: 100%; max-width: 400px; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; background: #fff; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-foot { text-align: center; font-size: 14px; color: var(--muted); margin-top: 18px; }

/* ---------- 应用框架（用户中心 / 后台） ---------- */
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 28px; padding: 28px 0 64px; align-items: start; }
.sidebar { position: sticky; top: 84px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.sidebar .side-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px 10px; }
.sidebar a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--fg-2); font-size: 14px; }
.sidebar a:hover { background: var(--bg-soft); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 12px; color: var(--muted); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

.key-value { font-family: var(--mono); font-size: 13px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; word-break: break-all; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.text-right { text-align: right; }
.hr { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

details.inline-form { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
details.inline-form summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form[open] summary { border-bottom: 1px solid var(--line); }
details.inline-form .form-body { padding: 18px; }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--fg-2); }
.pager .current { background: var(--fg); color: #fff; border-color: var(--fg); }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner a { color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { font-size: 36px; }
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
  .sidebar .side-title, .sidebar .side-foot { display: none; }
  .sidebar a { white-space: nowrap; padding: 8px 12px; }
  .sidebar a.active { background: var(--accent-soft); }
}

@media (max-width: 720px) {
  h1 { font-size: 26px; }
  .hero { padding: 44px 0 28px; }
  .hero h1 { font-size: 30px; }
  .hero .lead { font-size: 15px; }
  .section { padding: 40px 0; }
  .nav { display: none; }
  .nav.open { display: flex; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 10px 16px 16px; gap: 2px; }
  .nav-toggle { display: block; }
  .header-actions { margin-left: 0; }
  .header-actions .btn { height: 34px; padding: 0 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .auth-card { padding: 24px; }
  .page-head { flex-direction: column; }
  .footer-inner { flex-direction: column; }

  /* 表格转卡片 */
  .table-responsive table, .table-responsive thead, .table-responsive tbody, .table-responsive th, .table-responsive td, .table-responsive tr { display: block; }
  .table-responsive thead { display: none; }
  .table-responsive tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; padding: 6px 4px; background: #fff; }
  .table-responsive td { border: 0; padding: 8px 12px; white-space: normal; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  .table-responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  .table-responsive td.table-actions { justify-content: flex-end; }
  .table-responsive td.table-actions::before { content: ""; }
  .table-responsive td .key-value { white-space: normal; }
}

@media (max-width: 420px) {
  .container { padding: 0 14px; }
  .stat-value { font-size: 22px; }
}
