:root {
  --bg: #f4f3ef;
  --surface: #fff;
  --ink: #1b1a17;
  --ink-soft: #46453f;
  --muted: #7c776e;
  --line: #e5e1d8;
  --brand: #e0552b;
  --brand-dark: #c24520;
  --brand-soft: #fdf0e9;
  --ok: #2f7d5b;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body.admin {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.6;
  display: grid; grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.pad { padding: 18px 22px; }
.inline { display: inline; }
.inline-flex { display: inline-flex; gap: 6px; align-items: center; }

/* 侧栏 */
.side {
  background: #171614; color: rgba(246, 242, 234, .72);
  display: flex; flex-direction: column;
  padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.side-dot {
  width: 11px; height: 11px; border-radius: 4px;
  background: var(--brand); flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(224, 85, 43, .18);
}
.side-brand strong { display: block; color: #fff; font-size: 14.5px; letter-spacing: -.01em; }
.side-brand em { font-style: normal; font-size: 11px; color: rgba(246, 242, 234, .4); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-link {
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px;
  transition: .15s;
}
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-link.on { background: rgba(224, 85, 43, .16); color: #ffb99f; font-weight: 600; }
.side-foot {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px; color: rgba(246, 242, 234, .45);
}
.side-foot a:hover { color: #fff; }

/* 主区域 */
.admin-main { padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.admin-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.admin-top h1 { font-size: 22px; letter-spacing: -.02em; }
.admin-user { font-size: 12.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }

/* 卡片 / 表格 */
.card-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 18px; overflow: hidden;
}
.box-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.box-head h2 { font-size: 15.5px; }
.box-head > a { font-size: 12.5px; color: var(--muted); }
.box-head > a:hover { color: var(--brand); }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px;
  letter-spacing: .03em; padding: 10px 14px; background: #faf8f4;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid #f2efe8; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fdfbf7; }
.tbl td.muted { white-space: nowrap; }
.tbl a:hover { color: var(--brand); }
.td-cover { width: 54px; }
.td-cover img, .cover-ph {
  width: 40px; height: 30px; object-fit: cover; border-radius: 6px;
  display: grid; place-items: center; background: #eee7db; color: #918876; font-size: 13px;
}
.td-title { font-weight: 500; }
.td-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.td-actions { white-space: nowrap; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.td-actions a { font-size: 12.5px; color: #5b5a53; }
.td-actions a:hover { color: var(--brand); }
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 12.5px; color: #5b5a53; font-family: inherit;
}
.link-btn:hover { color: var(--brand); }
.link-btn.danger { color: #b42318; }
.w-70 { width: 62px; height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; }

.pill {
  display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: #f1eee7; color: var(--muted); white-space: nowrap;
}
.pill.ok { background: #e8f3ed; color: var(--ok); }
.pill.wait { background: #fdf2df; color: #96690f; }
.pill.off { background: #f0eee9; color: #8a857c; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card span { font-size: 12px; color: var(--muted); }
.stat-card strong { font-size: 26px; letter-spacing: -.03em; }
.stat-card em { font-style: normal; font-size: 11.5px; color: #a49e93; }
.stat-card.accent { background: #171614; border-color: #171614; }
.stat-card.accent span { color: rgba(246, 242, 234, .55); }
.stat-card.accent strong { color: #fff; }
.stat-card.accent em { color: rgba(246, 242, 234, .38); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.quick { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px; border-radius: 9px;
  border: 1px solid transparent; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: .16s; font-family: inherit; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: #cfc8bb; }
.btn-block { width: 100%; }
.btn-lg { height: 44px; padding: 0 24px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--ink-soft); }
.field > span i { font-style: normal; color: var(--brand); font-size: 11px; }
.field input[type=text], .field input[type=number], .field input[type=password],
.field input[type=search], .field select, .field textarea, .field input[type=file] {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 12px; background: #fdfcfa; outline: none; font-family: inherit; font-size: 13.5px;
  transition: .15s;
}
.field textarea { height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; }
.field input[type=file] { padding: 8px 10px; height: auto; background: #fbf9f5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #d9bfae; background: #fff; box-shadow: 0 0 0 3px rgba(224, 85, 43, .08);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-foot { display: flex; gap: 10px; align-items: center; padding: 18px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.product-form > .field { padding: 0 22px; }
.product-form .form-grid { padding: 20px 22px 0; }

.upload-box { margin: 0 22px 18px; padding: 16px; background: #faf8f3; border: 1px dashed var(--line); border-radius: 10px; }
.upload-title { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.upload-box .muted { font-size: 12px; margin-bottom: 10px; }
.file-manage { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.file-manage li {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 12.5px;
}
.file-manage .f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-manage .f-size { color: var(--muted); font-size: 11.5px; }
.cover-preview { width: 180px; border-radius: 8px; border: 1px solid var(--line); }

/* 分类内联表单 */
.inline-flex input[type=text] {
  height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; width: 130px; font-size: 13px;
}

/* 标签页 */
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; color: var(--muted);
}
.tab:hover { background: #f5f2ec; }
.tab.on { background: #171614; color: #fff; }
.mini-search { display: flex; gap: 8px; }
.mini-search input {
  height: 34px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 12px; font-size: 12.5px; background: #fdfcfa; outline: none; width: 190px;
}

/* 订单详情 */
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.detail-list > div { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.detail-list span { color: var(--muted); font-size: 11.5px; }
.detail-list b { font-weight: 500; word-break: break-all; }

.narrow-box { max-width: 520px; }

/* 提示 */
.alert { border-radius: 9px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-error { background: #fdf0ef; border-color: #f3d3cf; color: #a52a1d; }
.alert-ok { background: #eff7f2; border-color: #cfe6da; color: #246a4c; }
.alert-warn { background: #fdf7e8; border-color: #efdfb4; color: #8a6413; }
.alert-warn a { color: #8a6413; font-weight: 600; text-decoration: underline; }

/* 登录 */
body.admin-login {
  margin: 0; min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(800px 400px at 80% 0%, rgba(224, 85, 43, .12), transparent 60%),
    #f4f3ef;
  font-family: var(--font); color: var(--ink);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; box-shadow: 0 24px 60px -30px rgba(27, 26, 23, .3);
}
.login-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; font-size: 14px; }
.login-brand .side-dot { box-shadow: 0 0 0 4px rgba(224, 85, 43, .15); }
.login-card h1 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 4px; }
.login-card > p { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.login-card .btn { margin-top: 6px; }
.login-back { display: block; text-align: center; margin-top: 16px; font-size: 12px; color: var(--muted); }
.login-back:hover { color: var(--brand); }

@media (max-width: 1080px) {
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  body.admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; overflow-x: auto; }
  .side-brand { padding: 0; }
  .side-nav { flex-direction: row; gap: 4px; overflow-x: auto; flex: 1; }
  .side-link { white-space: nowrap; padding: 7px 11px; font-size: 12.5px; }
  .side-foot { flex-direction: row; border-top: 0; padding-top: 0; white-space: nowrap; }
  .admin-main { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
}
