:root {
  --ink: #17233a;
  --ink-2: #42506a;
  --muted: #77839a;
  --line: #e5e9f1;
  --bg: #f3f5f9;
  --card: #ffffff;
  --nav: #16223a;
  --nav-2: #1e2d4b;
  --brand: #c8952e;
  --brand-2: #a97a1d;
  --red: #c94343;
  --green: #1f8a58;
  --blue: #2f6fd0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 35, 58, .05), 0 8px 24px rgba(23, 35, 58, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 500px at 20% 0%, #22345a 0%, transparent 60%),
    linear-gradient(160deg, #101a2f 0%, #1b2a49 55%, #24365b 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
.login-brand { display: flex; justify-content: center; margin-bottom: 10px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 6px; }
.login-card > .muted { text-align: center; margin: 0 0 26px; font-size: 13px; }
.logo {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #e2b657, #b9841f);
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfe;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #b9c8e6;
  box-shadow: 0 0 0 3px rgba(47, 111, 208, .1);
  background: #fff;
}
.form-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 10px 0 0; text-align: center; }

/* ---------- 壳 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px;
  flex: none;
  background: var(--nav);
  color: #c9d4e8;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 600; color: #fff; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  border: 0;
  background: transparent;
  color: #aebbd4;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--nav-2); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, #2a3d66, #223354); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.sidebar-foot .link { color: #aebbd4; background: none; border: 0; text-align: left; padding: 0; }
.sidebar-foot .link:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 30px 14px;
}
.topbar h2 { margin: 0 0 3px; font-size: 20px; letter-spacing: .2px; }
.topbar p { margin: 0; font-size: 12.5px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { padding: 6px 30px 40px; }

/* ---------- 通用 ---------- */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c6d2e8; background: #f7f9fd; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #24344f; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); border-color: #f0c9c9; }
.btn.danger:hover { background: #fdf3f3; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: default; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 18px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14.5px; }
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 18px; }

/* 上架状态筛选 */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #c6d2e8; background: #f7f9fd; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-num { font-size: 11px; opacity: .62; font-variant-numeric: tabular-nums; }

/* 流程与格式说明 */
.notice {
  background: #f7f9fd;
  border: 1px solid #e5ebf6;
  border-radius: 9px;
  padding: 11px 13px;
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}
.notice b { color: var(--ink); }
.notice.danger { background: #fdf3f3; border-color: #f0c9c9; }
.notice.danger b { color: var(--red); }
.notice .mono { font-size: 11.5px; background: #eef2fa; border-radius: 4px; padding: 1px 4px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 25px; font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-hint { margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.stat-hint.up { color: var(--green); }

/* ---------- 图表 ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 6px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; min-width: 0; }
.bar-track { width: 100%; max-width: 46px; height: 128px; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #d8ab45, #b9841f);
  transition: height .25s ease;
}
.bar-fill.zero { background: #edf0f6; }
.bar-num { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-day { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 14px;
  background: #fafbfe;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfcff; }
.table .name { font-weight: 550; }
.table .sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-actions { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  background: #eef1f7;
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.b-published, .badge.b-paid, .badge.b-active { background: #e7f5ee; color: var(--green); }
.badge.b-draft, .badge.b-pending { background: #fff4df; color: #a06a10; }
.badge.b-archived, .badge.b-closed { background: #eef1f7; color: #6b7792; }
.badge.b-refunded, .badge.b-banned { background: #fbeaea; color: var(--red); }
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: #eef1f7;
  color: var(--ink-2);
  margin-right: 4px;
}
.tag-gold { background: #fbf0d8; color: #97690f; }
.tag-blue { background: #e9f0fc; color: #2f63b8; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.input, .select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 11px;
  outline: none;
  font-size: 13px;
}
.input:focus, .select:focus { border-color: #b9c8e6; box-shadow: 0 0 0 3px rgba(47, 111, 208, .08); }
.input { min-width: 200px; }
.input.flex { flex: 1; min-width: 0; }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding-top: 8px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 12px; line-height: 1.6; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 9px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 40, .48);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.icon-btn { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: #f1f4fa; color: var(--ink); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1d2a42;
  color: #fff;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .28);
  z-index: 80;
  max-width: 80vw;
}
.toast.error { background: #9e3030; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .brand span:last-child, .nav-item, .sidebar-foot .muted { display: none; }
  .brand { justify-content: center; padding-bottom: 16px; }
  .nav-item::after { content: attr(data-short); }
  .sidebar-foot { align-items: center; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
