/* ============================================================
   码通通 · 活码生成器
   企业蓝白主题 (主色 #1D4ED8) + 深/浅双主题
   ============================================================ */

:root {
  --brand: #1D4ED8;
  --brand-600: #2563EB;
  --brand-700: #1D4ED8;
  --brand-800: #1E40AF;
  --brand-soft: #EFF4FF;
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --border: #E2E8F0;
  --border-2: #CBD5E1;
  --ok: #16A34A;
  --warn: #F59E0B;
  --danger: #DC2626;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, .06);
  --maxw: 1120px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --brand: #3B82F6;
  --brand-600: #60A5FA;
  --brand-700: #3B82F6;
  --brand-800: #2563EB;
  --brand-soft: #16233F;
  --bg: #0B1120;
  --surface: #131C30;
  --surface-2: #1B2740;
  --text: #E6EDF7;
  --text-2: #B7C3D6;
  --muted: #8A99B0;
  --border: #27344E;
  --border-2: #34415C;
  --shadow: 0 14px 40px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; color: var(--text-2); word-break: break-all; }
.muted { color: var(--muted); font-size: 13px; }

.page { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* ---------------- 顶部导航 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 40%, transparent);
}
.logo-text { color: var(--text); letter-spacing: .5px; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav-links a {
  color: var(--text-2); padding: 8px 13px; border-radius: 9px; font-size: 15px; font-weight: 500;
}
.nav-links a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-user { font-size: 13px; color: var(--muted); white-space: nowrap; }
.theme-toggle { font-size: 16px; line-height: 1; padding: 7px 10px !important; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* ---------------- Hero ---------------- */
.hero {
  max-width: var(--maxw); margin: 0 auto; padding: 64px 20px 48px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center;
}
.badge {
  display: inline-block; background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 700; padding: 5px 13px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: 44px; line-height: 1.18; margin: 0 0 16px; font-weight: 800; letter-spacing: -.5px; }
.grad {
  background: linear-gradient(120deg, var(--brand-600), #7C3AED 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 17px; color: var(--text-2); margin: 0 0 26px; }
.lead strong { color: var(--text); }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 30px; margin-top: 34px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 22px; color: var(--brand); }
.hero-stats span { font-size: 13px; color: var(--muted); }

.hero-qr { display: flex; justify-content: center; }
.qr-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow); text-align: center; width: 260px;
}
.qr-img {
  width: 200px; height: 200px; margin: 0 auto 12px; border-radius: 14px;
  background: var(--surface-2); display: grid; place-items: center; overflow: hidden;
}
.qr-img img { display: block; image-rendering: pixelated; }
.qr-cap { font-weight: 700; font-size: 16px; }
.qr-line { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.qr-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------------- 区块 ---------------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: 56px 20px; }
.section-soft { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sec-title { text-align: center; font-size: 30px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.3px; }
.sec-sub { text-align: center; color: var(--muted); margin: 0 0 36px; font-size: 16px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.feat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease;
}
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feat-ic {
  width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 24px; font-weight: 800; margin-bottom: 14px;
}
.feat h3 { margin: 0 0 8px; font-size: 18px; }
.feat p { margin: 0; color: var(--text-2); font-size: 14.5px; }

/* ---------------- 步骤 ---------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 22px; text-align: center; position: relative;
}
.step-n {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.step h3 { margin: 0 0 8px; font-size: 18px; }
.step p { margin: 0; color: var(--text-2); font-size: 14.5px; }

/* ---------------- 标签 chips ---------------- */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.chip-lg {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 22px; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-sm);
}

/* ---------------- 价格 ---------------- */
.price-grid { max-width: 880px; margin: 0 auto; }
.price-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px 26px; position: relative; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.price-card.price-hot { border-color: var(--brand); box-shadow: 0 16px 40px color-mix(in srgb, var(--brand) 22%, transparent); }
.price-ribbon {
  position: absolute; top: 16px; right: -8px; background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; font-size: 12.5px; font-weight: 700; padding: 5px 14px; border-radius: 6px 0 0 6px;
}
.price-tagline { color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.price-card h3 { margin: 6px 0 6px; font-size: 24px; }
.price-tag { font-size: 34px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.price-desc { color: var(--text-2); font-size: 14px; margin: 0 0 18px; min-height: 42px; }
.price-feat { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.price-feat li { padding: 7px 0 7px 26px; position: relative; color: var(--text-2); font-size: 14.5px; }
.price-feat li::before {
  content: "✓"; position: absolute; left: 0; top: 7px; color: var(--ok); font-weight: 800;
}
.price-note {
  max-width: 880px; margin: 26px auto 0; background: var(--brand-soft); border-radius: 14px;
  padding: 20px 24px; color: var(--text-2); font-size: 14.5px; line-height: 1.8;
}
.price-note b { color: var(--brand); }

/* ---------------- 联系 ---------------- */
.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.contact-ic {
  width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.contact-card b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.contact-card span { font-size: 16px; font-weight: 700; color: var(--text); word-break: break-all; }

/* ---------------- 控制台 ---------------- */
.dash { max-width: var(--maxw); margin: 0 auto; padding: 32px 20px 56px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.dash-head h1 { margin: 0; font-size: 26px; }
.dash-head p { margin: 4px 0 0; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow-sm); }
.stat b { font-size: 28px; color: var(--brand); display: block; }
.stat span { color: var(--muted); font-size: 13px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.card-head h2 { margin: 0; font-size: 18px; }

/* 图表 */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.chart-sm { height: 90px; }
.bar { flex: 1; background: var(--surface-2); border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; min-width: 0; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--brand-600), var(--brand-800)); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; }
.bar:hover .bar-fill { filter: brightness(1.1); }

/* 活码列表 */
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.code-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); align-items: flex-start; }
.code-qr { width: 96px; height: 96px; border-radius: 10px; background: #fff; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.code-qr img { display: block; }
.code-info { flex: 1; min-width: 0; }
.code-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; word-break: break-all; }
.code-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.code-link { font-size: 12px; }
.code-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.tag-success { background: #DCFCE7; color: #15803D; }
.tag-warning { background: #FEF3C7; color: #B45309; }
.tag-primary { background: var(--brand-soft); color: var(--brand); }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); }
.empty a { font-weight: 700; }

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.input, .textarea, select.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border-2); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 15px; font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus, select.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.textarea { resize: vertical; }
.field-tip { font-size: 12.5px; color: var(--muted); }
.form-actions { margin-top: 6px; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-err { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
[data-theme="dark"] .alert-err { background: #3F1D1D; color: #FCA5A5; border-color: #7F1D1D; }

/* ---------------- 登录/注册 ---------------- */
.auth-wrap { max-width: var(--maxw); margin: 0 auto; padding: 64px 20px; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 14px; color: var(--muted); }

/* ---------------- 编辑页 ---------------- */
.edit-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.edit-side { display: flex; flex-direction: column; gap: 20px; }
.sub-upload { margin-top: 22px; border-top: 1px dashed var(--border-2); padding-top: 20px; }
.sub-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.sub-item { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.sub-item img { width: 100%; border-radius: 6px; background: #fff; }
.sub-item button { margin-top: 6px; width: 100%; }
.qr-show .qr-big { width: 200px; height: 200px; margin: 0 auto 14px; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.qr-show .qr-big img { display: block; image-rendering: pixelated; }
.qr-meta { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

/* ---------------- 扫码落地页 ---------------- */
.scan-body {
  background: linear-gradient(160deg, #1E3A8A, #0F172A);
  color: #E6EDF7; min-height: 100vh; display: grid; place-items: center; padding: 24px;
  font-family: var(--font);
}
.scan-wrap { width: 100%; max-width: 440px; }
.scan-card {
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 22px; padding: 32px 26px; text-align: center; backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
.scan-emoji { font-size: 52px; margin-bottom: 10px; }
.scan-brand { font-size: 13px; letter-spacing: 2px; color: #93C5FD; font-weight: 700; margin-bottom: 12px; }
.scan-title { font-size: 24px; margin: 0 0 18px; font-weight: 800; color: #fff; }
.scan-content { background: rgba(255,255,255,.08); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; color: #E6EDF7; white-space: pre-wrap; text-align: left; font-size: 15px; line-height: 1.7; }
.scan-row { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; text-align: left; }
.scan-k { font-size: 13px; color: #93C5FD; font-weight: 700; flex-shrink: 0; }
.scan-v { flex: 1; font-size: 16px; font-weight: 700; color: #fff; word-break: break-all; }
.scan-v:visited { color: #fff; }
.scan-qr { margin: 18px 0 8px; }
.sub-img { width: 220px; max-width: 100%; border-radius: 14px; background: #fff; padding: 10px; }
.scan-qr-tip { font-size: 13px; color: #93C5FD; margin-top: 10px; }
.scan-switch { margin-top: 12px; }
.scan-switch .btn-ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.scan-safe { margin-top: 18px; font-size: 13px; color: #86EFAC; }

/* ---------------- 页脚 ---------------- */
.footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 40px; padding: 40px 20px 24px; }
.foot-inner { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.foot-brand { max-width: 360px; }
.foot-brand p { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.foot-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.foot-cols h4 { margin: 0 0 12px; font-size: 14px; }
.foot-cols a, .foot-cols span { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 7px; }
.foot-copy { max-width: var(--maxw); margin: 28px auto 0; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero h1 { font-size: 34px; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .edit-layout { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav-links { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
}
