/* ==========================================================================
   绿港优选 · 网页版样式
   移动端优先，向下兼容桌面；零依赖、零构建
   ========================================================================== */

:root {
  /* ── 品牌色（取自绿港 logo） ───────────────────────────── */
  --brand-color: #51AB4F;      /* logo 主绿 */
  --brand-dark: #2F7A3C;       /* 深绿：文字/主按钮（白字对比度 ≥4.5:1） */
  --brand-light: #E9F6EC;      /* 浅绿：底纹/选中背景 */
  --accent-color: #D85A30;     /* 强调：价格/临期 */
  --bg-color: #F3F7F3;         /* 页面底色 */
  --text-color: #1B2430;       /* 正文 */

  /* 品牌（兼容既有引用） */
  --c-main: var(--brand-dark);   /* 主色：导航/按钮/选中 */
  --c-main-d: #1E5C2B;           /* 主色深（hover/渐变尾） */
  --c-main-l: var(--brand-light);/* 主色浅（底纹/选中背景） */
  --c-price: var(--accent-color);
  --c-ok: #2E8B57;
  --c-warn: #B34A3A;

  --bg: var(--bg-color);
  --card: #FFFFFF;
  --text: var(--text-color);
  --text-2: #5A6672;
  --muted: #8B97A3;
  --line: #E8ECF1;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 44, 28, .04), 0 6px 18px rgba(20, 44, 28, .06);
  --shadow-up: 0 -1px 0 var(--line);
  --topbar-h: 54px;
  --sup-h: 320px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: #E6EDE7;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
/* 图片比例：默认不锁定高度，由宽高比自适应；容器内改用 object-fit */
img { max-width: 100%; height: auto; display: block; }
button, input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 应用外壳 ---------- */
.phone {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(20, 44, 28, .10);
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  height: var(--topbar-h);
  background: linear-gradient(135deg, var(--c-main) 0%, var(--c-main-d) 100%);
  color: #fff;
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(31, 92, 45, .20);
}
.topbar .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar .brand img { height: 26px; width: auto; max-width: none; object-fit: contain; flex: 0 0 auto; }
.topbar .brand .tt { min-width: 0; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .4px; line-height: 1.2; }
.topbar .sub { font-size: 11.5px; opacity: .8; margin-top: 0; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 顶栏最右侧：当前登录账号的真实姓名（未登录时不占位） */
.top-user {
  margin-left: auto;
  flex: 0 0 auto;
  max-width: 48%;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-user:empty { display: none; }

/* ---------- 内容区 ---------- */
.view {
  flex: 1;
  padding: 12px 12px calc(22px + env(safe-area-inset-bottom));
  min-height: 0;
}
.view-pad { padding-top: 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.card.center-media { text-align: center; padding: 24px 18px; }
.card.center-media img { max-height: 190px; width: auto; margin: 0 auto 14px; }
.section-h {
  font-size: 15px; font-weight: 600; margin: 0 0 10px;
  display: flex; align-items: center; gap: 7px;
}
.section-h::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px;
  background: var(--brand-color); flex: 0 0 auto;
}
.muted { color: var(--muted); font-size: 13px; }
.tip { text-align: center; color: var(--muted); font-size: 14px; padding: 44px 16px; }

/* ---------- 登录页：平台介绍 + 转发块 ----------
   这块的作用是「让人愿意转发」：一句话说清平台是什么，三步说清怎么用，
   末尾给一个可点的复制链接按钮。文字要够大，转发到群里被截屏也读得清。 */
.card.intro {
  padding: 16px 15px 14px;
  border: 1px solid var(--brand-light);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FBF7 100%);
}
.intro-hd { display: flex; align-items: center; gap: 10px; }
.intro-logo { flex: 0 0 auto; height: 38px; width: auto; }
.intro-ht { min-width: 0; }
.intro-t {
  font-size: 17px; font-weight: 700; color: var(--c-main);
  line-height: 1.25; letter-spacing: .3px;
}
.intro-s {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.intro-p {
  font-size: 14px; line-height: 1.7; color: var(--text-2);
  margin: 11px 0 0; padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.intro-steps { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.intro-step {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-2); line-height: 1.5;
}
.intro-step i {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%; background: var(--brand-light); color: var(--c-main);
  font-style: normal; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.intro-ft {
  margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.intro-btn { width: 100%; }
.intro-tip { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }
/* 窄屏收窄留白，介绍块仍完整可读 */
@media (max-width: 340px) {
  .intro-p { font-size: 13.5px; }
  .intro-step { font-size: 12.5px; }
}

/* ---------- 品牌块（券码绑定页头图） ---------- */
.hero {
  background: linear-gradient(135deg, var(--c-main) 0%, #33833C 55%, var(--c-main-d) 100%);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  color: #fff;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(31, 92, 45, .22);
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero .h-title { font-size: 17px; font-weight: 600; position: relative; }
.hero .h-desc { font-size: 12.5px; opacity: .85; margin-top: 4px; position: relative; }
.hero-stats { display: flex; gap: 8px; margin-top: 14px; position: relative; }
.hero-stats .hs {
  flex: 1; background: rgba(255, 255, 255, .14); border-radius: var(--radius-sm);
  padding: 9px 6px; text-align: center; backdrop-filter: blur(2px);
}
.hero-stats .hs b { display: block; font-size: 19px; font-weight: 600; line-height: 1.2; }
.hero-stats .hs span { font-size: 11px; opacity: .82; }

/* ---------- 首页功能宫格（两列图标入口） ---------- */
.view.home { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.brand { cursor: pointer; -webkit-user-select: none; user-select: none; }
.brand:active { opacity: .82; }
.brand:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 6px; }
.fgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ftile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 12px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.ftile:active { transform: scale(.96); }
.ftile:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.ftile .fi {
  width: 54px; height: 54px; margin: 0 auto 10px;
  border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-light), #DCEFE1);
  color: var(--brand-dark);
}
.ftile .fi svg { width: 26px; height: 26px; display: block; }
.ftile .ft { font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ftile .fs { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.home-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---------- 输入 ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.inp {
  flex: 1; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 15px; outline: none;
  background: #FAFBFC; color: var(--text);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.inp::placeholder { color: #AEB8C2; }
.inp:focus { border-color: var(--c-main); background: #fff; }
.inp.code { letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin-top: 7px; min-height: 16px; }
.hint.err { color: var(--c-warn); }
.hint.ok { color: var(--c-ok); }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%; margin-top: 12px; padding: 12px;
  font-size: 15px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--c-main) 0%, var(--c-main-d) 100%);
  border: none; border-radius: 999px; cursor: pointer;
  transition: opacity .15s var(--ease), transform .08s var(--ease);
}
.btn:active { opacity: .88; transform: scale(.995); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: #fff; color: var(--c-main); border: 1px solid var(--c-main);
}
.btn.sm { margin-top: 0; width: auto; padding: 10px 22px; border-radius: var(--radius-sm); font-size: 14px; }
.btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-sm {
  flex: 0 0 auto; margin: 0; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: #fff; background: var(--c-main);
  border: none; cursor: pointer; white-space: nowrap;
}
.btn-sm:active { opacity: .85; }

/* ---------- 价格 / 标签 ---------- */
.price { color: var(--c-price); font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--c-main-l); color: var(--c-main); white-space: nowrap;
}
.tag.hot { background: #FDEDE6; color: var(--c-price); }
.tag.gift { background: #FDF6E3; color: #9A7415; }
.tag.out { background: #F1F3F5; color: var(--muted); }

/* ---------- 分类横滑 ---------- */
.cats {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; padding: 7px 15px; border-radius: 999px; font-size: 13px;
  background: #fff; color: var(--text-2); border: 1px solid var(--line);
  cursor: pointer; white-space: nowrap; transition: all .15s var(--ease);
}
.cat-on { background: var(--c-main); color: #fff; border-color: var(--c-main); }

/* ---------- 搜索 ---------- */
.search { margin-bottom: 10px; position: relative; }
.search .inp { border-radius: 999px; padding-left: 38px; }
.search::before {
  content: ""; position: absolute; left: 14px; top: 50%;
  width: 15px; height: 15px; margin-top: -8px; opacity: .45;
  background: currentColor; color: var(--muted);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}

/* ---------- 商品网格 ---------- */
.grid { display: flex; flex-wrap: wrap; gap: 10px; }
.grid .item {
  width: calc(50% - 5px);
  background: #fff; border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s var(--ease);
  display: flex; flex-direction: column;
}
.grid .item:active { transform: scale(.985); }

/* 无图时的分类渐变占位 */
.pic {
  width: 100%; aspect-ratio: 4 / 3; position: relative;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .95);
  font-size: 30px; font-weight: 700; letter-spacing: 2px;
  overflow: hidden;
}
.pic::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 18%, rgba(255, 255, 255, .22), transparent 58%);
}
.pic img { width: 100%; height: 100%; object-fit: cover; }
.pic-mark { position: relative; z-index: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
.pic-out {
  position: absolute; inset: 0; z-index: 2; background: rgba(28, 36, 46, .5);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 1px;
}

.grid .body { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.grid .name {
  font-size: 14px; line-height: 1.45; min-height: 40px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.grid .spec { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid .foot-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 8px; }
.grid .price { font-size: 17px; }
.grid .price small { font-size: 11px; font-weight: 600; }
.grid .stock { font-size: 11.5px; color: var(--c-ok); }
.grid .stock.low { color: var(--c-warn); }
.grid .stock.out { color: var(--muted); }

/* ---------- 列表卡（手册 / 查询 / 记录） ---------- */
.mcard {
  background: #fff; border-radius: var(--radius); padding: 14px 15px;
  margin-bottom: 10px; box-shadow: var(--shadow);
}
.mtop, .qtop, .rec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mname, .qname { font-size: 16px; font-weight: 600; line-height: 1.4; flex: 1; }
.mspec { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.mdesc { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.mcard.click { cursor: pointer; transition: transform .12s var(--ease); }
.mcard.click:active { transform: scale(.99); }

/* ---------- 券行 ---------- */
.vrow {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 10px;
  cursor: pointer; background: #fff; transition: all .15s var(--ease);
}
.vrow.von { border-color: var(--c-main); background: var(--c-main-l); box-shadow: 0 0 0 1px var(--c-main) inset; }
.vrow.vused { opacity: .55; }
.vrow.vcode { font-size: 15px; font-weight: 600; letter-spacing: .6px; }
.vrow.vright { text-align: right; flex: 0 0 auto; }
.cd {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: #F1F4F7; color: var(--text-2); margin-top: 3px;
}
.cd.warn { background: #FDEDE6; color: var(--c-price); }
.cd.danger { background: #FBE9E7; color: var(--c-warn); }

/* ---------- 固定提货内容 ---------- */
.pk { margin-top: 2px; }
.pk-name { font-size: 16px; font-weight: 600; line-height: 1.4; }
.pk-spec { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.pk-body {
  margin-top: 10px; padding: 10px 12px;
  background: var(--c-main-l); border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.6; color: var(--text);
}
.pk-lb {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .3px;
  color: var(--c-main); background: #fff;
  border: 1px solid rgba(47, 122, 60, .28); border-radius: 999px;
  padding: 1px 8px; margin-right: 7px; vertical-align: 1px; white-space: nowrap;
}
.pk-note { margin-top: 10px; }

/* ---------- 快递收件表单 ---------- */
.exp-form { margin-top: 4px; }
.f-lb { font-size: 12.5px; color: var(--text-2); margin: 12px 0 5px; }
.exp-form .inp { width: 100%; }
textarea.inp { resize: vertical; line-height: 1.5; min-height: 72px; }

/* ---------- 商城占位页 ---------- */
.mall-ph { text-align: center; padding: 76px 20px 40px; }
.ph-ico {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 22px;
  background: var(--c-main-l); color: var(--c-main);
  display: flex; align-items: center; justify-content: center;
}
.ph-ico svg { width: 38px; height: 38px; display: block; }
.ph-t { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.ph-d { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- 分段控件 ---------- */
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg-i {
  flex: 1; text-align: center; padding: 11px; font-size: 14px;
  color: var(--text-2); cursor: pointer; background: #fff;
  transition: all .15s var(--ease);
}
.seg-i.seg-on { background: var(--c-main); color: #fff; font-weight: 600; }

/* ---------- 记录 ---------- */
.rec { background: #fff; border-radius: var(--radius); padding: 14px 15px; margin-bottom: 10px; box-shadow: var(--shadow); }
.rec.click { cursor: pointer; transition: transform .12s var(--ease); }
.rec .code { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.rec .rowline { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.rec .rowline .k { color: var(--muted); flex: 0 0 auto; }
.rec .rowline .v { text-align: right; }
.badge { font-size: 12px; padding: 3px 11px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.badge.wait { color: var(--c-price); background: #FDEDE6; }
.badge.done { color: var(--c-ok); background: #E7F5EC; }

/* ---------- 商品详情 ---------- */
.banner {
  width: 100%; aspect-ratio: 4 / 3; max-height: 320px;
  border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .95); font-size: 34px; font-weight: 700; letter-spacing: 3px;
  position: relative;
}
.banner img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { font-size: 19px; font-weight: 600; margin: 0; }
.detail-price { font-size: 25px; color: var(--c-price); font-weight: 700; margin: 8px 0 0; }
.detail-price small { font-size: 14px; }
.kv { display: flex; gap: 10px; font-size: 13.5px; margin-top: 7px; }
.kv .k { color: var(--muted); flex: 0 0 62px; }
.kv .v { color: var(--text-2); }
.desc-text { font-size: 14px; line-height: 1.75; color: var(--text-2); }
.sticky-buy {
  position: sticky; bottom: calc(8px + env(safe-area-inset-bottom));
  margin-top: 14px; z-index: 5;
}

/* ---------- 个人中心 ---------- */
.user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 50px; height: 50px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--c-main), var(--c-main-d));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: 0 2px 8px rgba(31, 92, 45, .25);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar span { color: #fff; font-size: 21px; font-weight: 600; }
.uname { font-size: 16px; font-weight: 600; }
.menu .mi {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 4px; border-bottom: 1px solid #F2F4F7;
  font-size: 15px; cursor: pointer; transition: background .12s var(--ease);
}
.menu .mi:last-child { border-bottom: none; }
.menu .mi:active { background: #F7F9FB; }
.menu .mi.danger { color: var(--c-warn); }
.arrow { color: #C3CCD6; font-size: 20px; line-height: 1; }
.foot { text-align: center; font-size: 11px; color: #A8B3BE; padding: 18px 0 4px; line-height: 1.8; }
.foot img { height: 30px; width: auto; margin: 0 auto 8px; opacity: .9; }

/* ---------- 骨架屏 ---------- */
.sk { background: linear-gradient(90deg, #EDF1F5 25%, #F6F8FA 37%, #EDF1F5 63%); background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-item { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.sk-pic { width: 100%; aspect-ratio: 4 / 3; }
.sk-line { height: 11px; margin: 9px 12px 0; }
.sk-line.s1 { width: 78%; }
.sk-line.s2 { width: 52%; height: 9px; }
.sk-line.s3 { width: 34%; height: 15px; margin-top: 12px; }
.sk-card { background: #fff; border-radius: var(--radius); padding: 15px; margin-bottom: 10px; box-shadow: var(--shadow); }
.sk-card .sk-line { margin: 0 0 9px; }
.sk-card .sk-line:last-child { margin-bottom: 0; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 46px 20px; }
.empty .ico { width: 84px; height: 84px; margin: 0 auto 14px; opacity: .9; }
.empty .ico svg { width: 100%; height: 100%; }
.empty .t { font-size: 15px; color: var(--text-2); font-weight: 600; }
.empty .d { font-size: 13px; color: var(--muted); margin-top: 5px; }
.empty .btn { max-width: 220px; margin: 16px auto 0; }

/* ---------- 启动页 ---------- */
.splash {
  position: fixed; inset: 0; z-index: 90;
  background: linear-gradient(160deg, var(--c-main) 0%, #33833C 50%, var(--c-main-d) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px; text-align: center;
  transition: opacity .45s var(--ease), visibility .45s var(--ease);
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash img { max-width: 62%; max-height: 46vh; object-fit: contain; animation: rise .7s var(--ease) both; }
.splash .sp-t { color: #fff; font-size: 15px; letter-spacing: 3px; opacity: .9; animation: rise .7s var(--ease) .12s both; }
.splash .sp-s { color: rgba(255, 255, 255, .68); font-size: 12px; letter-spacing: 1px; animation: rise .7s var(--ease) .2s both; }
.splash .sp-bar { width: 128px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; animation: rise .7s var(--ease) .28s both; }
.splash .sp-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: #fff; animation: slide 1.05s var(--ease) infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(20, 30, 42, .9); color: #fff; padding: 12px 20px;
  border-radius: var(--radius-sm); font-size: 14px; z-index: 80;
  max-width: 82%; text-align: center; pointer-events: none;
  animation: toastIn .2s var(--ease);
  backdrop-filter: blur(4px);
}
.toast.err { background: rgba(179, 74, 58, .94); }
.toast.ok { background: rgba(46, 139, 87, .94); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.95); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 22, 34, .5);
  z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 320px;
  padding: 22px 20px 18px; text-align: center;
  animation: pop .24s var(--ease);
  max-height: 86vh; overflow-y: auto;
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 10px; font-size: 17px; }
.modal p { margin: 0 0 5px; font-size: 14px; color: var(--text-2); }
.modal .btn { margin-top: 18px; }
.modal .btn.ghost { margin-top: 9px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { margin-top: 0; }
.ticket {
  background: linear-gradient(135deg, var(--c-main-l), #fff);
  border: 1px dashed var(--c-main); border-radius: var(--radius-sm);
  padding: 16px 14px; margin: 14px 0 4px;
}
.ticket .no { font-size: 21px; font-weight: 700; letter-spacing: 2px; color: var(--c-main); }
.ticket .lb { font-size: 11.5px; color: var(--muted); margin-top: 4px; letter-spacing: 1px; }

/* ==========================================================================
   桌面 / 平板适配
   ========================================================================== */
@media (min-width: 900px) {
  body { background: #DEE7DF; }
  .phone { max-width: 940px; box-shadow: 0 0 60px rgba(20, 44, 28, .14); }
  .topbar { padding: 0 20px; }
  .topbar h1 { font-size: 19px; }
  .view { padding: 18px 20px calc(30px + env(safe-area-inset-bottom)); }
  .tab { font-size: 12px; }

  .grid .item { width: calc(33.333% - 7px); }
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .cols-2 > .card { margin-bottom: 0; }

  .detail-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .banner { max-height: none; }

  .hero-stats .hs b { font-size: 22px; }
  .empty { padding: 64px 20px; }
  .sticky-buy { bottom: 14px; }
}

@media (min-width: 1240px) {
  .grid .item { width: calc(25% - 8px); }
  .phone { max-width: 1160px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
/* ================================================================
   库存查询页（v1.1）
   ================================================================ */
.frow { display: flex; gap: 8px; }
.frow .inp { flex: 1 1 0; min-width: 0; height: 34px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  font-size: 12.5px; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  cursor: pointer; user-select: none; transition: background .15s, color .15s, border-color .15s;
}
.chip:active { transform: scale(.97); }
.chip.on { background: var(--c-main); border-color: var(--c-main); color: #fff; font-weight: 600; }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 16px 0 8px; font-size: 13px;
}
.pager .btn-sm[disabled] { opacity: .4; }
.badge.st-normal   { color: var(--c-ok);    background: #E7F5EC; }
.badge.st-low      { color: #B7791F;       background: #FDF6E3; }
.badge.st-out      { color: var(--c-warn); background: #FDEDE6; }
.badge.st-negative { color: #B3261E;       background: #FDE8E6; }
.badge.st-off      { color: #7A8CA0;       background: #F1F3F5; }
.mcard:has(.badge.st-negative) { border-left: 3px solid #B3261E; }

/* ================================================================
 * 电脑端库存查询（≥1024px）
 * 吸顶工具条 + 左侧筛选栏 + 横向统计条 + 全量表格 + 横向滚动
 * ================================================================ */
@media (min-width: 1024px) {
  /* 仅在渲染表格视图时放宽外框，给全量列留出空间 */
  .phone:has(.qdesk) { max-width: 1360px; }
  .phone:has(.qdesk) .view { padding: 16px 24px calc(30px + env(safe-area-inset-bottom)); }
}

.qdesk { margin: -12px -12px 0; }
@media (min-width: 1024px) {
  .qdesk { margin: -16px -24px 0; }
}

.qd-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px; background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(20, 44, 28, .05);
}
@media (min-width: 1024px) {
  .qd-bar { padding: 14px 24px; border-radius: var(--radius) var(--radius) 0 0; }
}
.qd-field { min-width: 0; }
.qd-grow { flex: 1 1 auto; }
.qd-barcode { flex: 0 1 260px; }
@media (max-width: 1023px) {
  .qd-bar { flex-wrap: wrap; }
  .qd-barcode, .qd-grow { flex: 1 1 100%; }
}
.qd-bar .inp { height: 38px; padding-top: 0; padding-bottom: 0; }
/* `.btn` 基础规则是 width:100%，放进 flex 行必须改回 auto，
   否则 flex-basis 取 100% 又被 flex:0 0 禁止收缩，会吃掉整行把搜索框挤成 10px */
.qd-clear { flex: 0 0 auto; width: auto; padding: 0 16px; height: 38px; line-height: 36px; }

/* 手动刷新库存：桌面排列在吸顶搜索栏尾部，与「重置」同高；
   窄屏则在「库存概览」标题右侧（.sm）。主色描边 = 会真的重新取数，
   转动的是图标而不是整颗按钮，避免刷新时看不清自己在点什么。
   pointer-events:none 在 .is-busy 上同时防重复点击。 */
.qd-refresh {
  flex: 0 0 auto; width: auto; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--c-main); border-radius: var(--radius-sm);
  background: #fff; color: var(--c-main);
  font-size: 13.5px; font-weight: 600; line-height: 1; cursor: pointer;
  transition: background .15s var(--ease), opacity .15s var(--ease);
}
.qd-refresh:hover { background: var(--c-main-l); }
.qd-refresh:active { opacity: .85; }
.qd-refresh-ic { width: 15px; height: 15px; flex: 0 0 auto; display: block; }
.qd-refresh.is-busy { opacity: .6; cursor: default; pointer-events: none; }
.qd-refresh.is-busy .qd-refresh-ic { animation: spin .8s linear infinite; }

/* .section-h 是 flex 行，靠 margin-left:auto 把按钮推到最右 */
.qd-refresh.sm { margin-left: auto; height: 28px; padding: 0 10px; font-size: 12.5px; gap: 4px; }
.qd-refresh.sm .qd-refresh-ic { width: 13px; height: 13px; }

.qd-main { display: flex; align-items: flex-start; gap: 16px; padding: 0 12px; }
@media (min-width: 1024px) { .qd-main { padding: 16px 24px 0; } }

.qd-side {
  flex: 0 0 232px; width: 232px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
@media (min-width: 1024px) {
  /* 侧栏比手机端窄一点，把省下的 16px 让给表格 */
  .qd-side { flex: 0 0 216px; width: 216px; position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; }
}
.qd-side-h {
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: .5px; margin: 14px 0 8px;
}
.qd-side-h:first-child { margin-top: 0; }
/* 固定高度的控件必须清零纵向 padding：`.inp` 基础规则是 padding:11px，
   34px 高减去 22px padding+2px 边框后内容区只剩 10px，
   而 13px 字 × line-height:1.6 = 20.8px，超出部分会被 select/button 裁掉底部。 */
.qd-side .inp { height: 34px; padding-top: 0; padding-bottom: 0; font-size: 13px; width: 100%; }
.qd-side-clear { width: 100%; margin-top: 18px; height: 34px; padding-top: 0; padding-bottom: 0; line-height: 32px; font-size: 13px; }

/* 供应商：按拼音首字母分组的滚动列表 + 右侧 A-Z 索引条 */
.qd-si {
  display: block; padding: 7px 8px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.35; color: var(--text-2);
  cursor: pointer; user-select: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qd-si:hover { background: var(--bg); }
.qd-si.on { background: var(--c-main-l); color: var(--c-main); font-weight: 600; }
.qd-si-all { margin-bottom: 6px; background: var(--bg); }

.qd-swrap { display: flex; align-items: stretch; gap: 5px; }
.qd-slist {
  flex: 1 1 auto; min-width: 0;
  height: var(--sup-h);
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  position: relative;
}
.qd-sg {
  position: sticky; top: 0; z-index: 1;
  padding: 5px 8px 3px; background: var(--card);
  font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--muted);
}
.qd-sidx {
  flex: 0 0 auto; width: 21px; height: var(--sup-h);
  display: flex; flex-direction: column;
  padding: 4px 0; background: var(--bg); border-radius: var(--radius-sm);
  overflow: hidden;
}
/* 每个字母 flex:1 由容器均分高度 —— 写死 padding/行高会在 26 档时溢出，
   把底部的 Z 挤到 overflow:hidden 外面（点不到也看不见）。 */
.qd-ix {
  flex: 1 1 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; font-weight: 700;
  color: var(--text-2); cursor: pointer;
  border-radius: 5px;
}
.qd-ix.off { opacity: .3; cursor: default; }
.qd-ix:not(.off):hover, .qd-ix:not(.off):active { background: var(--c-main); color: #fff; }

.qd-chk {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 6px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-2); cursor: pointer;
  user-select: none;
}
.qd-chk:hover { background: var(--bg); }
.qd-chk.on { color: var(--c-main); font-weight: 600; }
.qd-box {
  flex: 0 0 15px; width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid #C6D0D9; background: #fff;
  display: inline-block; position: relative; transition: .15s var(--ease);
}
.qd-chk.on .qd-box { background: var(--c-main); border-color: var(--c-main); }
.qd-chk.on .qd-box::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.qd-chk-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qd-body { flex: 1 1 auto; min-width: 0; }

.qd-stats {
  display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 14px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.qd-stat {
  flex: 1 1 0; min-width: 104px; padding: 12px 16px;
  border-right: 1px solid var(--line);
}
.qd-stat:last-child { border-right: 0; }
.qd-stat-v {
  font-size: 19px; font-weight: 700; color: var(--text);
  line-height: 1.3; white-space: nowrap;
}
.qd-stat-l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.qd-stat.is-out .qd-stat-v  { color: var(--c-warn); }
.qd-stat.is-low .qd-stat-v  { color: #B7791F; }
.qd-stat.is-neg .qd-stat-v  { color: #C0392B; }
.qd-stat.is-time { flex: 2 1 0; }
.qd-stat.is-time .qd-stat-v { font-size: 14px; font-weight: 600; }

.qd-count { font-size: 12.5px; color: var(--muted); margin: 0 2px 9px; }
@media (max-width: 1023px) { .qd-count { margin: 2px 2px 9px; } }

.qd-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.qd-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.qd-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F4F8F4; color: var(--text-2);
  font-size: 12px; font-weight: 700; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.qd-table tbody td {
  padding: 9px 12px; border-bottom: 1px solid #F1F4F2;
  color: var(--text-2); vertical-align: middle;
}
.qd-table tbody tr:last-child td { border-bottom: 0; }
.qd-table tbody tr.click { cursor: pointer; }
.qd-table tbody tr.click:hover td { background: #F7FBF7; }
.qd-table tbody tr.click:focus-visible { outline: 2px solid var(--c-main); outline-offset: -2px; }

/* 列宽：前 7 列（编码→状态）必须塞进 1280 视口的内宽，
   否则「库存」仍要横向滑动才能看到 —— 收紧到合计约 852px。 */
.qd-table .c-sku    { min-width: 118px; }
.qd-table .c-name   { min-width: 176px; max-width: 260px; white-space: normal; }
.qd-table .c-spec   { min-width: 134px; max-width: 220px; white-space: normal; }
.qd-table .c-cat    { min-width: 80px; }
.qd-table .c-sup    { min-width: 100px; max-width: 160px; white-space: normal; }
.qd-table .c-bc     { min-width: 130px; }
.qd-table .c-price  { min-width: 92px; text-align: right; }
.qd-table .c-stock  { min-width: 88px; text-align: right; }
.qd-table .c-state  { min-width: 78px; }

.qd-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--text-2);
}
.qd-table .num { font-size: 14px; color: var(--text); }
.qd-table .num.neg { color: #C0392B; }
.qd-table .unit { font-size: 11.5px; color: var(--muted); margin-left: 3px; }
.qd-table .qname { color: var(--text); font-weight: 600; }
.qd-table .price { color: var(--c-price); font-weight: 700; }
.qd-table .muted { color: var(--muted); }

/* 电脑端详情：双列 */
.qd-detail { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.qd-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.qd-col .card { margin-bottom: 0; }
.qd-back { margin-top: 16px; }
@media (max-width: 1023px) { .qd-detail { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================
 * 成本价
 * ---------------------------------------------------------------
 * 可见性由后端裁剪决定：非白名单账号的响应里没有 costPrice，
 * 前端不会生成这些节点，因此这里只有样式、没有开关。
 * ================================================================ */
.qcost { color: var(--text); }
.qcost b { font-weight: 600; }
.qcost-v { color: var(--c-price); font-weight: 700; }
.qd-table .c-cost { min-width: 92px; text-align: right; }

/* ================================================================
 * 查询页功能条（4 个入口，当前只做入口不含功能）
 * ================================================================ */
/* 功能入口已移到查询页最上方（原在最下方）：上小下大，与下方内容留出节奏 */
.qfeat-wrap { margin: 4px 0 16px; }
/* 紧随功能条的 .qdesk 保留左右出血负边距，但不再向上吃掉功能条 */
.qfeat-wrap + .qdesk { margin-top: 0; }
.qfeat {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.qfeat-i {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 13px 6px 11px; cursor: pointer;
  background: var(--card); color: var(--text-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease), border-color .12s var(--ease);
}
.qfeat-i:active { transform: scale(.98); }
.qfeat-i:focus-visible { outline: 2px solid var(--c-main); outline-offset: 2px; }
.qfeat-ic {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: #F1F4F7; color: var(--text-2);
}
.qfeat-ic svg { width: 21px; height: 21px; display: block; }
.qfeat-t {
  font-size: 11.5px; line-height: 1.3; color: var(--text-2);
  /* 「供应商信息查询」6 个字不能压行，固定两行居中，条目高度对齐 */
  min-height: 2.6em; display: flex; align-items: center; justify-content: center;
}
/* 当前所在功能：常亮主色，其余为待开发灰态 */
.qfeat-i.is-on { border-color: var(--c-main); background: var(--c-main-l); }
.qfeat-i.is-on .qfeat-ic { background: var(--c-main); color: #fff; }
.qfeat-i.is-on .qfeat-t { color: var(--c-main); font-weight: 600; }
.qfeat-i[data-soon] .qfeat-ic { opacity: .55; }
/* 电脑端：4 列并排加宽，避免图标挤在中间 */
@media (min-width: 1024px) {
  .qfeat { gap: 12px; }
  .qfeat-i { flex-direction: row; gap: 10px; padding: 12px 16px; }
  .qfeat-ic { width: 34px; height: 34px; }
  .qfeat-ic svg { width: 19px; height: 19px; }
  .qfeat-t { min-height: 0; font-size: 12.5px; }
}