:root {
  --primary: #FF6010;
  --primary-d: #e0540c;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e8eaed;
  --text: #1f2329;
  --muted: #8a909a;
  --green: #1aad19;
  --blue: #1989fa;
  --orange: #ff8c00;
  --red: #ff3b30;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
input, button { font-family: inherit; font-size: 14px; }
button { cursor: pointer; border: none; border-radius: 6px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 340px; background: var(--card); border-radius: 12px; padding: 36px 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08); text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 20px; margin: 8px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 6px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.login-card button {
  width: 100%; padding: 11px; background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
}
.login-card button:hover { background: var(--primary-d); }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); padding: 0 22px; height: 56px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; }
.btn-ghost { background: transparent; color: var(--muted); padding: 7px 14px; border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; padding: 8px 18px; font-weight: 600; }
.btn-primary:hover { background: var(--primary-d); }
.btn-success { background: var(--green); color: #fff; padding: 8px 18px; font-weight: 600; }
.btn-success:disabled { background: #b6e6b5; cursor: not-allowed; }

/* ---------- 模块导航 ---------- */
.modnav { display: flex; gap: 4px; padding: 0 22px; background: var(--card); border-bottom: 1px solid var(--line); }
.mod {
  background: transparent; color: var(--muted); padding: 12px 18px; font-size: 14px; font-weight: 600;
  border-bottom: 3px solid transparent; border-radius: 0;
}
.mod:hover { color: var(--text); }
.mod.active { color: var(--primary); border-bottom-color: var(--primary); }
.module { min-height: 60vh; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 18px 22px 4px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 16px 18px; border: 1px solid var(--line); }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-card .value.money { color: var(--primary); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 22px; }
.tabs { display: flex; gap: 6px; }
.tab { background: var(--card); border: 1px solid var(--line); padding: 7px 14px; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filters { display: flex; gap: 8px; }
.filters input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.filters input[type=text] { width: 200px; }

/* ---------- 表格 ---------- */
.table-wrap { margin: 4px 22px 30px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.order-table, .prod-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td, .prod-table th, .prod-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.order-table th, .prod-table th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 13px; }
.order-table td, .prod-table td { font-size: 13.5px; }
.order-table .num, .prod-table .num { text-align: right; }
.order-table .op, .prod-table .op { text-align: center; width: 140px; }
.order-table tbody tr:hover, .prod-table tbody tr:hover { background: #fafbfc; }
.link-btn { color: var(--primary); background: none; padding: 4px 8px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }
.empty { padding: 50px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; }
.pager button { padding: 6px 12px; border: 1px solid var(--line); background: var(--card); }
.pager button:disabled { color: var(--muted); cursor: not-allowed; }

/* 状态徽标 */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fff0ef; color: var(--red); }
.badge-paid { background: #e8f3ff; color: var(--blue); }
.badge-shipped { background: #fff4e5; color: var(--orange); }
.badge-completed { background: #e8f8e8; color: var(--green); }
.badge-warn { background: #ffebee; color: var(--red); }

/* 商品表单 */
.prod-form { padding: 18px 20px; }
.f-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.f-row > label { width: 130px; flex: none; color: var(--muted); text-align: right; }
.f-row > input, .f-row > select { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.f-row > input:focus, .f-row > select:focus { border-color: var(--primary); }
.hint { color: var(--muted); font-size: 12px; }
.date-label { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; width: 640px; max-width: 94vw; max-height: 90vh; overflow: auto; border-radius: 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); }
#detailBody { padding: 18px 20px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 8px; }
.detail-row .k { color: var(--muted); width: 80px; flex: none; }
.detail-items { width: 100%; border-collapse: collapse; margin-top: 10px; }
.detail-items th, .detail-items td { border: 1px solid var(--line); padding: 8px 10px; font-size: 13px; }
.detail-items th { background: #fafbfc; }

/* ---------- 打印区（A4 发货清单）---------- */
#print-area { display: none; }

@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  @page { size: A4; margin: 12mm; }
  .no-print { display: none !important; }
}

/* 发货清单样式（屏幕预览也用同一套，仅打印时显示） */
.ship-doc { color: #000; font-size: 13px; line-height: 1.6; }
.ship-doc h1 { text-align: center; font-size: 20px; margin: 0 0 4px; letter-spacing: 2px; }
.ship-doc .doc-sub { text-align: center; color: #555; margin-bottom: 14px; }
.ship-doc .meta { display: flex; justify-content: space-between; border-top: 2px solid #000; border-bottom: 1px solid #000; padding: 8px 0; margin-bottom: 10px; }
.ship-doc .addr { margin-bottom: 10px; }
.ship-doc table { width: 100%; border-collapse: collapse; }
.ship-doc th, .ship-doc td { border: 1px solid #000; padding: 7px 8px; text-align: left; }
.ship-doc th { background: #f2f2f2; }
.ship-doc .right { text-align: right; }
.ship-doc .totals { margin-top: 10px; text-align: right; }
.ship-doc .totals b { font-size: 15px; }
.ship-doc .remark { margin-top: 10px; }
.ship-doc .sign { margin-top: 36px; display: flex; justify-content: space-between; }

/* ---------- 首页装修 DIY ---------- */
.decor-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; padding: 18px 22px 30px; align-items: start; }
.decor-editor { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.decor-block { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.decor-block:last-child { border-bottom: none; }
.decor-block-title { font-weight: 700; margin-bottom: 10px; font-size: 14px; }
.decor-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.decor-row input, .decor-row select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; outline: none; flex: 1; min-width: 90px; }
.decor-row .f-banner-title { flex: 2; }
.mini-btn { padding: 4px 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; color: var(--muted); }
.mini-btn.del { color: var(--red); border-color: #ffd5d5; }
.mini-btn:hover { background: #f5f5f5; }
.btn-ghost.sm { padding: 5px 12px; font-size: 13px; margin-top: 4px; }
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }

.decor-preview { position: sticky; top: 16px; }
.phone { background: #111; border-radius: 28px; padding: 12px; width: 100%; min-height: 520px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
#decorPreview { background: #f5f5f5; border-radius: 18px; min-height: 496px; overflow: hidden; padding: 8px; }
.pv-banner { height: 64px; margin-bottom: 8px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; text-align: center; padding: 0 8px; }
.pv-notice { background: #fff7e6; color: #b26a00; font-size: 12px; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.pv-box { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.pv-label { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.pv-note { font-size: 12px; color: var(--muted); }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chips span { background: #f2f3f5; border-radius: 14px; padding: 4px 10px; font-size: 12px; }

/* 拖拽排序视觉反馈 */
.decor-row[draggable="true"] { cursor: grab; }
.decor-row[draggable="true"]:active { cursor: grabbing; }
.decor-row.dragging { opacity: 0.4; }
.decor-row.drag-over { border-top: 2px solid var(--primary); }

/* 预览：底部导航 */
.pv-tabbar { display: flex; background: #fff; border-radius: 10px; overflow: hidden; margin-top: 4px; }
.pv-tab { flex: 1; text-align: center; padding: 8px 2px; font-size: 11px; color: #FF6010; border-right: 1px solid #f0f0f0; }
.pv-tab:last-child { border-right: none; }

@media (max-width: 900px) {
  .decor-layout { grid-template-columns: 1fr; }
  .decor-preview { position: static; }
}

/* ---------- 用户管理 ---------- */
.link-btn.danger { color: var(--red); }
.tag-mini { display: inline-block; padding: 1px 8px; margin: 0 4px 4px 0; font-size: 12px; color: var(--primary); background: var(--primary-light, #fff1e9); border-radius: 10px; }
.btn-ghost.sm { padding: 5px 12px; font-size: 13px; }

/* ---------- 会员等级 / 员工管理（分权） ---------- */
.perm-wrap { max-height: 320px; overflow-y: auto; border: 1px solid #ebedf0; border-radius: 8px; padding: 10px 12px; background: #fafbfc; }
.perm-group { margin-bottom: 12px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-title { font-weight: 600; font-size: 13px; color: #303133; margin-bottom: 6px; padding-left: 2px; border-left: 3px solid var(--primary, #FF6010); }
.perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 14px; padding-left: 6px; }
.perm-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #606266; cursor: pointer; user-select: none; }
.perm-item input { accent-color: var(--primary, #FF6010); }

.staff-form-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.staff-form-row label { font-size: 13px; color: #606266; text-align: right; }
.staff-form-row .hint { font-size: 12px; color: #909399; margin-top: 4px; }

.form-row.inline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-row.inline label { font-size: 13px; color: #606266; min-width: 84px; }


/* ---------- 首页装修 - 轮播图列表 ---------- */
.banner-row { gap: 12px; flex-wrap: wrap; }
.banner-thumb {
  width: 88px; height: 56px; border-radius: 6px;
  background-color: #f0f0f0; background-size: cover; background-position: center; background-repeat: no-repeat;
  border: 1px dashed #dcdfe6; flex-shrink: 0;
}
.banner-thumb-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; font-size:11px; color:#909399; background:#fafafa;}
.banner-thumb-empty span { font-size: 10px; color: #c0c4cc; }
.decor-block-title { display: flex; align-items: center; gap: 8px; }

/* ---------- 4-Tab 详细设置弹窗（轮播图） ---------- */
.bs-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line, #ebeef5); padding: 0 4px; flex-shrink: 0; }
.bs-tab { padding: 12px 22px; font-size: 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: #606266; cursor: pointer; transition: all .2s; }
.bs-tab.active { color: var(--primary, #FF6010); border-bottom-color: var(--primary, #FF6010); font-weight: 600; }
.bs-tab:hover { color: var(--primary, #FF6010); }
.bs-body { padding: 18px 24px; flex: 1; overflow-y: auto; }
.bs-pane { display: none; }
.bs-pane.active { display: block; }

.bs-section-title { font-size: 13px; color: #909399; margin: 18px 0 10px; padding-left: 8px; border-left: 3px solid var(--primary, #FF6010); }
.bs-section-title:first-child { margin-top: 4px; }
.bs-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.bs-row > label { width: 90px; text-align: right; color: #606266; flex-shrink: 0; }
.bs-hint { font-size: 12px; color: #909399; }
.bs-hint.inline { margin-left: 8px; }
.bs-unit { color: #909399; font-size: 12px; }

.bs-input-with-unit { display: flex; align-items: center; gap: 6px; }
.bs-input-with-unit input { width: 100px; }

.bs-radio { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.bs-radio input { accent-color: var(--primary, #FF6010); }

.bs-visual { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; }
.bs-visual.active, .bs-visual:has(input:checked) { border-color: var(--primary, #FF6010); }
.bs-visual input { display: none; }
.bs-visual-img { width: 72px; height: 42px; background: #fff; border: 1px solid #dcdfe6; border-radius: 4px; position: relative; overflow: hidden; }
.bs-visual-slide::before { content: ''; position: absolute; left: 6px; top: 50%; width: 22px; height: 22px; background: var(--primary, #FF6010); opacity: .7; transform: translateY(-50%); }
.bs-visual-slide::after  { content: ''; position: absolute; right: 6px; top: 50%; width: 22px; height: 22px; background: var(--primary, #FF6010); transform: translateY(-50%); }
.bs-visual-fade::before  { content: ''; position: absolute; inset: 6px; background: linear-gradient(90deg, var(--primary, #FF6010) 50%, transparent 50%); }
.bs-skin1::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--primary, #FF6010); }
.bs-skin2::before { content: ''; position: absolute; left: 50%; top: 6px; bottom: 6px; width: 4px; background: var(--primary, #FF6010); transform: translateX(-50%); }
.bs-skin2::after  { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--primary, #FF6010); }
.bs-pos-left::before   { content: ''; position: absolute; left: 6px; bottom: 6px; width: 14px; height: 4px; background: var(--primary, #FF6010); }
.bs-pos-center::before { content: ''; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 4px; background: var(--primary, #FF6010); transform: translateX(-50%); }
.bs-pos-right::before  { content: ''; position: absolute; right: 6px; bottom: 6px; width: 14px; height: 4px; background: var(--primary, #FF6010); }

.bs-pick { padding: 5px 12px; border: 1px solid #dcdfe6; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.bs-pick:hover { border-color: var(--primary, #FF6010); color: var(--primary, #FF6010); }

.bs-addbox { flex: 1; height: 110px; border: 2px dashed #dcdfe6; border-radius: 8px; background: #fafafa; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #909399; font-size: 13px; }
.bs-addbox-hint { text-align: center; }
.bs-addbox-hint span { font-size: 11px; color: #c0c4cc; }

.bs-list { margin-top: 12px; max-height: 280px; overflow-y: auto; border-top: 1px solid var(--line, #ebeef5); padding-top: 8px; }
.bs-list .bs-row { margin-bottom: 8px; }
.bs-empty { color: #c0c4cc; font-size: 12px; padding: 24px 0; text-align: center; }

.bs-range { flex: 1; accent-color: var(--primary, #FF6010); }
.bs-num { width: 64px; padding: 4px 6px; border: 1px solid #dcdfe6; border-radius: 4px; }
.bs-row input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid #dcdfe6; border-radius: 4px; background: none; cursor: pointer; }
.bs-row input[type="text"]  { padding: 4px 8px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 12px; }

