/* ============ WPS超级会员 · 虚拟主机版 样式 ============ */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
  --sidebar-w: 236px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
code, .mono { font-family: var(--mono); }
.ico { width: 18px; height: 18px; flex: 0 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 11px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: #334155; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 17px; height: 17px; opacity: .9; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; text-transform: uppercase; flex: 0 0 auto;
}
.who-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who-text strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: var(--muted); font-size: 11px; }
.logout { color: var(--muted); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.logout:hover { background: var(--danger-soft); color: var(--danger); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 600; font-size: 14px; }
.topbar-side { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-link { color: var(--muted); font-size: 13px; }
.menu-btn { display: none !important; }
.content { padding: 24px; max-width: 1220px; width: 100%; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; letter-spacing: -.2px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-hd { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-hd h2, .card-hd h3 { font-size: 14px; }
.card-hd .card-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-bd { padding: 18px; }
.card-bd.p0 { padding: 0; }
.card-ft { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.card + .card { margin-top: 16px; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; line-height: 1.2; }
.stat-sub { color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
.stat .ico { width: 17px; height: 17px; }
.stat-primary .stat-value { color: var(--primary); }
.stat-success .stat-value { color: var(--success); }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warning); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: #fff; color: #1e293b; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: #f8fafc; border-color: #b6c2d2; color: var(--text); }
.btn:active { transform: translateY(.5px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .25); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #fca5a5; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-sm .ico { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.icon-btn .ico { width: 16px; height: 16px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 15px; }
.field > label, .label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: #1e293b; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  padding: 9px 12px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.input-sm { height: 32px; padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.input-w-sm { max-width: 120px; }
.input-w-md { max-width: 220px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 15px; }
.switch-row .t { font-weight: 500; }
.switch-row .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #334155; cursor: pointer; }
.checkbox input { margin-top: 3px; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  background: #f8fafc; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { vertical-align: middle; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px;
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: #334155;
}

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-muted { background: #f1f5f9; color: var(--muted); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

/* ---------- 空状态 ---------- */
.spinner-sm { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 54px; height: 54px; border-radius: 50%; background: #f1f5f9; display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted-2); }
.empty .empty-icon .ico { width: 26px; height: 26px; }
.empty p { font-size: 13px; }

/* ---------- 提示条 ---------- */
.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-success { background: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.alert-info { background: var(--primary-soft); border-color: #bfdbfe; color: #1e40af; }
.alert-warn { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .3); animation: toastIn .18s ease-out; word-break: break-word;
}
.toast-success { background: #14532d; }
.toast-error { background: #7f1d1d; }
.toast-info { background: #1e3a8a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 弹窗 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-root[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal {
  position: relative; background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-hd h3 { font-size: 15px; }
.modal-bd { padding: 18px; overflow-y: auto; }
.modal-ft { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-wide { max-width: 680px; }

/* ---------- 分页/筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; gap: 2px; }
.seg a { padding: 5px 11px; border-radius: 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.seg a.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15,23,42,.1); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 6px; align-items: center; }
.page-link { min-width: 30px; height: 30px; padding: 0 9px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; color: #334155; font-size: 12.5px; }
.page-link.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* ---------- 商品 ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.product { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.product-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.product-name { font-size: 15px; font-weight: 600; }
.product-price { background: var(--primary-soft); color: var(--primary); font-weight: 600; border-radius: 8px; padding: 3px 9px; font-size: 12.5px; white-space: nowrap; }
.product-meta { color: var(--muted); font-size: 13px; }
.product-meta strong { color: var(--text); }
.product .btn { margin-top: auto; }
.points-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; box-shadow: var(--shadow); }
.points-pill .v { font-size: 17px; font-weight: 700; }

/* ---------- 分组卡（我的卡密） ---------- */
.group-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.group-hd h3 { font-size: 14px; }
.link-list { display: flex; flex-direction: column; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.link-row:first-child { border-top: 0; }
.link-url { font-family: var(--mono); font-size: 12.5px; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-remark { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- 登录页 ---------- */
.auth-body { background: radial-gradient(1000px 500px at 50% -10%, #e8efff 0%, var(--bg) 55%); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .auth-mark {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 12px;
  background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, .3);
}
.auth-brand .auth-mark .ico { width: 26px; height: 26px; }
.auth-brand h1 { font-size: 22px; letter-spacing: -.3px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth-notice { margin-top: 12px; background: var(--primary-soft); border: 1px solid #bfdbfe; color: #1e40af; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; text-align: center; }

/* ---------- 其他 ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid > form.card + form.card { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; font-family: var(--mono); font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.scroll-box { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.file-drop { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; background: #f8fafc; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.preview-stats { display: flex; flex-wrap: wrap; gap: 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--muted); }
.preview-stats b { color: var(--text); font-size: 14px; }
.preview-stats .bad b { color: var(--danger); }
.mono-block { font-family: var(--mono); font-size: 12px; background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; overflow: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid !important; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 28px; }
  .grid-cards { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 19px; }
}
@media (max-width: 540px) {
  .stats { gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
  .btn { height: 34px; padding: 0 11px; }
  .card-bd { padding: 14px; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; }
  .modal-bd { padding: 14px; }
}