/* ==========================================================================
   七星云CDN授权系统 · 样式表
   ========================================================================== */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-line: #bfdbfe;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #16a34a;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 650; line-height: 1.35; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* ---------------- 头部 ---------------- */
.topbar {
  background: linear-gradient(120deg, #0f172a, #1e3a8a 60%, #2563eb);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
}
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  color: rgba(255, 255, 255, .82);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 14px;
}
.topnav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topnav a.on { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .85); }
.topbar-right .u { font-size: 13px; }

/* ---------------- 通用布局 ---------------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 22px 20px 40px; }
.wrap-narrow { max-width: 460px; margin: 0 auto; padding: 38px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; }
.page-head .sub { color: var(--ink-3); font-size: 13px; }
.page-head .spacer { margin-left: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-tight { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.card-head h2 { margin: 0; font-size: 15px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px 20px; }

.grid { display: grid; gap: 16px; }
.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; }
}

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 15px; }
.field > label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field .hint { margin-top: 5px; font-size: 12px; color: var(--ink-3); }
.field .err { margin-top: 5px; font-size: 12px; color: var(--danger); }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { min-height: 76px; resize: vertical; }
input[disabled], select[disabled] { background: #f1f5f9; color: var(--ink-3); }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.row-tight { display: flex; gap: 8px; align-items: center; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #f8fafc; color: var(--ink); border-color: #cbd5e1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #15803d; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--brand); padding: 0; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left;
  padding: 11px 14px;
  background: #f8fafc;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.tb td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.tb tbody tr:hover td { background: #fafbfe; }
table.tb tbody tr:last-child td { border-bottom: none; }
.tb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 46px 20px; text-align: center; color: var(--ink-4); }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: #15803d; border-color: #bbf7d0; }
.badge-warn { background: var(--warn-soft); color: #b45309; border-color: #fde68a; }
.badge-danger { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.badge-info { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-line); }
.badge-gray { background: #f1f5f9; color: var(--ink-3); border-color: var(--line); }
.badge-licensed {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  border: none;
  box-shadow: 0 1px 6px rgba(245, 158, 11, .35);
}

/* ---------------- 提示条 ---------------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert b { font-weight: 700; }
.alert-info { background: var(--brand-soft); color: #1e40af; border-color: var(--brand-line); }
.alert-ok { background: var(--ok-soft); color: #15803d; border-color: #bbf7d0; }
.alert-warn { background: var(--warn-soft); color: #92400e; border-color: #fde68a; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------- 统计卡 ---------------- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 5px; }

/* ---------------- 套餐卡 ---------------- */
.plan {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.plan:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-line); }
.plan .pname { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.plan .pnodes { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.plan .price { font-size: 27px; font-weight: 800; color: var(--brand); letter-spacing: -.8px; }
.plan .price small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.plan .price-alt { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.plan .acts { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; }
.plan .ribbon {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand-line); font-weight: 600;
}

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 90;
  backdrop-filter: blur(2px);
}
.mask.on { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; background: none; border: none; font-size: 21px; color: var(--ink-4); cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfe; }

/* ---------------- 提示浮层 ---------------- */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 26px rgba(15, 23, 42, .18);
  animation: drop .18s ease-out;
  max-width: 90vw;
}
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-ok { background: #065f46; color: #fff; }
.toast-err { background: #991b1b; color: #fff; }
.toast-info { background: #1e293b; color: #fff; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 16px 0 4px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; text-align: center; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px;
}
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager span.dis { color: var(--ink-4); background: #f8fafc; }

/* ---------------- 页脚 ---------------- */
.footer { text-align: center; color: var(--ink-4); font-size: 12.5px; padding: 26px 20px 34px; }
.footer a { color: var(--ink-3); }

/* ---------------- 登录页 ---------------- */
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero .logo {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 21px; font-weight: 800;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .28);
}
.auth-hero h1 { font-size: 21px; margin-bottom: 5px; }
.auth-hero p { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-3); }

/* ---------------- 二维码 ---------------- */
.qr-box { text-align: center; padding: 8px 0 4px; }
.qr-box img, .qr-box canvas { width: 208px; height: 208px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.qr-box .tip { margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.qr-amount { font-size: 22px; font-weight: 800; color: var(--brand); margin: 2px 0 12px; }

/* ---------------- 后台 ---------------- */
.admin-body { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex: 0 0 224px; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column;
}
.side .brand { padding: 18px 20px; border-bottom: 1px solid rgba(148, 163, 184, .14); }
.side nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  color: #cbd5e1; padding: 9px 13px; border-radius: 8px; font-size: 13.5px;
  display: flex; align-items: center; gap: 9px;
}
.side nav a:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; font-weight: 600; }
.side .side-foot { padding: 14px 20px; font-size: 12px; color: #64748b; border-top: 1px solid rgba(148, 163, 184, .14); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
}
.main-head h1 { margin: 0; font-size: 16.5px; }
.main-head .spacer { margin-left: auto; }
.main-body { padding: 20px 22px 40px; flex: 1; }
@media (max-width: 820px) {
  .admin-body { flex-direction: column; }
  .side { width: auto; flex: none; }
  .side nav { flex-direction: row; overflow-x: auto; }
}

/* ---------------- 其他 ---------------- */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.copy { cursor: pointer; color: var(--brand); font-size: 12px; margin-left: 6px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kv { display: flex; gap: 10px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed #eef2f7; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-3); width: 118px; flex: 0 0 118px; }
.kv .v { color: var(--ink); word-break: break-all; flex: 1; }
.spin {
  display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: r .7s linear infinite; vertical-align: -2px;
}
@keyframes r { to { transform: rotate(360deg); } }
.switch { position: relative; display: inline-block; width: 42px; height: 23px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .18s;
}
.switch .sl:before {
  content: ""; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .18s;
}
.switch input:checked + .sl { background: var(--brand); }
.switch input:checked + .sl:before { transform: translateX(19px); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 14px;
  font-size: 14px; color: var(--ink-3); cursor: pointer; font-family: inherit; font-weight: 600;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
