/* ==========================================================================
   会员中心（消费者端 /inside）
   消费端排版：顶部 + 左侧 5 组菜单 + 大卡片网格；≤900px 底部 5 个主 Tab
   ========================================================================== */
:root {
  --blue: #2563eb;
  --blue-weak: #eff6ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --side-w: 210px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
a { color: var(--blue); text-decoration: none; }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.grow { flex: 1 1 auto; }
.hide, [hidden] { display: none !important; }

/* ---------------- 顶部 ---------------- */
.mc-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.head-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mc-logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.head-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.head-brand-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-brand-text i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.head-search { display: flex; gap: 6px; flex: 1 1 260px; max-width: 420px; }
.head-search input {
  flex: 1 1 auto; min-width: 0; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 999px; font: inherit; background: #f8fafc;
}
.head-search input:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); background: #fff; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-pill {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.head-pill b { color: var(--blue); }
.head-pill .dot {
  display: inline-block; margin-left: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; line-height: 16px; text-align: center; font-style: normal;
}
.head-user { font-size: 13px; color: var(--ink-3); }
.only-narrow { display: none; }

/* ---------------- 左右布局 ---------------- */
.mc-body { display: grid; grid-template-columns: var(--side-w) 1fr; align-items: start; min-height: calc(100vh - 52px); }
.mc-side {
  position: sticky; top: 52px;
  align-self: start;
  padding: 12px 8px 24px;
  border-right: 1px solid var(--line);
  background: #fff;
  height: calc(100vh - 52px);
  overflow-y: auto;
}
.side-group { margin-bottom: 4px; }
.side-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink-2); font: inherit; cursor: pointer; text-align: left;
}
.side-head:hover { background: #f1f5f9; }
.side-ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--blue); }
.side-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.side-text { flex: 1 1 auto; font-weight: 600; font-size: 13.5px; }
.side-arrow { font-size: 10px; color: #94a3b8; transition: transform .16s; }
.side-group.is-open .side-arrow { transform: rotate(90deg); }
.side-items { list-style: none; margin: 2px 0 6px; padding: 0 0 0 8px; }
.side-group:not(.is-open) .side-items { display: none; }
.side-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 9px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-item:hover { background: var(--blue-weak); color: var(--blue); }
.side-item.is-active { background: var(--blue); color: #fff; font-weight: 600; }
.side-item .tag { margin-left: 6px; font-size: 10px; opacity: .8; }

.mc-main { min-width: 0; padding: 14px 18px 48px; }
.mc-crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.mc-crumb b { color: var(--ink); }
.mc-view { display: block; }

/* ---------------- 移动端底部 Tab ---------------- */
.mc-tabbar { display: none; }

/* ---------------- 通用卡片 / 按钮 ---------------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer;
}
.btn:hover { border-color: #94a3b8; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-link { background: transparent; border: 0; color: var(--blue); padding: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid transparent; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.wait { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.gray { background: #f1f5f9; color: var(--ink-3); }

/* ---------------- 概览大卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background-image: linear-gradient(180deg, #f8fbff, #fff);
}
.stat .label { font-size: 12.5px; color: var(--ink-3); }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 6px; }
.stat.accent .value { color: var(--blue); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }

/* ---------------- 商品卡片网格 ---------------- */
.goods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.goods-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow .16s, transform .16s;
}
.goods-card:hover { box-shadow: 0 10px 26px rgba(15, 23, 42, .10); transform: translateY(-2px); }
.goods-img {
  height: 120px; background: linear-gradient(135deg, #e0ecff, #f5f9ff);
  display: grid; place-items: center; color: #93b4ef; font-size: 26px; font-weight: 700;
}
.goods-img img { width: 100%; height: 100%; object-fit: cover; }
.goods-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.goods-name { font-weight: 600; font-size: 14px; line-height: 1.45; min-height: 40px; }
.goods-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goods-price { color: #e11d48; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.goods-face { font-size: 12px; color: var(--ink-3); }
.goods-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.stock-tag { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: #f1f5f9; color: var(--ink-3); }
.stock-tag.low { background: #fef3c7; color: #92400e; }
.stock-tag.out { background: #fee2e2; color: #991b1b; }

/* 分类网格 */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  cursor: pointer; text-align: left; font: inherit;
}
.cat-card:hover { border-color: #bfdbfe; background: var(--blue-weak); }
.cat-card b { display: block; font-size: 14px; margin-bottom: 4px; }
.cat-card span { font-size: 12px; color: var(--ink-3); }

/* ---------------- 订单 / 卡密 ---------------- */
.order-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.order-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-no { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--ink-3); }
.order-goods { font-weight: 600; }
.order-money { color: #e11d48; font-weight: 800; font-size: 18px; }
.order-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.card-secret {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all;
}
.card-secret .k { color: #93c5fd; }
.card-secret .v { flex: 1 1 160px; }
.secret-list { display: grid; gap: 8px; margin-top: 10px; }

/* 表格（订单/流水） */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; text-align: left; }
table.tbl th { background: #f8fafc; color: var(--ink-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
table.tbl td.num, table.tbl th.num { text-align: right; }
.empty { padding: 22px 10px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* 表单 / 弹窗 */
.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.input, .select, textarea.input {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 13.5px; background: #fff;
}
.input:focus, .select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.err { color: var(--bad); font-size: 12.5px; min-height: 16px; margin: 0; }

/* 登录 */
.login-mask { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0b1220, #16305c); }
.login-card { background: #fff; border-radius: 16px; padding: 22px; width: min(380px, 100%); display: grid; gap: 8px; }
.login-card h1 { margin: 0 0 2px; font-size: 19px; }
.login-card .muted { margin: 0 0 6px; font-size: 12.5px; }

/* 提示 */
.toast-box { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 90; }
.toast-item { background: #0f172a; color: #f8fafc; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(15, 23, 42, .28); }
.toast-item.err { background: #b91c1c; }

/* 直充发货状态条 */
.status-bar {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 10px 12px; border-radius: 10px; background: #eff6ff; color: #1d4ed8; font-size: 13px;
}
.status-bar .pulse { width: 8px; height: 8px; border-radius: 50%; background: #2563eb; animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .55); }
  70% { box-shadow: 0 0 0 9px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* 移动端 Tab 未读红点 + 抽屉遮罩 */
.tab-btn { position: relative; }
.tab-dot {
  position: absolute; top: 2px; right: 50%; transform: translateX(15px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-style: normal;
}
.drawer-mask { display: none; }
@media (max-width: 900px) {
  body.drawer-open .drawer-mask { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .38); z-index: 45; }
}

/* 未建设页 */
.pending-note {
  display: flex; gap: 10px; padding: 14px; border-radius: 12px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; font-size: 13.5px; line-height: 1.8;
}
.pending-list { margin: 12px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13px; line-height: 2; }

/* ---------------- 窄屏：底部 Tab + 抽屉菜单 ---------------- */
@media (max-width: 900px) {
  .mc-body { grid-template-columns: 1fr; }
  .mc-side {
    position: fixed; top: 0; left: 0; z-index: 50; height: 100vh; width: 250px;
    padding-top: 16px; transform: translateX(-100%); transition: transform .18s ease;
    border-right: 1px solid var(--line);
  }
  body.drawer-open .mc-side { transform: translateX(0); }
  .mc-main { padding: 12px 12px 84px; }
  .mc-head { padding: 8px 12px; gap: 8px; }
  .head-search { order: 3; flex: 1 1 100%; max-width: none; }
  .head-user, #head-logout { display: none; }
  .only-narrow { display: inline-flex; }
  .mc-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-btn {
    border: 0; background: transparent; padding: 6px 2px; border-radius: 10px;
    display: grid; gap: 2px; justify-items: center; color: var(--ink-3); font: inherit; font-size: 11px; cursor: pointer;
  }
  .tab-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }
  .tab-btn.is-active { color: var(--blue); }
  .goods-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .goods-img { height: 92px; }
  .goods-price { font-size: 19px; }
  .stat .value { font-size: 22px; }
}
