/* 4VUPS v2 前台补充层：结果弹窗 / 遮罩 / 表单 / 移动端增强 / 粉丝中心。
   叠加在 vups.css（v1 设计语言）之上。 */

/* 页眉下方统一留白（sticky nav 不占文档流高度，内容需要主动让位） */
body.vups main { padding-top: 28px; }
@media (max-width: 640px) { body.vups main { padding-top: 20px; } }

/* ---- 居中结果弹窗 ---- */
.vups-toast {
  position: fixed; z-index: 400; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  display: flex; align-items: center; gap: 12px;
  background: var(--vups-card); color: var(--vups-text);
  border: 1px solid var(--vups-border);
  border-radius: 14px; padding: 18px 26px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  animation: vups-toast-in .18s ease forwards;
  max-width: min(86vw, 460px);
}
.vups-toast .t-ic {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #1d7a3a; color: #fff; font-weight: 700;
}
.vups-toast.is-error .t-ic { background: #e5484d; }
.vups-toast .t-msg { font-size: 15px; line-height: 1.6; }
.vups-toast .t-close {
  border: none; cursor: pointer; border-radius: 999px;
  padding: 6px 16px; background: var(--vups-primary);
  color: var(--vups-primary-text); font-size: 13px; flex: none;
}
@keyframes vups-toast-in { to { transform: translate(-50%, -50%) scale(1); } }

/* ---- 处理中遮罩 ---- */
.vups-busy {
  position: fixed; inset: 0; z-index: 390;
  background: rgba(20, 16, 18, .38);
  display: flex; align-items: center; justify-content: center;
}
.vups-busy-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--vups-card); border-radius: 14px;
  padding: 16px 26px; color: var(--vups-text); font-size: 15px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
.spin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid var(--vups-border); border-top-color: var(--vups-primary);
  animation: vups-spin .8s linear infinite;
}
@keyframes vups-spin { to { transform: rotate(360deg); } }

/* ---- 表单 ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 600; }
.field input[type="text"], .field input[type="password"],
.field input[type="tel"], .field input[type="number"],
.field textarea, .field select {
  width: 100%; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--vups-border); border-radius: 10px;
  background: var(--vups-card); color: var(--vups-text);
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--vups-primary); outline-offset: -1px;
}

/* ---- 自定义控件：下拉框（去原生外观，主题化箭头） ---- */
body.vups select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--vups-border); border-radius: 10px;
  background-color: var(--vups-card); color: var(--vups-text);
  font-family: inherit; font-size: 14px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239b8f96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
body.vups select:focus {
  outline: 2px solid var(--vups-primary); outline-offset: -1px;
}

/* ---- 自定义控件：复选框（主题色，非 OS 原生） ---- */
body.vups input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex: none;
  margin: 2px 0 0; padding: 0;
  border: 1.5px solid var(--vups-border); border-radius: 5px;
  background: var(--vups-card); cursor: pointer;
  position: relative; display: inline-block;
  transition: background .12s, border-color .12s;
  vertical-align: middle;
}
body.vups input[type="checkbox"]:hover { border-color: var(--vups-primary); }
body.vups input[type="checkbox"]:checked {
  background: var(--vups-primary); border-color: var(--vups-primary);
}
body.vups input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5px; top: 1.5px;
  width: 5px; height: 10px;
  border: solid var(--vups-primary-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* 复选框标签：图标与文字对齐，长文字换行时悬挂缩进 */
label.vups-check {
  display: flex; gap: 9px; align-items: flex-start;
  cursor: pointer; font-size: 14px; line-height: 1.6;
}
label.vups-check input[type="checkbox"] { margin-top: 4px; }
.field .err { color: #e5484d; font-size: 13px; margin-top: 4px; }
.field .err:empty { display: none; }   /* 空态不占位：输入框与按钮间不留 18px 预留行 */
.field.has-err input, .field.has-err textarea { border-color: #e5484d; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- 页头用户菜单（v1 语言微调） ---- */
.nav-caret { font-size: 11px; color: var(--vups-muted); }
.nav-uname { font-size: 14px; max-width: 9em; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.nav-avatar-fb {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--vups-accent); color: var(--vups-primary); font-weight: 700;
}
.nav-dd-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 8px 12px; border-radius: 8px; font-size: 14px; cursor: pointer;
  color: var(--vups-text); font-family: inherit; line-height: 1.7;
}
.nav-dd-item:hover { background: var(--vups-accent); }
.nav-dd-item.is-danger { color: #e5484d; }

/* ---- 空状态 ---- */
.empty { text-align: center; color: var(--vups-muted); padding: 46px 16px; font-size: 14px; }
.empty .ic { font-size: 34px; display: block; margin-bottom: 10px; }

/* ---- 骨架屏 ---- */
.skel { background: linear-gradient(90deg, var(--vups-border) 25%, var(--vups-accent) 50%, var(--vups-border) 75%);
  background-size: 200% 100%; animation: vups-skel 1.2s infinite; border-radius: 10px; }
@keyframes vups-skel { to { background-position: -200% 0; } }

/* ---- 认证页 ---- */
.auth-wrap { max-width: 420px; margin: 28px auto 46px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tabs .btn { flex: 1; text-align: center; }
.auth-tabs .btn.is-cur { background: var(--vups-primary); color: var(--vups-primary-text); }
.auth-note { font-size: 13px; color: var(--vups-muted); margin-top: 14px; line-height: 1.8; }

/* ---- 粉丝中心（/me） ---- */
.me-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 18px 0;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.me-tabs a {
  flex: none; padding: 8px 16px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--vups-border); color: var(--vups-text);
}
.me-tabs a.is-cur { background: var(--vups-primary); color: var(--vups-primary-text); border-color: var(--vups-primary); }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0; }
.stat-cards .card { padding: 18px; text-align: center; }
.stat-cards .num { font-size: 26px; font-weight: 700; color: var(--vups-primary); }
.stat-cards .lbl { font-size: 13px; color: var(--vups-muted); }
@media (max-width: 640px) { .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; } }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--vups-muted); font-weight: 600;
  padding: 10px 8px; border-bottom: 2px solid var(--vups-border); white-space: nowrap; }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--vups-border); vertical-align: middle; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 720px) {
  .table th:nth-child(n+3), .table td:nth-child(n+3) { display: none; }
  .table td:first-child { min-width: 9em; }
}

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; background: var(--vups-accent); color: var(--vups-primary); }
.badge.b-ok { background: #e2f4e8; color: #1d7a3a; }
.badge.b-warn { background: #fdf0d7; color: #9a6b13; }
.badge.b-danger { background: #fbe3e4; color: #b3272c; }
.badge.b-gray { background: #eeeaee; color: #6f6874; }

/* 状态徽章映射（订单/审核） */
.st-pending_address { background: #fdf0d7; color: #9a6b13; }
.st-pending_ship { background: #dbeafe; color: #1d4ed8; }
.st-shipped { background: #e0e7ff; color: #4338ca; }
.st-completed { background: #e2f4e8; color: #1d7a3a; }
.st-cancelled { background: #eeeaee; color: #6f6874; }

/* ---- 移动端全局增强（≥44px 触控目标） ---- */
@media (max-width: 640px) {
  .btn { min-height: 40px; padding: 9px 16px; }
  .btn-sm { min-height: 34px; }
  .vups-nav .inner { height: 54px; gap: 8px; }
  .vups-nav .brand { font-size: 17px; }
  .container { padding: 0 14px; }
  .nav-uname { display: none; }
  body { font-size: 15px; }
  .card { border-radius: calc(var(--vups-radius) * .8); }
  .modal-card { width: 92vw; max-width: 420px; }
  .pager { justify-content: center; }
}

/* prefers-reduced-motion（正式无障碍时再启用降级；v1 教训：IAB 开关会命中） */
@media (prefers-reduced-motion: reduce) {
  .spin, .skel { animation-duration: 2s; }
}

/* 调色板：色点按钮 + vanilla-picker 弹层（ISC，本地自托管） */
.pal-swatch { width: 38px; height: 34px; border-radius: 10px; flex: none;
  border: 1px solid var(--vups-border); background: var(--vups-card);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; }
.pal-dot { width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid rgba(0,0,0,.15); }   /* 始终显示当前生效色 */
/* 颜色项行：文字定宽，色点紧跟文字之后且各行左对齐 */
.pal-field > div > label { flex: 0 0 108px; font-size: 12px; }
/* 订单详情数量/消耗积分：数字放大突出（随主题色） */
.od-num { font-size: 22px; font-weight: 700; color: var(--vups-primary);
  margin: 0 2px; }

/* vanilla-picker 弹层抬升：默认 z-index:2 挂在按钮内，会被后续兄弟元素盖住 */
body .picker_wrapper.popup { z-index: 1050 !important; }
