:root {
  --brand: #ff5a1f;
  --brand-dark: #e14a12;
  --brand-soft: #fff2ec;
  --ink: #1f2328;
  --ink-2: #4b5563;
  --ink-3: #8a919c;
  --line: #e8ebef;
  --bg: #f5f6f8;
  --card: #fff;
  --green: #12a150;
  --green-soft: #e9f8ef;
  --blue: #2563eb;
  --blue-soft: #eaefff;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fef3e2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
img { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #ffe6da 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 100%, #e8f0ff 0%, transparent 60%), #f7f8fa;
  padding: 24px;
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 30px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand img { width: 52px; height: 52px; border-radius: 14px; }
.login-brand h1 { font-size: 18px; letter-spacing: .5px; }
.login-brand p { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.login-form label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.login-form input {
  width: 100%;
  margin-top: 8px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fbfbfc;
  outline: none;
  transition: .15s;
}
.login-form input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.6; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #1b1e24;
  color: #c9ced6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; font-size: 16px; color: #fff; font-weight: 600; }
.side-brand img { width: 32px; height: 32px; border-radius: 9px; }
.nav { padding: 6px 10px; flex: 1; overflow: auto; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #c2c8d2;
  font-size: 14px;
  margin-bottom: 2px;
  transition: .15s;
}
.nav a .dot { width: 5px; height: 5px; border-radius: 50%; background: #6b7280; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav a.active .dot { background: #fff; }
.side-foot { padding: 14px 18px; font-size: 12px; color: #6b7280; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.crumb { font-size: 15px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.admin-name { color: var(--ink-3); font-size: 13px; }
.view { padding: 22px 24px 40px; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .sub { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd5dd; background: #fafbfc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: #fff; border-color: #f3c6c7; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 1; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray { background: #f1f3f5; color: var(--ink-2); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat .label { color: var(--ink-3); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: .5px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.stat .hint { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.stat.accent::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--brand-soft); }
.stat.clickable { cursor: pointer; transition: .15s; }
.stat.clickable:hover { border-color: #ffd0bc; transform: translateY(-1px); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.input, .select, .textarea {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 11px;
  background: #fff;
  outline: none;
  transition: .15s;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.w180 { width: 180px; }
.input.w240 { width: 240px; }
.input.w120 { width: 120px; }
.textarea { height: auto; min-height: 96px; padding: 10px 11px; resize: vertical; line-height: 1.7; width: 100%; }
.search { position: relative; }
.search input { width: 260px; padding-left: 32px; }
.search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: var(--ink-3); font-size: 16px; }

.tabs { display: inline-flex; background: #f1f3f5; padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.tabs button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.1); font-weight: 600; }

.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  background: #fafbfc;
  padding: 11px 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 12px; border-bottom: 1px solid #f1f3f5; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fcfcfd; }
table.data .num { font-variant-numeric: tabular-nums; }
table.data .strong { font-weight: 600; }
table.data .muted { color: var(--ink-3); }
table.data td.actions { white-space: nowrap; }
table.data td.actions .btn + .btn { margin-left: 6px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #f2f4f7; border: 1px solid var(--line); }
.thumb-lg { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: #f2f4f7; border: 1px solid var(--line); }
.title-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.title-cell .t { font-weight: 600; line-height: 1.5; }
.title-cell .s { color: var(--ink-3); font-size: 12px; margin-top: 3px; }

.empty { padding: 46px 0; text-align: center; color: var(--ink-3); }
.empty img { width: 120px; margin: 0 auto 12px; opacity: .9; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; }
.field label .req { color: var(--red); margin-left: 2px; }
.field .hint { color: var(--ink-3); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.field input, .field select { width: 100%; height: 38px; }
.field .input, .field .select { width: 100%; }
.img-list { display: flex; gap: 10px; flex-wrap: wrap; }
.img-item { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-item .del {
  position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: 0; cursor: pointer; line-height: 18px; font-size: 12px;
}
.img-item .main-tag { position: absolute; left: 0; bottom: 0; background: var(--brand); color: #fff; font-size: 11px; padding: 2px 6px; }
.upload-box {
  width: 96px; height: 96px; border-radius: 10px; border: 1px dashed #cfd5dd; display: grid; place-items: center;
  color: var(--ink-3); cursor: pointer; background: #fafbfc; font-size: 12px; text-align: center; line-height: 1.5;
}
.upload-box:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.spec-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.spec-row .input { flex: 0 0 140px; }
.spec-row .input2 { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 8px; }

/* 弹窗 / 提示 */
.toast {
  position: fixed; left: 50%; top: 26px; transform: translateX(-50%);
  background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 999; max-width: 70vw; line-height: 1.5;
}
.toast.error { background: #c93a3f; }
.toast.success { background: #12813f; }
.dialog-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: grid; place-items: center; z-index: 900;
  backdrop-filter: blur(2px);
}
.dialog {
  width: 420px; max-width: 92vw; background: #fff; border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.dialog h3 { font-size: 16px; margin-bottom: 10px; }
.dialog-body { color: var(--ink-2); font-size: 13px; line-height: 1.75; max-height: 60vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 预览（小程序风格） */
.phone {
  width: 375px; margin: 0 auto; background: #fff; border-radius: 22px; overflow: hidden;
  border: 8px solid #1f2328; box-shadow: 0 18px 40px rgba(0,0,0,.18);
}
.phone .ph-head { background: #fff; padding: 10px 14px; border-bottom: 1px solid #f0f1f3; display: flex; gap: 8px; align-items: center; }
.phone .ph-search { flex: 1; height: 32px; border-radius: 16px; background: #f4f5f7; color: #9aa1ab; font-size: 12px; display: flex; align-items: center; padding: 0 12px; }
.phone .ph-body { padding: 12px 14px 18px; max-height: 620px; overflow: auto; background: #f7f8fa; }
.phone .ph-swiper { position: relative; border-radius: 12px; overflow: hidden; background: #eef0f3; }
.phone .ph-swiper img { width: 100%; height: 250px; object-fit: cover; }
.phone .ph-dots { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; }
.phone .ph-dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); margin: 0 3px; }
.phone .ph-dots i.on { background: #fff; width: 14px; border-radius: 3px; }
.phone .ph-price { background: #fff; padding: 12px 14px; }
.phone .ph-price .now { color: var(--brand); font-size: 28px; font-weight: 700; }
.phone .ph-price .orig { color: #9aa1ab; font-size: 14px; text-decoration: line-through; margin-left: 6px; }
.phone .ph-title { font-size: 16px; font-weight: 600; margin-top: 6px; line-height: 1.5; }
.phone .ph-company { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.phone .ph-spec { background: #fff; margin-top: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.phone .ph-spec .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.phone .ph-spec .chip { border: 1px solid #e6e8ec; border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--ink-2); }
.phone .ph-detail { background: #fff; margin-top: 10px; padding: 14px; border-radius: 10px; font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.phone .ph-bar { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid #f0f1f3; background: #fff; }
.phone .ph-bar div { text-align: center; padding: 8px 0; font-size: 11px; color: var(--ink-2); }
.phone .ph-bar .main { background: var(--brand); color: #fff; }

/* 统计图表 */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 10px 4px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 8px; }
.chart .bar { width: 100%; background: linear-gradient(180deg, #ff8a5c, #ff5a1f); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .cap { font-size: 10px; color: var(--ink-3); white-space: nowrap; transform: scale(.9); }
.legend { color: var(--ink-3); font-size: 12px; }
.split-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .split-2 { grid-template-columns: 1fr; } }

.status-line { display: flex; gap: 8px; flex-wrap: wrap; }
.status-line .item { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--ink-2); }
.status-line .item b { color: var(--ink); margin-left: 4px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; font-size: 13px; }
.detail-grid .k { color: var(--ink-3); font-size: 12px; margin-bottom: 4px; }
.detail-grid .v { color: var(--ink); line-height: 1.6; }
.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 3px; height: 14px; background: var(--brand); border-radius: 2px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }