:root {
  --bg: #070a12;
  --bg-soft: #0b1020;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e9edf7;
  --muted: #8b94ac;
  --brand-1: #6366f1;
  --brand-2: #22d3ee;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 460px at 8% -10%, rgba(99, 102, 241, 0.26), transparent 62%),
    radial-gradient(700px 420px at 96% 0%, rgba(34, 211, 238, 0.16), transparent 60%);
}
a { color: #a5b4fc; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ───────── 登录页 ───────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1;
}
.login-card {
  width: 100%; max-width: 420px; padding: 36px; border-radius: 22px;
  border: 1px solid var(--border); background: rgba(11, 16, 32, 0.86);
  backdrop-filter: blur(20px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}
.login-card .logo-mark {
  width: 46px; height: 46px; border-radius: 14px; font-size: 20px; font-weight: 800;
  display: grid; place-items: center; color: #05070d;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  margin-bottom: 18px;
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 750; }
.login-card p.sub { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.login-card .field { margin-bottom: 16px; }
.login-tip {
  margin-top: 18px; padding: 11px 14px; border-radius: 10px; font-size: 12.5px;
  background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.28); color: #fcd34d;
}

/* ───────── 通用控件 ───────── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: 11px; color: var(--text);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  outline: none; transition: 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(99, 102, 241, 0.75); background: rgba(255, 255, 255, 0.08);
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field select option { background: #0b1020; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand-1); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; font-weight: 600; transition: 0.2s; white-space: nowrap;
}
.btn:hover { background: var(--surface-strong); border-color: var(--border-strong); }
.btn-primary {
  border-color: transparent; color: #05070d;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 14px 30px -14px rgba(99, 102, 241, 0.9);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.16); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; padding: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ───────── 控制台骨架 ───────── */
.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: 248px; flex: 0 0 auto; padding: 22px 16px;
  border-right: 1px solid var(--border); background: rgba(8, 11, 21, 0.6);
  display: flex; flex-direction: column; gap: 22px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; font-weight: 750; padding: 0 8px; }
.sidebar .brand .logo-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #05070d; font-weight: 800;
}
.sidebar .brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: 11px; border: none; background: transparent;
  color: var(--muted); font-size: 14px; transition: 0.2s;
}
.menu button:hover { background: var(--surface); color: var(--text); }
.menu button.active {
  color: #05070d; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}
.menu .icon { width: 18px; text-align: center; }

.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; }
.sidebar-foot a { display: block; margin-bottom: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 66px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  border-bottom: 1px solid var(--border); background: rgba(8, 11, 21, 0.55);
  backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.topbar .spacer { margin-left: auto; }
.pill {
  font-size: 12px; padding: 4px 11px; border-radius: 999px;
  background: rgba(99, 102, 241, 0.16); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3);
}

.content { padding: 26px 28px 60px; }
.pane { display: none; }
.pane.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 22px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card-head .spacer { margin-left: auto; }
.card-head .desc { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(150deg, rgba(99, 102, 241, 0.14), rgba(255, 255, 255, 0.02));
}
.stat span { font-size: 12.5px; color: var(--muted); }
.stat strong { display: block; font-size: 28px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; }

/* ───────── 表格 ───────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
td .row-name { display: flex; align-items: center; gap: 11px; min-width: 190px; }
td .mini-icon {
  width: 38px; height: 38px; border-radius: 11px; object-fit: cover; flex: 0 0 auto;
  border: 1px solid var(--border-strong);
}
td .mini-icon-fallback {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; color: #05070d; font-size: 15px;
}
td .row-name b { display: block; font-size: 14px; }
td .row-name small { color: var(--muted); font-size: 11.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }
.badge.draft { color: #fcd34d; border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); }

/* ───────── 宣传位卡片列表 ───────── */
.banner-list { display: grid; gap: 14px; }
.banner-item {
  display: flex; gap: 16px; align-items: center; padding: 14px;
  border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, 0.02);
  flex-wrap: wrap;
}
.banner-item img { width: 150px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.banner-item .b-body { flex: 1; min-width: 180px; }
.banner-item h4 { margin: 0 0 2px; font-size: 14.5px; }
.banner-item p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ───────── 弹窗 ───────── */
.modal-mask {
  position: fixed; inset: 0; z-index: 80; background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(6px); display: none; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 720px; border-radius: 18px; border: 1px solid var(--border-strong);
  background: #0b1020; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
  animation: fade 0.22s ease;
}
.modal-head { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head button { margin-left: auto; background: none; border: none; font-size: 20px; color: var(--muted); }
.modal-body { padding: 22px 24px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 24px; border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }

.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-row input[type="text"] { flex: 1; }
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 8px; display: none; }
.progress.show { display: block; }
.progress i { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); animation: slide 1.1s infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.log-line { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.log-line time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.empty-row { text-align: center; color: var(--muted); padding: 40px 10px; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: rgba(12, 17, 32, 0.97); border: 1px solid var(--border-strong);
  padding: 12px 22px; border-radius: 999px; font-size: 14px; z-index: 120;
  opacity: 0; transition: 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.menu-toggle { display: none; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; gap: 14px; }
  .sidebar .brand, .sidebar-foot { display: none; }
  .menu { flex-direction: row; }
  .menu button { white-space: nowrap; }
  .content { padding: 18px; }
  .topbar { padding: 0 18px; }
}