/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* 关键：保证 hidden 属性始终生效（防止 .mask 等 display:flex 规则覆盖导致弹窗常显） */
[hidden] { display: none !important; }
:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --wx: #07c160;
  --ali: #1677ff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --text: #1f2430;
  --muted: #7a8194;
  --bg: #f4f5fa;
  --border: #e6e8f0;
  --radius: 14px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ============ 顶部 ============ */
.hero {
  background: linear-gradient(135deg, #6c5ce7 0%, #8e7cf3 55%, #a29bfe 100%);
  color: #fff;
  padding: 36px 0 30px;
  border-radius: 0 0 26px 26px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(108, 92, 231, .25);
}
.hero h1 { font-size: 26px; letter-spacing: 1px; }
.notice {
  margin-top: 8px; font-size: 14px; opacity: .92;
  background: rgba(255, 255, 255, .16);
  display: inline-block; padding: 6px 14px; border-radius: 20px;
}

/* ============ 标题 / 卡片 ============ */
.sec-title { font-size: 18px; margin: 22px 0 14px; padding-left: 10px; border-left: 4px solid var(--primary); }
.card {
  background: #fff; border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(30, 40, 80, .06);
}

/* ============ 商品卡 ============ */
.product-card .p-name { font-size: 17px; }
.p-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.p-features { list-style: none; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.p-features li {
  font-size: 12px; color: var(--primary-dark);
  background: #f0eeff; padding: 3px 10px; border-radius: 14px;
}
.p-note { font-size: 13px; color: var(--muted); background: #fafafa; border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }

.spec-group { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.spec-btn {
  flex: 1; min-width: 100px;
  border: 1.5px solid var(--border); background: #fafbff;
  border-radius: 10px; padding: 8px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .15s;
}
.spec-btn:hover { border-color: var(--primary); }
.spec-btn.active { border-color: var(--primary); background: #f3f1ff; box-shadow: 0 0 0 2px rgba(108, 92, 231, .15); }
.spec-label { font-size: 13px; }
.spec-price { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.p-total { font-size: 14px; color: var(--primary-dark); font-weight: 600; min-height: 22px; margin-bottom: 8px; }

/* ============ 按钮 ============ */
.btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 15px; cursor: pointer; transition: all .15s;
  background: #eef0f6; color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.full { width: 100%; display: block; }
.btn.wx { background: var(--wx); color: #fff; flex: 1; }
.btn.ali { background: var(--ali); color: #fff; flex: 1; }
.btn.mini { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.cancel-btn { margin-top: 10px; }

/* ============ 折叠条 ============ */
.fold { margin: 12px 0 4px; }
.fold summary {
  font-size: 13px; color: var(--primary-dark); cursor: pointer;
  user-select: none; padding: 9px 12px; background: #f5f4ff;
  border-radius: 8px; list-style: none; display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '▾'; margin-left: auto; transition: transform .15s; }
.fold[open] summary::after { transform: rotate(180deg); }
.fold[open] summary { border-radius: 8px 8px 0 0; }
.fold .p-features, .fold .p-note, .fold textarea { margin-top: 0; }
.fold .p-features, .fold .p-note { border-top: none; background: #f9f9fd; border-radius: 0 0 8px 8px; }
.fold textarea { margin-top: -1px; border-radius: 0 0 8px 8px; }
.card-fold { margin: 12px 0; }
.card-fold .p-features { margin: 10px 12px; }
.card-fold .p-note { margin: 0 12px 12px; }

/* ============ 套餐手风琴（多级菜单） ============ */
.acc-card { padding: 10px 14px; }
.acc summary {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; cursor: pointer; user-select: none;
  list-style: none; -webkit-tap-highlight-color: transparent;
}
.acc summary::-webkit-details-marker { display: none; }
.acc-idx {
  width: 26px; height: 26px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; border-radius: 8px;
  font-size: 14px; font-weight: 700;
}
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-title { font-size: 15px; font-weight: 700; }
.acc-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-price { font-size: 14px; font-weight: 700; color: var(--primary-dark); flex: none; }
.acc summary::after {
  content: '▾'; flex: none; color: var(--muted); transition: transform .15s;
}
.acc[open] summary::after { transform: rotate(180deg); }
.acc[open] summary { border-bottom: 1px dashed var(--border); padding-bottom: 10px; }
.acc-body { padding-top: 12px; animation: accIn .18s ease; }
@keyframes accIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.acc-body .p-features { margin: 4px 0 10px; }
.acc-body .p-note { margin-bottom: 12px; }

/* ============ 进度时间线 ============ */
.prog-fold { margin: 10px 0 4px; }
.prog-fold summary { background: #f0f7ff; color: #1e6fd9; }
.timeline { list-style: none; padding: 10px 2px 2px; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 14px; bottom: 8px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 12px 22px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-dot {
  position: absolute; left: 0; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .15);
}
.tl-body { display: flex; flex-direction: column; gap: 1px; }
.tl-note { font-size: 13px; color: var(--text); }
.tl-time { font-size: 11px; color: var(--muted); }

/* ============ 后台进度管理 ============ */
.op-block {
  margin-top: 10px; border: 1px dashed var(--border);
  border-radius: 10px; padding: 10px 12px; background: #fafbff;
}
.op-head { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.op-list { list-style: none; margin: 0 0 8px; }
.op-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-top: 1px dashed var(--border); font-size: 13px;
}
.op-list li:first-child { border-top: none; }
.op-time { flex: none; font-size: 11px; color: var(--muted); }
.op-note { flex: 1; min-width: 0; }
.op-empty { color: var(--muted); }
.op-add { display: flex; gap: 8px; }
.op-add input { flex: 1; padding: 7px 10px; font-size: 13px; }

/* ============ 查询 / 订单卡 ============ */
.query-row { display: flex; gap: 10px; margin-bottom: 14px; }
.query-row input { flex: 1; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; outline: none; background: #fff;
  font-family: inherit; color: var(--text);
}
input:focus, textarea:focus { border-color: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 20px 0; }

.order-card { border-top: 1px dashed var(--border); padding-top: 14px; margin-top: 14px; }
.o-top { display: flex; justify-content: space-between; align-items: center; }
.o-id { font-size: 13px; color: var(--muted); }
.o-info { display: flex; justify-content: space-between; margin: 6px 0 12px; }
.o-price { font-weight: 700; color: var(--primary-dark); }
.o-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.o-note { font-size: 13px; background: #fffbeb; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }

.badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; color: #fff; }
.s-pending { background: var(--warn); }
.s-making { background: var(--ali); }
.s-done { background: var(--ok); }

/* 进度条 */
.progress-bar { display: flex; align-items: center; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border); }
.step.done .step-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .18); }
.step-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.step.done .step-label { color: var(--primary-dark); font-weight: 600; }
.step-line { flex: 1; height: 3px; background: var(--border); margin: 0 6px 16px; border-radius: 2px; }
.step-line.done { background: var(--primary); }

/* ============ 弹窗 ============ */
.mask {
  position: fixed; inset: 0; background: rgba(15, 20, 40, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.close {
  width: 40px; height: 40px; margin: -8px -10px -8px 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1;
  border-radius: 50%; user-select: none; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.close:hover { background: #f0f1f6; color: var(--text); }
.modal-body { padding: 18px; }

.order-summary {
  background: #f3f1ff; border-radius: 10px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.sum-price b { color: var(--primary-dark); font-size: 18px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.req { color: var(--danger); }
.pay-channels { display: flex; gap: 12px; margin-top: 18px; }

/* 支付弹窗 */
.pay-amount { text-align: center; font-size: 15px; margin-bottom: 10px; }
.pay-amount b { font-size: 30px; color: var(--primary-dark); }
.pay-order-no {
  text-align: center; font-size: 13px; background: #fff7e6;
  border-radius: 8px; padding: 8px; margin-bottom: 12px; color: #8a5a00;
}
.qr-img { display: block; width: 220px; max-width: 80%; margin: 6px auto; border-radius: 10px; border: 1px solid var(--border); }
.qr-empty {
  text-align: center; color: var(--muted); background: #f6f7fb;
  border-radius: 10px; padding: 40px 10px; margin: 6px 0;
}
.pay-tip { font-size: 12px; color: var(--muted); text-align: center; margin: 12px 0; }

/* ============ 管理后台 ============ */
.admin-page { background: #eef0f7; }
.login-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; max-width: 90vw; }
.login-card h2 { margin-bottom: 14px; text-align: center; }
.login-card input { margin-bottom: 12px; }
.login-tip { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

.admin-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 0 12px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  border: none; background: #fff; padding: 9px 18px; border-radius: 20px;
  cursor: pointer; font-size: 14px; color: var(--muted); box-shadow: 0 1px 4px rgba(30, 40, 80, .06);
}
.tab.active { background: var(--primary); color: #fff; }
.tab-pane { padding-bottom: 40px; }
.filter-row { display: flex; gap: 10px; margin-bottom: 14px; }
.filter-row select { max-width: 160px; }
.order-admin-card .o-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.order-admin-card .o-edit label { font-size: 12px; color: var(--muted); }
.order-admin-card .o-edit input { margin-top: 4px; padding: 7px 10px; font-size: 13px; }
.o-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.tip-line { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.product-edit-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.product-edit-card input, .product-edit-card textarea { margin-top: 4px; }
.pe-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pe-row .inline { display: flex; align-items: center; gap: 6px; color: var(--text); margin: 0; }
.pe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spec-edit { border-top: 1px dashed var(--border); padding-top: 10px; }
.spec-edit p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.spec-row { display: flex; gap: 8px; margin-bottom: 8px; }
.spec-row input { margin-top: 0; }
.save-bar { display: block; width: 100%; margin-top: 8px; }

.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-group label { font-size: 14px; cursor: pointer; }
.qr-upload { display: flex; gap: 20px; }
.qr-upload > div { flex: 1; }
.qr-upload p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.qr-preview { width: 120px; border-radius: 8px; border: 1px solid var(--border); display: block; margin-bottom: 8px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 24, 40, .9); color: #fff; font-size: 14px;
  padding: 10px 22px; border-radius: 24px; opacity: 0;
  transition: all .25s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(220, 60, 60, .95); }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0 40px; }

/* ============ 顶部用户栏 ============ */
.user-bar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 6px 0; font-size: 13px;
}
.ub-inner { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.ub-guest, .ub-user { display: flex; align-items: center; gap: 8px; }
.ub-user b { color: var(--primary-dark); margin-right: 2px; }

/* ============ 作品展示 ============ */
.works-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 10px;
}
.work-card {
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 10px rgba(30, 40, 80, .06);
  transition: transform .15s, box-shadow .15s;
}
.work-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(108, 92, 231, .18); }
.work-cover { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f0f0f5; }
.work-cover.empty-cover {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.work-info { padding: 12px 14px; }
.work-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.work-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ============ 聊天浮窗 ============ */
.chat-modal { max-width: 480px; display: flex; flex-direction: column; max-height: 85vh; }
.chat-body {
  flex: 1; overflow-y: auto; padding: 16px; background: #f6f7fb;
  display: flex; flex-direction: column; gap: 10px; min-height: 260px;
}
.chat-tip { text-align: center; color: var(--muted); font-size: 13px; margin: auto; }
.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg.me { align-self: flex-end; align-items: flex-end; }
.chat-msg.admin { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 8px 12px; border-radius: 12px; font-size: 14px; word-break: break-word;
  line-height: 1.5;
}
.chat-msg.me .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.admin .chat-bubble { background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-time { font-size: 10px; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: #fff; }
.chat-input-row input { flex: 1; }

/* ============ 用户管理 ============ */
.user-card .u-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.u-name { font-size: 15px; }
.u-phone { font-size: 13px; color: var(--muted); }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); margin: 8px 0; cursor: pointer; }

@media (max-width: 520px) {
  .pe-grid, .order-admin-card .o-edit { grid-template-columns: 1fr; }
  .qr-upload { flex-direction: column; }
  .works-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
}
