:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
a { color:var(--primary); text-decoration:none; }
a:hover { text-decoration:underline; }

.topbar { background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20; }
.topbar-inner { max-width:1200px; margin:0 auto; padding:0 20px; height:60px; display:flex; align-items:center; justify-content:space-between; }
.brand { display:flex; align-items:center; gap:9px; font-size:17px; font-weight:700; color:var(--text); }
.brand:hover { text-decoration:none; }
.brand-mark { display:inline-flex; width:30px; height:30px; border-radius:8px; background:linear-gradient(135deg,#6366f1,#4338ca); color:#fff; align-items:center; justify-content:center; font-weight:800; }
.topnav { display:flex; align-items:center; gap:18px; }
.topnav a { color:var(--muted); font-weight:500; }
.topnav a:hover { color:var(--primary); text-decoration:none; }
.nav-user { color:var(--text); font-weight:600; padding:4px 10px; background:var(--primary-soft); border-radius:20px; }
.nav-logout { color:var(--danger) !important; }

.demo-banner { background:#fff7ed; border-bottom:1px solid #fed7aa; color:#9a3412; text-align:center; padding:7px 16px; font-size:13px; }

.container { max-width:1200px; margin:0 auto; padding:28px 20px 60px; min-height:calc(100vh - 150px); }
.footer { border-top:1px solid var(--border); background:#fff; color:var(--muted); display:flex; justify-content:space-between; padding:16px 24px; font-size:12px; }

.flash-list { margin-bottom:18px; }
.flash { padding:11px 16px; border-radius:8px; margin-bottom:8px; border:1px solid transparent; font-size:13px; }
.flash.success { background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.flash.danger  { background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.flash.warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }
.flash.info    { background:#eff6ff; border-color:#bfdbfe; color:#1e40af; }

h1,h2,h3 { margin:0 0 12px; font-weight:700; }
h1 { font-size:26px; }
h2 { font-size:20px; }
h3 { font-size:16px; }
.subtitle { color:var(--muted); margin-top:-6px; }

.card { background:var(--card); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); padding:22px; margin-bottom:20px; }
.card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-head h2,.card-head h3 { 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)); }
@media (max-width:900px){ .grid-2,.grid-3,.grid-4 { grid-template-columns:1fr; } }

.hero { background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; border-radius:16px; padding:46px 40px; margin-bottom:28px; }
.hero h1 { font-size:34px; margin-bottom:10px; }
.hero p { font-size:16px; opacity:.9; max-width:640px; }
.hero-actions { margin-top:22px; display:flex; gap:12px; }

.plan { position:relative; display:flex; flex-direction:column; }
.plan .plan-name { font-size:18px; font-weight:700; }
.plan .price { font-size:30px; font-weight:800; color:var(--primary); margin:10px 0; }
.plan .price small { font-size:13px; color:var(--muted); font-weight:500; }
.plan ul { list-style:none; padding:0; margin:0 0 18px; color:var(--muted); }
.plan ul li { padding:5px 0; border-bottom:1px dashed var(--border); }
.plan .btn { margin-top:auto; }

.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:9px 16px; border-radius:8px; border:1px solid var(--border); background:#fff; color:var(--text); font-size:14px; font-weight:500; cursor:pointer; }
.btn:hover { text-decoration:none; opacity:.9; }
.btn-primary { background:var(--primary); color:#fff; border-color:var(--primary); }
.btn-primary:hover { background:var(--primary-dark); }
.btn-danger { background:#fff; color:var(--danger); border-color:#fecaca; }
.btn-success { background:#fff; color:var(--success); border-color:#bbf7d0; }
.btn-sm { padding:5px 11px; font-size:12px; border-radius:6px; }
.btn-white { background:#fff; color:var(--primary); border-color:#fff; }
.btn-block { width:100%; }

.form-group { margin-bottom:16px; }
.form-group label { display:block; font-weight:600; margin-bottom:6px; font-size:13px; }
.form-control { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px; background:#fff; font-family:inherit; }
.form-control:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
textarea.form-control { min-height:320px; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; line-height:1.5; }
.form-hint { color:var(--muted); font-size:12px; margin-top:5px; }
.inline-form { display:inline; }

table { width:100%; border-collapse:collapse; font-size:13px; }
th { text-align:left; padding:10px 12px; background:#f9fafb; color:var(--muted); font-weight:600; border-bottom:1px solid var(--border); white-space:nowrap; }
td { padding:11px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td { border-bottom:none; }
.table-wrap { overflow-x:auto; }
.badge { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; }
.badge.active,.badge.unused,.badge.success { background:#dcfce7; color:#166534; }
.badge.suspended,.badge.warning { background:#fef3c7; color:#92400e; }
.badge.expired,.badge.disabled,.badge.danger,.badge.used { background:#fee2e2; color:#991b1b; }
.badge.info { background:#dbeafe; color:#1e40af; }
.mono { font-family:ui-monospace,Menlo,Consolas,monospace; }
.muted { color:var(--muted); }
.small { font-size:12px; }

.stat { display:flex; flex-direction:column; }
.stat .num { font-size:30px; font-weight:800; }
.stat .label { color:var(--muted); font-size:13px; }

.kv { display:grid; grid-template-columns:140px 1fr; gap:9px 14px; }
.kv dt { color:var(--muted); }
.kv dd { margin:0; font-weight:500; word-break:break-all; }

.code-box { background:#f8fafc; border:1px dashed var(--border); border-radius:8px; padding:14px; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; word-break:break-all; line-height:1.9; }

.auth-wrap { max-width:430px; margin:30px auto; }
.empty { text-align:center; color:var(--muted); padding:40px 20px; }
.section-title { display:flex; align-items:center; gap:10px; margin:26px 0 14px; }
.section-title::after { content:''; flex:1; height:1px; background:var(--border); }

/* 后台 */
.admin-layout { display:grid; grid-template-columns:220px 1fr; gap:22px; }
.sidebar { background:#111827; border-radius:12px; padding:14px; color:#d1d5db; align-self:start; position:sticky; top:80px; }
.sidebar a { display:block; padding:9px 13px; border-radius:8px; color:#d1d5db; margin-bottom:3px; font-weight:500; }
.sidebar a:hover { background:#1f2937; color:#fff; text-decoration:none; }
.sidebar a.active { background:var(--primary); color:#fff; }
.sidebar .side-title { color:#6b7280; font-size:11px; padding:8px 13px; text-transform:uppercase; letter-spacing:1px; }
@media (max-width:900px){ .admin-layout { grid-template-columns:1fr; } .sidebar { position:static; } }
