/* ==========================================================
   新音礼物市场 · Apple 风格
   - 底色：中性浅灰（#f5f6f8）+ 极淡冷/暖光晕，不再用高饱和色块
   - 卡片：白玻璃 + 大圆角 + 极轻阴影（Apple 官网质感）
   - 强调色：仅用于主按钮 / 链接 / 状态，其余全部黑白灰
   - 移动端底部 Tab / 桌面端顶部导航
   ========================================================== */

:root {
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, .10);
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --purple: #AF52DE;
  --pink: #FF2D55;

  --text: #111418;
  --text-2: #5b6270;
  --text-3: #8f96a3;
  --line: rgba(17, 20, 24, .07);

  --bg: #f5f6f8;
  --glass: rgba(255, 255, 255, .74);
  --glass-strong: rgba(255, 255, 255, .9);
  --glass-border: rgba(255, 255, 255, .9);

  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 32px rgba(20, 28, 45, .07);
  --shadow-sm: 0 2px 10px rgba(20, 28, 45, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 6% -6%, rgba(0, 113, 227, .07), rgba(0, 113, 227, 0) 60%),
    radial-gradient(760px 460px at 98% 0%, rgba(255, 149, 0, .05), rgba(255, 149, 0, 0) 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 旧的彩色光斑层：保留标记但不渲染，避免影响老页面结构 */
.bg-blobs { display: none; }

/* ---------- 布局 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 16px 16px 96px; }
@media (min-width: 768px) { .container { padding-bottom: 48px; } }

/* ---------- 白玻璃卡片 ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.glass-strong { background: var(--glass-strong); }
.card { padding: 20px; margin-bottom: 16px; }

/* ---------- 顶部导航（桌面）/ 毛玻璃栏 ---------- */
.navbar {
  position: sticky; top: 12px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; margin-bottom: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 6px 24px rgba(20, 28, 45, .06);
}
.navbar .brand { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.navbar .brand .logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: #111418; color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(17, 20, 24, .22);
}
.navbar .links { display: none; gap: 2px; margin-left: auto; }
.navbar .links a {
  padding: 8px 15px; border-radius: 999px; text-decoration: none; color: var(--text-2);
  font-size: .9rem; font-weight: 500; transition: all .2s;
}
.navbar .links a:hover { background: rgba(0, 0, 0, .045); color: var(--text); }
.navbar .links a.active { background: var(--text); color: #fff; }
@media (min-width: 768px) { .navbar .links { display: flex; } }

.navbar .me { margin-left: auto; display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .88rem; }
@media (min-width: 768px) { .navbar .me { margin-left: 8px; } }
.navbar .me img, .navbar .me .avatar-ph {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  background: #e6e9ee; display: grid; place-items: center; font-size: 13px; color: var(--text-2);
}

/* ---------- 移动端底部 Tab ---------- */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  display: flex; border-radius: 999px; padding: 6px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 12px 34px rgba(20, 28, 45, .14);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0; border-radius: 999px; text-decoration: none; color: var(--text-2);
  font-size: .67rem; font-weight: 600; transition: all .2s;
}
.tabbar a .ic { font-size: 19px; line-height: 1; }
.tabbar a.active { background: var(--text); color: #fff; }
@media (min-width: 768px) { .tabbar { display: none; } }

/* ---------- 商品网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.item-card {
  overflow: hidden; border-radius: var(--radius-md); padding: 0; background: #fff;
  text-decoration: none; color: var(--text); display: block;
  transition: transform .25s, box-shadow .25s;
}
.item-card:hover { transform: translateY(-3px); box-shadow: 0 16px 38px rgba(20, 28, 45, .13); }
.item-card .thumb { aspect-ratio: 1; width: 100%; object-fit: cover; display: block; background: #f0f2f5; }
.item-card .info { padding: 12px 14px 14px; }
.item-card .name { font-weight: 600; font-size: .94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card .sub { font-size: .75rem; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card .price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.item-card .price { color: var(--text); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.item-card .price::before { content: "¥"; font-size: .72rem; margin-right: 1px; }
.item-card .diamond { font-size: .72rem; color: var(--text-3); font-weight: 600; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 600;
}
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.green { background: rgba(52, 199, 89, .13); color: #248a3d; }
.badge.orange { background: rgba(255, 149, 0, .14); color: #b25000; }
.badge.red { background: rgba(255, 59, 48, .11); color: #d1332a; }
.badge.gray { background: rgba(17, 20, 24, .06); color: var(--text-2); }
.badge.purple { background: rgba(175, 82, 222, .12); color: #8a3fbf; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border: none; border-radius: 999px; cursor: pointer;
  font-size: .94rem; font-weight: 600; font-family: inherit; text-decoration: none;
  transition: all .2s; color: var(--text); background: rgba(17, 20, 24, .055);
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0, 113, 227, .22); }
.btn.primary:hover { background: #0062c4; }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(52, 199, 89, .2); }
.btn.red { background: var(--red); color: #fff; }
.btn.dark { background: var(--text); color: #fff; }
.btn.ghost { background: rgba(17, 20, 24, .05); color: var(--text-2); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 16px; font-size: .82rem; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .84rem; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 13px 16px; border: 1px solid rgba(17, 20, 24, .09); border-radius: var(--radius-sm);
  background: #fff; font-size: 1rem; font-family: inherit; color: var(--text);
  outline: none; transition: all .2s; -webkit-appearance: none; appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, .11);
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: #b3b9c2; }
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: .75rem; color: var(--text-3); margin-top: 6px; }

/* 分段选择器（iOS Segmented Control） */
.segment { display: flex; background: rgba(17, 20, 24, .055); border-radius: 12px; padding: 3px; gap: 3px; }
.segment label { flex: 1; margin: 0; }
.segment input { display: none; }
.segment span {
  display: block; text-align: center; padding: 9px 0; border-radius: 9px; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text-2); transition: all .2s;
}
.segment input:checked + span { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(17, 20, 24, .1); }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: #fff; border: 1px solid var(--line); color: var(--text-2);
  cursor: pointer; text-decoration: none; transition: all .2s; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- 列表行（订单等） ---------- */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 10px;
  border-radius: var(--radius-md); text-decoration: none; color: var(--text); background: #fff;
  border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm);
}
.list-row .thumb-s { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: #f0f2f5; flex: 0 0 auto; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: .95rem; }
.list-row .meta { font-size: .78rem; color: var(--text-3); margin-top: 3px; }
.list-row .right { text-align: right; flex: 0 0 auto; }
.list-row .amount { font-weight: 700; color: var(--text); }

/* ---------- 表格（管理端，桌面） ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
.table th {
  text-align: left; padding: 12px 14px; color: var(--text-2); font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: .8rem;
}
.table td { padding: 12px 14px; border-bottom: 1px solid rgba(17, 20, 24, .045); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table img.t-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; cursor: zoom-in; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(20, 22, 28, .32); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
@media (min-width: 640px) { .modal-mask { align-items: center; } }
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: #fff; -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 26px 26px 0 0; padding: 24px;
  box-shadow: 0 24px 60px rgba(17, 20, 24, .2);
  animation: slideUp .3s ease;
}
@media (min-width: 640px) { .modal { border-radius: 26px; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.modal .m-title { font-size: 1.12rem; font-weight: 700; margin-bottom: 16px; }
.modal .m-close {
  position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border: none;
  border-radius: 50%; background: rgba(17, 20, 24, .06); cursor: pointer; font-size: 15px; color: var(--text-2);
}
.modal { position: relative; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 18px; border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.stat .num { font-size: 1.45rem; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .lbl { font-size: .8rem; color: var(--text-2); font-weight: 600; }

/* ---------- 深色主卡片（余额等） ---------- */
.hero-card {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, #2b2f36 0%, #17191e 58%, #212630 100%);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 16px 38px rgba(14, 17, 22, .22);
}
.hero-card::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 250px; height: 250px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, .45), rgba(0, 113, 227, 0) 68%);
}
.hero-card > * { position: relative; z-index: 1; }

/* 收款码展示 */
.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 430px; margin: 0 auto; }
.qr-cell { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: center; }
.qr-cap { font-size: .78rem; color: var(--text-3); font-weight: 600; }
.qr-box { text-align: center; padding: 16px; border-radius: var(--radius-md); background: #fff; }
.qr-box img { width: 100%; max-width: 220px; border-radius: 14px; }
.qr-box .t { font-weight: 700; margin-top: 10px; font-size: .9rem; }

/* 收款码上传格子（正方形，图片居中，不再溢出） */
.qr-upload {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; width: 100%; max-width: 200px; margin: 0 auto; padding: 14px; aspect-ratio: 1 / 1; overflow: hidden;
  border: 1.5px dashed rgba(17, 20, 24, .14); border-radius: 20px;
  background: rgba(255, 255, 255, .6); color: var(--text-3);
  font-size: .82rem; font-weight: 600; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.qr-upload:hover { border-color: var(--blue); color: var(--blue); background: rgba(0, 113, 227, .04); }
.qr-upload .qr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; line-height: 1.4; }
.qr-upload .qr-empty .ic { font-size: 24px; line-height: 1; }
.qr-upload img { display: none; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
.qr-upload.has { border-style: solid; border-color: var(--line); background: #fff; }
.qr-upload.has img { display: block; }
.qr-upload.has .qr-empty { display: none; }
.qr-upload .qr-tip {
  display: none; position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 0;
  background: rgba(17, 20, 24, .55); color: #fff; font-size: .72rem; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.qr-upload.has:hover .qr-tip { display: block; }

/* ---------- 提示 / 空状态 ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ic { font-size: 42px; margin-bottom: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: rgba(17, 20, 24, .92); color: #fff; padding: 12px 24px; border-radius: 999px;
  font-size: .9rem; z-index: 200; opacity: 0; pointer-events: none; transition: all .3s;
  max-width: 86vw; text-align: center;
}
@media (min-width: 768px) { .toast { bottom: 40px; } }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 杂项 ---------- */
.page-title { font-size: 1.38rem; font-weight: 800; margin: 6px 0 16px; letter-spacing: -.02em; }
.section-title { font-size: 1.02rem; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; justify-content: space-between; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.small { font-size: .8rem; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.tc { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.steps { display: flex; gap: 6px; margin: 14px 0 20px; }
.steps .step { flex: 1; height: 4px; border-radius: 4px; background: rgba(17, 20, 24, .08); }
.steps .step.on { background: var(--text); }

/* 搜索框 */
.search-box { position: relative; margin-bottom: 14px; }
.search-box form { display: flex; gap: 8px; }
.search-box input { flex: 1; min-width: 0; padding-left: 42px; border-radius: 999px; background: #fff; }
.search-box::before {
  content: "🔍"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: .45;
}

/* 图片预览（点击放大） */
.img-viewer {
  position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .86); display: none;
  align-items: center; justify-content: center; cursor: zoom-out;
}
.img-viewer.show { display: flex; }
.img-viewer img { max-width: 92vw; max-height: 88vh; border-radius: 12px; }

/* ---------- 通用上传框（付款截图 / 送礼截图 / 后台礼物图） ---------- */
.upload-box,
.field label.upload-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 118px; padding: 18px; margin-bottom: 0;
  border: 1.5px dashed rgba(17, 20, 24, .14); border-radius: 18px;
  text-align: center; color: var(--text-3); font-size: .86rem; font-weight: 600; line-height: 1.4;
  cursor: pointer; background: rgba(255, 255, 255, .65); transition: all .2s;
}
.upload-box:hover,
.field label.upload-box:hover { border-color: var(--blue); color: var(--blue); background: rgba(0, 113, 227, .04); }
.upload-box img { display: block; max-width: 100%; max-height: 170px; border-radius: 12px; background: #fff; }

/* 页脚 */
.footer { text-align: center; color: var(--text-3); font-size: .75rem; padding: 28px 0 8px; }
.footer a { color: var(--text-2); text-decoration: none; }
