:root {
  --ink: #16181d;
  --ink-2: #4b5563;
  --muted: #8a919e;
  --line: #e6e8ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-weak: #e6f4f2;
  --danger: #b42318;
  --warn: #b54708;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 20px; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .2px;
}

.nav a {
  color: var(--ink-2);
  text-decoration: none;
  margin-left: 18px;
  font-size: 14px;
}

.nav a:hover { color: var(--accent); }

.main { padding: 28px 0 48px; }

.hero { margin-bottom: 20px; }
.hero h1 { font-size: 24px; margin: 0 0 6px; font-weight: 650; letter-spacing: -.2px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card.narrow { max-width: 420px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h2 { font-size: 16px; margin: 0; font-weight: 600; }

.step {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.seg-btn {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}

.seg-btn.active { background: var(--accent); color: #fff; }

.row { display: flex; gap: 10px; align-items: center; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }

.input {
  flex: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.input.small { width: 150px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #0c6159; }
.btn.ghost { border-color: var(--line); color: var(--ink-2); background: #fff; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.block { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.link-btn {
  border: 0; background: none; color: var(--accent);
  font-size: 14px; cursor: pointer; padding: 0; font-family: inherit;
}

.inline-logout { display: inline; }

.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.msg { margin-top: 12px; font-size: 14px; min-height: 20px; }
.msg.ok { color: var(--accent); }
.msg.err { color: var(--danger); }

.account {
  margin-top: 14px;
  border: 1px solid var(--accent);
  background: #f3fbf9;
  border-radius: 8px;
  padding: 14px;
}

.account-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.account-row span { color: var(--ink-2); }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-2);
}

.tiers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tier input, .channel input { position: absolute; opacity: 0; }

.tier {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.tier:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.10);
}

.tier-body { display: block; }
.tier-credits { display: block; font-size: 18px; font-weight: 650; }
.tier-money { display: block; color: var(--accent); font-size: 14px; margin-top: 2px; }
.tier-name { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

.channels { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }

.channel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
}

.channel:has(input:checked) { border-color: var(--accent); color: var(--accent); }

.summary { border-top: 1px solid var(--line); }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.summary-row span { color: var(--ink-2); flex: none; }
.summary-row strong { text-align: right; font-weight: 500; word-break: break-all; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.price { color: var(--accent); font-size: 18px; font-weight: 650; }
.err-text { color: var(--danger); }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }

.badge {
  display: inline-block;
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 12px;
  margin-bottom: 10px;
}
.badge.ok { background: var(--accent-weak); color: var(--accent); }
.badge.warn { background: #fef3e6; color: var(--warn); }
.badge.wait { background: #eef1f5; color: var(--ink-2); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 20px; font-weight: 650; }
.stat-warn strong { color: var(--danger); }

.filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.pill {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  background: #eef1f5;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.s3 { background: var(--accent-weak); color: var(--accent); }
.pill.s6 { background: #fdeceb; color: var(--danger); }
.pill.s5 { background: #fef3e6; color: var(--warn); }
.pill.s4 { background: #f1f2f4; color: var(--muted); }

.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  width: 92px;
  font-size: 12px;
  font-family: inherit;
}
.btn-mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-2);
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }
.btn-mini.danger:hover { border-color: var(--danger); color: var(--danger); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding-top: 16px; }

.foot {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .row { flex-wrap: wrap; }
  .btn { flex: 1; }
  .table th:nth-child(7), .table td:nth-child(7) { display: none; }
}

/* ---------- 系统设置页 ---------- */
.wrap { max-width: 1040px; }

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 18px;
}

.field > span {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 6px;
  font-weight: 500;
}

.field .input { width: 100%; }

.field textarea.input { resize: vertical; min-height: 74px; line-height: 1.5; }

.hint-inline { font-style: normal; color: var(--muted); font-weight: 400; font-size: 12px; }

.tag {
  background: var(--accent-weak);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

.notice {
  background: #f3fbf9;
  border: 1px solid #bfe4df;
  color: #0b5f58;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.chan-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px 4px;
  margin-bottom: 12px;
  background: #fcfcfd;
}

.chan-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.chan-name {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 14px;
}

.pill.s6 { background: #fdeceb; color: var(--danger); }

.tiers-table .input { padding: 8px 10px; font-size: 14px; }
.tier-new .input { background: #fafbfc; }

.savebar {
  position: sticky;
  bottom: 0;
  background: rgba(246,247,249,.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 12px 0;
  margin-top: 8px;
}

.savebar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

.savebar .hint { margin: 0; }

@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .savebar-inner { flex-direction: column; align-items: stretch; }
  .savebar .btn { width: 100%; }
}

/* ==================== 视觉增强 ==================== */

:root {
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .05);
  --accent-2: #0d9488;
}

.card {
  border-radius: 14px;
  border: 1px solid #eef0f3;
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head { border-bottom: 1px solid #f1f3f5; padding-bottom: 12px; }
.card-head h2 { letter-spacing: -.01em; }

table { border-collapse: separate; border-spacing: 0; }
th { font-weight: 600; color: var(--ink-2); letter-spacing: .02em; background: #fafbfc; }
td, th { border-bottom: 1px solid #f1f3f5; }
tbody tr { transition: background .15s ease; }
tbody tr:nth-child(even) { background: #fcfdfe; }
tbody tr:hover { background: var(--accent-weak); }

.btn, .btn-mini { transition: all .18s ease; font-weight: 500; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
  outline: none;
}

.hint.alert {
  color: var(--danger);
  font-weight: 700;
  background: #fef3f2;
  border-left: 3px solid var(--danger);
  padding: 9px 12px;
  border-radius: 6px;
  line-height: 1.5;
}

.pill { font-weight: 600; letter-spacing: .02em; }
.stat strong { font-variant-numeric: tabular-nums; }
.topbar { box-shadow: 0 1px 0 #eef0f3; }

.card table { min-width: 700px; }
@media (min-width: 900px) { .card table { min-width: 0; } }
@media (max-width: 640px) {
  .card { border-radius: 12px; }
  .stat { min-width: 45%; }
}

/* ==================== 全新风格 · 靛蓝 ==================== */

:root {
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #94a3b8;
  --line: #e5e9f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --accent: #4f46e5;
  --accent-weak: #eef1ff;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 16px;
}

body {
  background:
    radial-gradient(1100px 520px at 50% -220px, #e6ebff 0%, rgba(230,235,255,0) 70%),
    var(--bg);
  background-attachment: fixed;
}

.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}

.card {
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .04);
  background: var(--card);
}
.card:hover { box-shadow: 0 8px 28px rgba(15, 23, 42, .08); }
.card-head h2 { color: var(--ink); letter-spacing: -.01em; }
.card-head .step, .tag {
  background: var(--accent-weak);
  color: var(--accent);
  border-radius: 999px;
  border: none;
}

.btn.primary {
  background: linear-gradient(180deg, #5b52ea, var(--accent));
  box-shadow: 0 2px 8px rgba(79, 70, 229, .28);
  border: none;
}
.btn.primary:hover { background: #4338ca; box-shadow: 0 4px 14px rgba(79, 70, 229, .34); }
.btn.ghost { border: 1px solid var(--line); color: var(--ink-2); background: #fff; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }

.input, textarea.input, select.input {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fcfdff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
  outline: none;
}

.seg-btn { border-radius: 8px; }
.seg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tier { border-radius: 14px; border: 1.5px solid var(--line); background: #fff; }
.tier:has(input:checked) {
  border-color: var(--accent);
  background: linear-gradient(180deg, #ffffff, var(--accent-weak));
  box-shadow: 0 4px 14px rgba(79, 70, 229, .16);
}
.tier-credits { color: var(--ink); }
.tier-money { color: var(--accent); font-weight: 700; }

.channel { border-radius: 12px; border: 1.5px solid var(--line); }
.channel:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }

th { background: #f7f8fc; color: var(--ink-2); letter-spacing: .02em; }
td, th { border-bottom: 1px solid #f1f4f9; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr:hover { background: var(--accent-weak); }

.pill { border-radius: 999px; font-weight: 600; }

.stat {
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #fafbff);
  border: 1px solid var(--line);
}

.notice { border-radius: 12px; }
.hint.alert {
  color: var(--danger);
  font-weight: 700;
  background: #fef2f2;
  border-left: 3px solid var(--danger);
  padding: 9px 12px;
  border-radius: 8px;
}

/* ===== 平板 ===== */
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .stats { flex-wrap: wrap; gap: 10px; }
  .stat { flex: 1 1 46%; }
  .card { padding: 18px; }
}

/* ===== 手机 ===== */
@media (max-width: 768px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .hero { padding: 16px 0 8px; }
  .hero h1 { font-size: 21px; }
  .hero p { font-size: 13px; }
  .grid2 { grid-template-columns: 1fr !important; }
  .tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .channels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { border-radius: 14px; padding: 16px; }
  .btn.block, .btn.primary.block { width: 100%; }
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    min-width: 0;
  }
  .card table > thead, .card table > tbody { display: table; width: 100%; min-width: 660px; }
  th, td { padding: 10px 8px; font-size: 13px; }
  .mini-input { width: 70px; }
  .btn-mini { padding: 4px 8px; font-size: 12px; }
  .summary-row { font-size: 14px; }
  .price { font-size: 20px; }
  .topbar .wrap { padding: 0 14px; }
}

/* ===== 小屏手机 ===== */
@media (max-width: 480px) {
  .tiers { grid-template-columns: 1fr; }
  .channels { grid-template-columns: 1fr; }
  .stat { flex: 1 1 100%; }
  .card { padding: 14px; border-radius: 12px; }
  .hero h1 { font-size: 19px; }
  table { font-size: 12.5px; }
}
