:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e9ef;
  --brand: #0e9f6e;
  --brand-dark: #0b8a5f;
  --brand-soft: #e8f8f1;
  --warn: #f59e0b;
  --danger: #e11d48;
  --radius: 12px;
  --sidebar: 230px;
}

* { box-sizing: border-box; }

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

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

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

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

/* ---------------- 侧边栏 ---------------- */

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #0b1220;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  color: #fff;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #10b981, #0e9f6e);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.brand b { display: block; font-size: 15px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: #7c8aa0; letter-spacing: .06em; }

.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px; color: #5b6b82; letter-spacing: .08em;
  padding: 14px 10px 6px; text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #aebccd;
  font-size: 13.5px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(16,185,129,.14); color: #6ee7b7; font-weight: 500; }
.nav-link .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 12.5px;
}
.sidebar-foot .who { color: #e2e8f0; font-weight: 500; }
.sidebar-foot .mail { color: #6b7c93; font-size: 11.5px; word-break: break-all; }
.sidebar-foot a { color: #8fa0b6; }
.sidebar-foot a:hover { color: #fff; text-decoration: none; }

/* ---------------- 主区域 ---------------- */

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

.container { padding: 24px 28px 56px; max-width: 1240px; width: 100%; }

.flash {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  border: 1px solid;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.flash-error { background: #fff1f2; border-color: #fecdd3; color: #be123c; }

/* ---------------- 卡片与栅格 ---------------- */

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-21 { grid-template-columns: 1.8fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14.5px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 12px 20px; }

.metric { padding: 18px 20px; }
.metric-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.metric-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-good { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-mid { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-low { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #b7ead6; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecdd3; background: #fff; }
.btn-danger:hover { background: #fff1f2; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-link {
  border: 0; background: none; color: var(--brand-dark);
  font-size: 12.5px; cursor: pointer; padding: 0;
}
.btn-link:hover { text-decoration: underline; }

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

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfdfe; }
.table .num { font-variant-numeric: tabular-nums; }

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

.form-row { margin-bottom: 16px; }
.label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid #dbe1e8;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14,159,110,.12);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* ---------------- 图表 ---------------- */

.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar-fill.alt { background: #94a3b8; }
.bar-value { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------- 其他 ---------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 14px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 500; }
.tab:hover { text-decoration: none; color: var(--ink); }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 8px; }
.empty p { margin: 0 0 18px; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.list-item:last-child { border-bottom: 0; }
.list-item .host { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .3s ease; }

.answer-text {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  margin-bottom: 16px;
}

/* ---------------- 落地页 ---------------- */

.landing { background: #fff; }
.landing-nav {
  max-width: 1120px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.landing-nav .brand { color: var(--ink); padding: 0; }
.landing-nav .brand b { color: var(--ink); }
.landing-nav .brand small { color: var(--muted); }
.hero { max-width: 1120px; margin: 0 auto; padding: 64px 24px 48px; }
.hero-inner { max-width: 720px; }
.hero h1 { font-size: 46px; line-height: 1.18; letter-spacing: -0.03em; }
.hero h1 span { color: var(--brand); }
.hero p.lead { font-size: 16.5px; color: var(--muted); margin: 20px 0 30px; line-height: 1.8; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn { height: 44px; padding: 0 22px; font-size: 14px; }
.features { max-width: 1120px; margin: 0 auto; padding: 20px 24px 80px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { border: 1px solid var(--line); border-radius: 14px; padding: 24px; background: var(--surface); }
.feature .idx { font-size: 12px; color: var(--brand); font-weight: 600; letter-spacing: .08em; }
.feature h3 { font-size: 16px; margin: 10px 0 8px; }
.feature p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.75; }
.landing-foot { border-top: 1px solid var(--line); padding: 24px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------------- 登录 / 注册 ---------------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth-aside {
  background: #0b1220; color: #cbd5e1;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside h2 { color: #fff; font-size: 24px; line-height: 1.5; max-width: 360px; }
.auth-aside p { color: #8fa0b6; font-size: 13.5px; line-height: 1.9; max-width: 360px; }
.auth-points { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.auth-points div { font-size: 13px; color: #aebccd; display: flex; gap: 8px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 24px; margin-bottom: 6px; }
.auth-box p.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 26px; }
.auth-box .btn { width: 100%; height: 42px; font-size: 14px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------------- 套餐 / 支付 / API ---------------- */

.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.price-card.featured { border-color: var(--brand); box-shadow: 0 10px 28px rgba(14, 159, 110, .10); }
.price-amount { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 4px; }
.price-amount small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.price-features { list-style: none; padding: 0; margin: 16px 0 20px; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--ink-2); }
.price-features li::before { content: "✓"; color: var(--brand); margin-right: 8px; font-weight: 600; }
.price-card .btn { margin-top: auto; }

.channel-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.channel-option {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  background: var(--surface-2);
}
.channel-option input { accent-color: var(--brand); }
.channel-option b { font-weight: 500; }
.channel-option span { color: var(--muted); font-size: 12px; }

.qr-box {
  width: 212px; height: 212px; margin: 0 auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; display: grid; place-items: center; padding: 8px;
}
.qr-box canvas, .qr-box img { display: block; }

.code-block {
  background: #0b1220; color: #dbe4f0;
  border-radius: 10px; padding: 16px 18px;
  font-family: ui-monospace, Consolas, "SF Mono", monospace;
  font-size: 12.5px; line-height: 1.85;
  overflow-x: auto; white-space: pre;
}

.api-table td code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.section-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.token-box {
  background: var(--brand-soft); border: 1px solid #b7ead6;
  border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  word-break: break-all; color: var(--brand-text);
}

/* ---------------- 报告 ---------------- */

.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.report-head h1 { font-size: 22px; }
.report-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.9; }
.report-section { margin-top: 18px; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-21 { grid-template-columns: 1fr; }
  .report-head { flex-direction: column; align-items: flex-start; }
  .report-head .no-print { justify-content: flex-start; }
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .brand { padding: 14px 16px 8px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 6px 10px 10px; }
  .nav-label, .nav-link .dot { display: none; }
  .nav-link { white-space: nowrap; padding: 7px 12px; }
  .sidebar-foot { display: none; }
  .container { padding: 16px 16px 40px; }
  .topbar { padding: 14px 16px; position: static; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .report-head { flex-direction: column; }
}

@media print {
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: 100%; }
  .card { border-color: #ddd; break-inside: avoid; }
  .app { display: block; }
}
