:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1f6feb;
  --brand-ink: #0b4fbe;
  --accent: #0f9d8a;
  --danger: #d7263d;
  --ok: #12805c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); letter-spacing: -.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: .35rem 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: .82rem; }
.muted { color: var(--muted); }
.ok-line { color: var(--ok); font-weight: 600; }
.warn { color: #a15c00; background: #fff7e6; border: 1px solid #f5d9a8; padding: .5rem .7rem; border-radius: 8px; }
.inline { display: inline; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--ink); letter-spacing: -.02em; display: inline-flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--accent)); display: inline-block; }
.nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav a, .nav button.link { color: var(--ink); font-size: .92rem; }
.nav .admin-link { color: var(--accent); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
button.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid transparent; border-radius: 10px; padding: .62rem 1.05rem;
  background: var(--brand); color: #fff; font-weight: 600; font-size: .94rem;
  cursor: pointer; text-decoration: none; transition: transform .05s ease, background .15s ease;
}
.btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f0f2f7; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b21e32; }
.btn.full { width: 100%; }
.btn-sm { padding: .35rem .62rem; font-size: .82rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.flash { margin: 1rem clamp(1rem, 4vw, 3rem) 0; padding: .7rem 1rem; border-radius: 10px; font-size: .92rem; }
.flash.err { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.flash.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }

main { padding: clamp(1.2rem, 4vw, 3rem); max-width: 1180px; margin: 0 auto; }
.section { margin: clamp(2rem, 6vw, 4rem) 0; }
.section-sub { color: var(--muted); }
.section.narrow { max-width: 760px; }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; padding: clamp(1.5rem, 5vw, 3.5rem) 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; color: var(--accent); margin-bottom: .6rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 44ch; }
.hero-actions { display: flex; gap: .8rem; margin: 1.4rem 0; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2rem; margin: 1.6rem 0 0; padding: 0; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats dt { font-size: 1.4rem; font-weight: 800; }
.hero-stats dd { margin: 0; color: var(--muted); font-size: .82rem; }

.hero-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.mock-titlebar { display: flex; gap: 6px; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.mock-titlebar span { width: 10px; height: 10px; border-radius: 50%; background: #e2e5ec; }
.mock-body { padding: 1.1rem; display: flex; flex-direction: column; gap: .6rem; }
.mock-line { height: 10px; border-radius: 6px; background: linear-gradient(90deg, #eef1f7, #f7f8fb); }
.mock-line.w45 { width: 45%; } .mock-line.w60 { width: 60%; } .mock-line.w70 { width: 70%; } .mock-line.w75 { width: 75%; } .mock-line.w85 { width: 85%; }
.mock-badge { align-self: flex-start; font-size: .75rem; color: #0f766e; background: #ccfbf1; padding: .25rem .6rem; border-radius: 999px; }
.mock-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.step, .plan, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; box-shadow: var(--shadow);
}
.step .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #eef4ff; color: var(--brand); font-weight: 800; margin-bottom: .5rem; }
.step p { color: var(--muted); font-size: .92rem; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.plan .price { font-size: 2.2rem; font-weight: 800; margin: .2rem 0 .4rem; letter-spacing: -.03em; }
.plan .price span { font-size: 1.1rem; vertical-align: top; margin-right: 2px; }
.plan .price small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.plan-desc { color: var(--muted); font-size: .9rem; min-height: 2.6em; }
.plan-list { margin: .6rem 0 1.1rem; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }
.notes { color: var(--muted); font-size: .92rem; }
.notes li { margin: .4rem 0; }

.auth-wrap { display: grid; place-items: center; min-height: 60vh; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.4rem, 4vw, 2.2rem); box-shadow: var(--shadow); }
.auth-card form { display: grid; gap: .9rem; margin-top: 1.2rem; }
.auth-alt { margin-top: 1rem; font-size: .82rem; color: var(--muted); text-align: center; }
.devcode { background: #fff7e6; border: 1px dashed #f5c46b; padding: .6rem .8rem; border-radius: 8px; margin-top: 1rem; font-size: .9rem; }

label { display: grid; gap: .35rem; font-size: .85rem; font-weight: 600; color: #374151; }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #bfd3ff; border-color: var(--brand); }

.dash-head, .admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.big-ok { font-size: 1.9rem; font-weight: 800; color: var(--ok); margin: 0; }
.big-muted { font-size: 1.9rem; font-weight: 800; color: var(--muted); margin: 0; }
.actions { display: flex; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }
.tag { display: inline-block; padding: .12rem .45rem; border-radius: 6px; background: #eef1f7; color: #374151; font-size: .74rem; font-weight: 600; vertical-align: middle; }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-wait { background: #fef3c7; color: #92400e; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.ops { white-space: nowrap; }
td.ops form { margin-right: .3rem; margin-bottom: .25rem; }

.checkout { max-width: 760px; }
.checkout-head { margin-bottom: 1rem; }
.pay-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; margin: 1rem 0; }
.pay-form { margin: 1rem 0; }
.success { border-color: #a7f3d0; background: #f0fdf4; }

.admin { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; max-width: 1360px; }
.sidebar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; align-self: start; position: sticky; top: 76px; }
.sidebar-title { font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sidebar a { display: block; padding: .4rem .55rem; border-radius: 8px; color: var(--ink); font-size: .92rem; }
.sidebar a:hover { background: #f1f4fa; text-decoration: none; }
.sidebar a.active { background: #eef4ff; color: var(--brand); font-weight: 700; }
.admin-main { min-width: 0; }
.admin-user { display: flex; gap: .8rem; align-items: center; }
.admin .card { margin-bottom: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.stat span { font-size: 1.45rem; font-weight: 800; }
.stat p { margin: 0; color: var(--muted); font-size: .8rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.form-row label { flex: 1 1 150px; }
.form-row .btn { margin-bottom: 2px; }
.detail-row td { background: #fbfcfe; }
details summary { cursor: pointer; color: var(--brand); font-size: .85rem; margin-bottom: .6rem; }
.plan-edit { margin-bottom: .6rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem 3rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .steps, .grid-2 { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; gap: .2rem; }
  .sidebar-title, .sidebar hr, .sidebar .muted { display: none; }
  .sidebar a { padding: .35rem .6rem; }
  .hero-stats { gap: 1.2rem; }
}

/* mode A / mode B access page */
.mode-active { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.code-block {
  background: #0f1720; color: #d7e2ec; padding: .8rem 1rem; border-radius: 10px;
  overflow-x: auto; font-size: .8rem; line-height: 1.55; white-space: pre;
}
.form-row .grow { flex: 2 1 22rem; }
