/*
 * 官网购物层样式（页头账号栏、商品页购买区、弹层、购物袋、结算、扫码登录 / 付款、我的订单、轻提示）。
 *
 * 这一层要同时叠在两种完全不同的宿主页面上：静态首页（styles.css，米色纸张风、品牌黄 #FFD91E）
 * 与服务端渲染的商品 / 分类 / IP / 门店页（页面内联一套样式，同样是纸张风）。所以：
 * - 全部选择器都带 jshop / jicao-shop 前缀（body.jshop-locked 是唯一带标签限定的例外，用来锁滚动），
 *   变量只定义在下面那个作用域选择器组里，不碰 :root、不写标签级规则、不用 !important，避免污染任何一边；
 * - 不假设宿主的字号、行高和盒模型：本层的根节点自己声明 font / line-height，控件显式 border-box，
 *   尺寸用 px / rem / clamp 自洽；
 * - 纯 CSS、零外部资源：图标（勾、箭头、下拉三角）全部用边框和渐变画，不引字体、图片或 url()；
 * - 视觉语言沿用首页：墨色 1.5px 描边、纸黄硬阴影、胶囊按钮、品牌黄底一律配墨色字；
 * - 弹层在 640px 及以下改成贴底抽屉（只有上方圆角、贴 env(safe-area-inset-bottom)），以上为居中卡片。
 *
 * DOM 结构与状态类（is-on / is-off / is-wide / :disabled / [hidden]）由 shop/shop.js 生成，样式贴着它写。
 */

.jshop-scope,
#jicao-shop-bar,
#jicao-shop-buy,
.jshop-mask,
.jshop-toast {
  --jshop-brand: #ffd91e;
  --jshop-brand-soft: rgba(255, 217, 30, 0.22);
  --jshop-ink: #171714;
  --jshop-ink-2: #3d3d37;
  --jshop-muted: #6b6b63;
  --jshop-line: rgba(23, 23, 20, 0.16);
  --jshop-line-strong: rgba(23, 23, 20, 0.34);
  --jshop-paper: #fffdf6;
  --jshop-paper-2: #f4f1e8;
  --jshop-paper-3: #e8e2d4;
  --jshop-white: #ffffff;
  --jshop-danger: #c0392b;
  --jshop-danger-soft: rgba(192, 57, 43, 0.09);
  --jshop-ok: #1f8a4c;
  --jshop-ok-soft: rgba(31, 138, 76, 0.1);
  --jshop-radius: 12px;
  --jshop-radius-lg: 18px;
  --jshop-ctl: 44px;
  --jshop-ctl-sm: 36px;
  --jshop-lift: 4px 4px 0 var(--jshop-ink);
  --jshop-lift-sm: 3px 3px 0 var(--jshop-ink);
  --jshop-ring: 0 0 0 3px rgba(255, 217, 30, 0.55);
  --jshop-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --jshop-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 本层自己声明字体与盒模型，不依赖宿主 */
#jicao-shop-bar,
#jicao-shop-buy,
.jshop-mask,
.jshop-toast { font-family: var(--jshop-font); line-height: 1.5; -webkit-font-smoothing: antialiased; }

#jicao-shop-bar *,
#jicao-shop-buy *,
.jshop-mask *,
.jshop-mask *::before,
.jshop-mask *::after,
.jshop-toast { box-sizing: border-box; }

/* 键盘焦点环：所有可点控件统一墨色描边（输入框改用黄色光晕，见表单控件一节） */
.jshop-barbtn:focus-visible,
.jshop-btn:focus-visible,
.jshop-linkbtn:focus-visible,
.jshop-spec:focus-visible,
.jshop-step:focus-visible,
.jshop-dialog__close:focus-visible,
.jshop-line__tick:focus-visible,
.jshop-kv > input:focus-visible { outline: 2px solid var(--jshop-ink); outline-offset: 2px; }

.jshop-step:focus-visible { z-index: 1; }

/* ---------------------------------------------------------------- 页头账号栏
 * #jicao-shop-bar > button.jshop-barbtn（购物袋 / 我的订单 .jshop-barbtn--orders / 退出 / 登录 .jshop-barbtn--primary）
 */

#jicao-shop-bar { display: flex; gap: 8px; align-items: center; }

.jshop-barbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--jshop-line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.6);
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s var(--jshop-ease),
    box-shadow 0.15s var(--jshop-ease);
}

.jshop-barbtn--primary {
  background: var(--jshop-brand);
  border-color: var(--jshop-ink);
  color: var(--jshop-ink);
  font-weight: 700;
}

.jshop-barbtn:active { transform: none; box-shadow: none; }

.jshop-barbtn:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }

/* ---------------------------------------------------------------- 页头头像与账号下拉
 * #jicao-shop-bar > .jshop-account > button.jshop-avatar + .jshop-account__panel
 *
 * 面板只能贴着右边往下展开：两种宿主页面的 body 都写了 overflow-x:hidden，
 * 往左或往右溢出的部分会被直接裁掉，没有滚动条可以救。
 * 头像本身是「首字占位 + 真图盖上去」两层，图挂了 shop.js 会把 img 摘掉，自动退回占位。
 */

.jshop-account { position: relative; display: inline-flex; }

.jshop-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--jshop-ink);
  border-radius: 50%;
  background: var(--jshop-brand);
  color: var(--jshop-ink);
  cursor: pointer;
  transition: box-shadow 0.15s var(--jshop-ease), transform 0.15s var(--jshop-ease);
}

.jshop-avatar:focus-visible { outline: 2px solid var(--jshop-ink); outline-offset: 2px; }

.jshop-avatar[aria-expanded="true"] { box-shadow: var(--jshop-lift-sm); transform: translate(-1px, -1px); }

.jshop-avatar__face {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--jshop-brand);
}

.jshop-avatar__letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  color: var(--jshop-ink);
  user-select: none;
}

/* 刻意不给底色：图还在路上时保持透明，让下面那个首字占位一直露着，不闪一圈空白 */
.jshop-avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jshop-avatar__face--lg {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1.5px solid var(--jshop-ink);
}

.jshop-avatar__face--lg .jshop-avatar__letter { font-size: 19px; }

.jshop-account__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  right: 0;
  width: 268px;
  max-width: calc(100vw - 32px);
  padding: 14px;
  border: 1.5px solid var(--jshop-ink);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-paper);
  box-shadow: var(--jshop-lift);
  text-align: left;
}

.jshop-account__panel[hidden] { display: none; }

.jshop-account__id { display: flex; align-items: center; gap: 10px; }

.jshop-account__who { min-width: 0; }

.jshop-account__name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--jshop-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jshop-account__phone {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--jshop-muted);
  font-variant-numeric: tabular-nums;
}

/* 行式而不是并排小格子：金额位数一多，等宽小格子就会把「￥1234.50」截成「￥123…」 */
.jshop-account__assets {
  margin: 12px 0;
  padding: 2px 10px;
  border: 1px solid var(--jshop-line);
  border-radius: var(--jshop-radius);
  background: var(--jshop-white);
}

.jshop-asset {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--jshop-line);
}

.jshop-asset:first-child,
.jshop-asset[hidden] + .jshop-asset { border-top: 0; }

.jshop-asset[hidden] { display: none; }

.jshop-asset__label { flex: 0 0 auto; font-size: 13px; font-weight: 600; color: var(--jshop-muted); }

.jshop-asset__value {
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--jshop-ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-align: right;
}

.jshop-account__menu {
  display: grid;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--jshop-line);
}

.jshop-account__item {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--jshop-radius);
  background: none;
  color: var(--jshop-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.jshop-account__item:focus-visible { outline: 2px solid var(--jshop-ink); outline-offset: -2px; }

.jshop-account__item:disabled { opacity: 0.55; cursor: default; }

.jshop-account__item--quit { color: var(--jshop-danger); }

/* ---------------------------------------------------------------- 通用按钮
 * .jshop-btn（描边）/ .jshop-btn--primary（品牌黄底墨字）/ .jshop-btn--ghost（浅描边）
 * 既用在 <button> 也用在 <a>（购物袋为空时的「去看商品」）。
 */

.jshop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--jshop-ctl);
  padding: 0 22px;
  border: 1.5px solid var(--jshop-ink);
  border-radius: 999px;
  background: var(--jshop-white);
  color: var(--jshop-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s var(--jshop-ease), box-shadow 0.18s var(--jshop-ease),
    background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.jshop-btn--primary { background: var(--jshop-brand); border-color: var(--jshop-ink); color: var(--jshop-ink); }

.jshop-btn--ghost { border-color: var(--jshop-line-strong); background: transparent; font-weight: 600; }

.jshop-btn:active { transform: translate(0, 0); box-shadow: none; background: var(--jshop-paper-2); }

.jshop-btn--primary:active { background: #f2cc0f; }

.jshop-btn:disabled {
  background: var(--jshop-paper-3);
  border-color: var(--jshop-line-strong);
  color: var(--jshop-muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* 文字按钮：删除 / 新增收货地址 / 不使用优惠券 / 换一张二维码 / 刷新 / 结算页的选券入口 */
.jshop-linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--jshop-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.jshop-linkbtn:disabled { color: var(--jshop-muted); text-decoration-color: transparent; cursor: default; }

/* ---------------------------------------------------------------- 表单控件
 * .jshop-input / .jshop-select；省市区三级联动是 .jshop-form 里的 .jshop-row（三个 select），
 * 手机验证码是弹层正文里的 .jshop-row（input + .jshop-btn--ghost）。
 */

.jshop-input,
.jshop-select {
  display: block;
  width: 100%;
  min-height: var(--jshop-ctl);
  padding: 0 14px;
  border: 1.5px solid var(--jshop-line-strong);
  border-radius: var(--jshop-radius);
  background: var(--jshop-white);
  color: var(--jshop-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jshop-input::placeholder { color: rgba(107, 107, 99, 0.85); }

.jshop-input:focus,
.jshop-select:focus { outline: 0; border-color: var(--jshop-ink); box-shadow: var(--jshop-ring); }

.jshop-input:focus-visible,
.jshop-select:focus-visible { outline: 0; }

/* 出错的那个框描红：shop.js 的 setError() 只给「这条错误确实指向的框」加 is-error，
   网络故障之类的只出文案不描红 */
.jshop-input.is-error,
.jshop-select.is-error {
  border-color: var(--jshop-danger);
  background: var(--jshop-danger-soft);
}

.jshop-input.is-error:focus,
.jshop-select.is-error:focus {
  border-color: var(--jshop-danger);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.22);
}

.jshop-select.is-error {
  background-image: linear-gradient(45deg, transparent 50%, var(--jshop-danger) 50%),
    linear-gradient(135deg, var(--jshop-danger) 50%, transparent 50%);
}

.jshop-input:disabled,
.jshop-select:disabled {
  background-color: var(--jshop-paper-2);
  color: var(--jshop-muted);
  border-color: var(--jshop-line);
  cursor: not-allowed;
}

/* 下拉三角用两个渐变画出来，不用图片 */
.jshop-select {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--jshop-ink) 50%),
    linear-gradient(135deg, var(--jshop-ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  cursor: pointer;
}

.jshop-select:disabled {
  cursor: not-allowed;
  background-image: linear-gradient(45deg, transparent 50%, var(--jshop-muted) 50%),
    linear-gradient(135deg, var(--jshop-muted) 50%, transparent 50%);
}

.jshop-select--wide { width: 100%; }

.jshop-row { display: flex; gap: 8px; align-items: center; }

.jshop-row > .jshop-select,
.jshop-row > .jshop-input { flex: 1 1 0; min-width: 0; }

.jshop-row > .jshop-btn { flex: 0 0 auto; padding-left: 16px; padding-right: 16px; font-size: 14px; }

/* 新增地址表单：嵌在地址区里的一张虚线卡片 */
.jshop-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1.5px dashed var(--jshop-line-strong);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-paper);
}

.jshop-form > .jshop-btn { width: 100%; margin-top: 2px; }

/* 省市区在 480px 以下换两行：省份占整行，市、区各半 */
@media (max-width: 480px) {
  .jshop-form .jshop-row { flex-wrap: wrap; }

  .jshop-form .jshop-row > .jshop-select { flex: 1 1 calc(50% - 4px); }

  .jshop-form .jshop-row > .jshop-select:first-child { flex-basis: 100%; }
}

/* ---------------------------------------------------------------- 文案与提示
 * .jshop-hint 说明 / .jshop-error 错误（可能带 hidden 属性）/ .jshop-success 成功 / .jshop-subtitle 分区标题
 */

.jshop-hint { margin: 8px 0 0; color: var(--jshop-muted); font-size: 13px; line-height: 1.65; }

.jshop-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(192, 57, 43, 0.28);
  border-radius: 10px;
  background: var(--jshop-danger-soft);
  color: var(--jshop-danger);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.jshop-error::before {
  content: "!";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--jshop-danger);
  color: var(--jshop-white);
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

/* display 会盖掉 UA 的 [hidden]，这里补回去 */
.jshop-error[hidden],
.jshop-hint[hidden],
.jshop-success[hidden] { display: none; }

.jshop-success {
  position: relative;
  margin: 8px 0 0;
  padding-top: 64px;
  color: var(--jshop-ok);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* 成功图标：绿色圆 + 白色勾，两个伪元素画出来 */
.jshop-success::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  border-radius: 50%;
  background: var(--jshop-ok);
  box-shadow: 0 0 0 6px var(--jshop-ok-soft);
}

.jshop-success::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  width: 18px;
  height: 9px;
  margin-left: -10px;
  border-left: 3px solid var(--jshop-white);
  border-bottom: 3px solid var(--jshop-white);
  transform: rotate(-45deg);
}

.jshop-success ~ .jshop-hint { text-align: center; font-variant-numeric: tabular-nums; }

.jshop-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--jshop-ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* 分区标题前的小黄签，呼应首页 eyebrow */
.jshop-subtitle::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 7px;
  border: 1px solid var(--jshop-ink);
  border-radius: 999px;
  background: var(--jshop-brand);
}

.jshop-section { padding: 18px 0; border-bottom: 1px solid var(--jshop-line); }

.jshop-section:first-child { padding-top: 2px; }

.jshop-section:last-child { border-bottom: 0; padding-bottom: 4px; }

.jshop-section > .jshop-select--wide + .jshop-linkbtn { margin-top: 10px; }

.jshop-section > .jshop-linkbtn::before { content: "+"; font-weight: 800; }

/* ---------------------------------------------------------------- 键值行（优惠 / 金额）
 * div.jshop-kv > span + span.jshop-kv__value
 * div.jshop-kv > span + button.jshop-linkbtn（选券入口）
 * label.jshop-kv > span + input[type=checkbox] + span.jshop-kv__value（购物金抵扣，勾选框没有 class）
 */

.jshop-kv {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 5px 0;
  font-size: 14px;
}

.jshop-kv > span:first-child { color: var(--jshop-ink-2); }

.jshop-kv__value {
  margin-left: auto;
  color: var(--jshop-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.jshop-kv > input {
  order: 3;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--jshop-ink);
  cursor: pointer;
}

.jshop-kv > .jshop-linkbtn {
  margin-left: auto;
  max-width: 70%;
  color: var(--jshop-ink);
  text-decoration: none;
  white-space: normal;
  text-align: right;
}

.jshop-kv > .jshop-linkbtn::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

.jshop-kv > .jshop-linkbtn:disabled { color: var(--jshop-muted); }

/* 购物金那行整行是 label，指针提示可点 */
label.jshop-kv { cursor: pointer; }

/* ---------------------------------------------------------------- 数量步进器
 * button.jshop-step(−) + span.jshop-step__num + button.jshop-step(+)，三段拼成一个胶囊控件
 */

.jshop-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--jshop-ctl-sm);
  height: var(--jshop-ctl-sm);
  padding: 0;
  border: 1.5px solid var(--jshop-ink);
  background: var(--jshop-white);
  color: var(--jshop-ink);
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.jshop-step:first-of-type { border-radius: 999px 0 0 999px; padding-left: 3px; }

.jshop-step:last-of-type { border-radius: 0 999px 999px 0; padding-right: 3px; }

.jshop-step:active:not(:disabled) { background: #f2cc0f; }

.jshop-step:disabled { background: var(--jshop-paper-2); color: rgba(107, 107, 99, 0.6); cursor: not-allowed; }

.jshop-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: var(--jshop-ctl-sm);
  padding: 0 6px;
  border-top: 1.5px solid var(--jshop-ink);
  border-bottom: 1.5px solid var(--jshop-ink);
  background: var(--jshop-white);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 商品页购买区
 * #jicao-shop-buy > .jshop-buy > [.jshop-buy__off] | .jshop-buy__specs + p.jshop-buy__price + .jshop-buy__qty
 *   + .jshop-buy__actions + p.jshop-hint
 */

.jshop-buy {
  margin: 20px 0;
  padding: clamp(16px, 2.4vw, 24px);
  border: 1.5px solid var(--jshop-ink);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-paper);
  box-shadow: var(--jshop-lift);
  color: var(--jshop-ink);
}

.jshop-buy__off {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--jshop-muted);
  font-size: 15px;
  font-weight: 600;
}

.jshop-buy__off::before {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jshop-line-strong);
}

.jshop-buy__label {
  display: inline-block;
  min-width: 4em;
  color: var(--jshop-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.jshop-buy__specs { margin-bottom: 16px; }

.jshop-buy__speclist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding-top: 4px;
}

/* 规格签：默认浅描边；选中黄底墨框 + 右上角墨色对勾；不可选虚线灰签；选中且不可选保留墨框但去黄底 */
.jshop-spec {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: var(--jshop-ctl);
  padding: 8px 14px;
  border: 1.5px solid var(--jshop-line-strong);
  border-radius: var(--jshop-radius);
  background: var(--jshop-white);
  color: var(--jshop-ink);
  font: inherit;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s var(--jshop-ease),
    transform 0.15s var(--jshop-ease);
}

.jshop-spec.is-on {
  border-color: var(--jshop-ink);
  background: var(--jshop-brand);
  box-shadow: 2px 2px 0 var(--jshop-ink);
}

.jshop-spec.is-on::before {
  content: "";
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--jshop-paper);
  border-radius: 50%;
  background: var(--jshop-ink);
}

.jshop-spec.is-on::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -1px;
  width: 7px;
  height: 4px;
  border-left: 1.5px solid var(--jshop-brand);
  border-bottom: 1.5px solid var(--jshop-brand);
  transform: rotate(-45deg);
}

.jshop-spec:disabled {
  border-style: dashed;
  border-color: var(--jshop-line);
  background: var(--jshop-paper-2);
  color: var(--jshop-muted);
  cursor: not-allowed;
}

.jshop-spec.is-on:disabled {
  border-style: dashed;
  border-color: var(--jshop-ink);
  background: var(--jshop-paper-2);
  box-shadow: none;
}

.jshop-spec.is-on:disabled::before { background: var(--jshop-muted); }

.jshop-spec__name { font-size: 14px; font-weight: 600; }

.jshop-spec__price { font-size: 13px; color: var(--jshop-ink-2); font-variant-numeric: tabular-nums; }

.jshop-spec.is-on .jshop-spec__price { color: var(--jshop-ink); }

.jshop-spec:disabled .jshop-spec__price { color: var(--jshop-muted); text-decoration: line-through; }

.jshop-spec__off { font-size: 12px; font-weight: 600; color: var(--jshop-danger); }

.jshop-buy__price {
  margin: 0 0 14px;
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.jshop-buy__qty { display: flex; align-items: center; gap: 0; margin-bottom: 18px; }

.jshop-buy__qty > .jshop-buy__label { margin-right: 12px; }

.jshop-buy__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.jshop-buy__actions > .jshop-btn { min-height: 48px; padding: 0 26px; }

.jshop-buy > .jshop-hint { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--jshop-line); }

@media (max-width: 480px) {
  .jshop-buy__actions > .jshop-btn { flex: 1 1 calc(50% - 5px); padding: 0 12px; }
}

@media (max-width: 360px) {
  .jshop-buy__actions > .jshop-btn { flex-basis: 100%; }
}

/* ---------------------------------------------------------------- 弹层骨架
 * .jshop-mask > .jshop-dialog[.is-wide] > .jshop-dialog__head(h2.jshop-dialog__title + button.jshop-dialog__close)
 *   + .jshop-dialog__body + .jshop-dialog__foot
 * 640px 以上：居中卡片；640px 及以下：贴底抽屉（见下方断点）。头、尾固定，只有正文滚动。
 */

body.jshop-locked { overflow: hidden; }

.jshop-mask {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(23, 23, 20, 0.56);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  color: var(--jshop-ink);
  animation: jshop-fade-in 0.18s ease-out both;
}

.jshop-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(86vh, 800px);
  max-height: min(86dvh, 800px);
  overflow: hidden;
  border: 1.5px solid var(--jshop-ink);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-paper);
  box-shadow: 6px 6px 0 var(--jshop-ink), 0 24px 60px rgba(23, 23, 20, 0.28);
  animation: jshop-pop-in 0.22s var(--jshop-ease) both;
}

.jshop-dialog.is-wide { width: min(680px, 100%); }

.jshop-dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 16px 20px;
  border-bottom: 1px solid var(--jshop-line);
  background: var(--jshop-paper);
}

.jshop-dialog__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.jshop-dialog__close {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin-left: auto;
  margin-right: -6px;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--jshop-ink-2);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.jshop-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 加载中 / 空状态：正文只有一条说明时居中放大留白 */
.jshop-dialog__body > .jshop-hint:only-child { margin: 0; padding: 36px 8px; text-align: center; font-size: 14px; }

.jshop-dialog__body > .jshop-error:only-child,
.jshop-dialog__body > .jshop-error:first-child { margin-top: 0; }

/* 扫码登录的验证手机号：控件直接挂在正文里，靠这里拉开间距 */
.jshop-dialog__body > .jshop-input,
.jshop-dialog__body > .jshop-row { margin-top: 10px; }

.jshop-dialog__body > .jshop-btn { width: 100%; margin-top: 16px; }

.jshop-dialog__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 20px;
  border-top: 1px solid var(--jshop-line);
  background: var(--jshop-paper-2);
}

.jshop-dialog__foot:empty { display: none; }

/* 底部合计（应付 ￥xx / 已选 n 项）靠左顶开，按钮组一律靠右 */
/* span.jshop-foot__sum(small.jshop-foot__label + strong.jshop-foot__amount)
   金额未算出时 shop.js 直接 hidden 整块，不靠 :empty */
.jshop-foot__sum {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-right: auto;
  line-height: 1.2;
}

.jshop-foot__sum[hidden] { display: none; }

.jshop-foot__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--jshop-muted);
}

.jshop-foot__amount {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.jshop-dialog__foot > .jshop-btn { min-height: 46px; padding: 0 26px; }

.jshop-dialog__foot > .jshop-linkbtn { color: var(--jshop-ink-2); }

@keyframes jshop-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes jshop-pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes jshop-rise-in {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

/* ---------------------------------------------------------------- 商品行与优惠券行
 * li.jshop-line[.is-off] > input.jshop-line__tick? + img.jshop-thumb? + .jshop-line__info + .jshop-line__qty? + button.jshop-linkbtn?
 *   购物袋：五段齐全；结算「商品」区：只有缩略图 + 信息；图片加载失败时 img 会被移除。
 *   用命名网格区放置，列间距写在元素的 margin 上，缺哪段哪列就收成 0，不留空隙。
 * li.jshop-coupon[.is-off] > input.jshop-line__tick? + .jshop-line__info
 */

.jshop-list { list-style: none; margin: 0; padding: 0; }

.jshop-line {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "tick thumb info qty del";
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--jshop-line);
}

.jshop-line:first-child { padding-top: 2px; }

.jshop-line:last-child { padding-bottom: 2px; border-bottom: 0; }

.jshop-line > .jshop-line__tick { grid-area: tick; margin-right: 12px; }

.jshop-line > .jshop-thumb { grid-area: thumb; margin-right: 14px; }

.jshop-line > .jshop-line__info { grid-area: info; }

.jshop-line > .jshop-line__qty { grid-area: qty; margin-left: 14px; }

.jshop-line > .jshop-linkbtn {
  grid-area: del;
  margin-left: 10px;
  color: var(--jshop-muted);
  font-size: 13px;
  font-weight: 500;
}

.jshop-line.is-off > .jshop-thumb,
.jshop-line.is-off > .jshop-line__info > .jshop-line__name,
.jshop-line.is-off > .jshop-line__info > .jshop-line__spec,
.jshop-line.is-off > .jshop-line__info > .jshop-line__price { opacity: 0.5; }

.jshop-line.is-off > .jshop-thumb { filter: grayscale(1); }

.jshop-line__tick {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--jshop-ink);
  cursor: pointer;
}

.jshop-line__tick:disabled { cursor: not-allowed; opacity: 0.4; }

.jshop-thumb {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--jshop-line);
  border-radius: 10px;
  background: var(--jshop-paper-3);
}

.jshop-line__info { flex: 1 1 auto; min-width: 0; }

.jshop-line__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.jshop-line__spec {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--jshop-muted);
  overflow-wrap: anywhere;
}

.jshop-line__price {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--jshop-ink);
  font-variant-numeric: tabular-nums;
}

.jshop-line__off {
  display: inline-block;
  margin: 6px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--jshop-danger-soft);
  color: var(--jshop-danger);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.jshop-line__qty { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }

/* 优惠券：卡片式，可用的勾选后变黄；不可用整张虚线灰 */
.jshop-coupon {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1.5px solid var(--jshop-line-strong);
  border-radius: var(--jshop-radius);
  background: var(--jshop-white);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.jshop-coupon + .jshop-coupon { margin-top: 10px; }

.jshop-coupon > .jshop-line__tick { margin-top: 2px; }

.jshop-coupon:has(> .jshop-line__tick:checked) {
  border-color: var(--jshop-ink);
  background: var(--jshop-brand-soft);
  box-shadow: 2px 2px 0 var(--jshop-ink);
}

.jshop-coupon.is-off { border-style: dashed; border-color: var(--jshop-line); background: var(--jshop-paper-2); }

.jshop-coupon.is-off > .jshop-line__info > .jshop-line__name,
.jshop-coupon.is-off > .jshop-line__info > .jshop-line__spec { color: var(--jshop-muted); }

.jshop-list + .jshop-subtitle { margin-top: 20px; }

/* ---------------------------------------------------------------- 我的订单
 * li.jshop-order > .jshop-order__head(span.jshop-order__sn + span.jshop-order__state)
 *   + p.jshop-order__goods* + p.jshop-order__meta + [p.jshop-hint + button.jshop-btn--primary]
 */

.jshop-order {
  padding: 14px 16px;
  border: 1.5px solid var(--jshop-line-strong);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-white);
}

.jshop-order + .jshop-order { margin-top: 12px; }

.jshop-order__head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--jshop-line);
}

.jshop-order__sn {
  min-width: 0;
  color: var(--jshop-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* 四组而不是十一种颜色：一眼分出「该我动了 / 在走流程 / 成了 / 结束了」，
   分组表在 shop.js 的 ORDER_STATUS_TONE */
.jshop-order__state {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--jshop-ink);
  color: var(--jshop-paper);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

/* 待付款 / 待核销：要用户动手，用品牌黄配墨字 */
.jshop-order__state--pay {
  background: var(--jshop-brand);
  color: var(--jshop-ink);
}

/* 进行中：保持墨色，不抢眼 */
.jshop-order__state--ing {
  background: var(--jshop-ink);
  color: var(--jshop-paper);
}

/* 交易成功 */
.jshop-order__state--done {
  background: var(--jshop-ok-soft);
  color: var(--jshop-ok);
  box-shadow: inset 0 0 0 1.5px var(--jshop-ok);
}

/* 已取消 / 已退款 / 已关闭：退到灰底，别和在途订单抢注意力 */
.jshop-order__state--off {
  background: var(--jshop-paper-3);
  color: var(--jshop-muted);
}

.jshop-order__goods { margin: 4px 0 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

.jshop-order__meta { margin: 10px 0 0; color: var(--jshop-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.jshop-order > .jshop-hint { margin-top: 10px; color: var(--jshop-danger); }

.jshop-order > .jshop-btn { min-height: 38px; margin-top: 12px; padding: 0 18px; font-size: 14px; }

/* ---------------------------------------------------------------- 二维码
 * 微信登录：iframe.jshop-qr + p.jshop-hint
 * 扫码付款：.jshop-payqr(> svg | p.jshop-error) + p.jshop-hint ×3（说明、订单号、倒计时）
 */

.jshop-qr {
  display: block;
  width: 100%;
  height: 420px;
  border: 1.5px solid var(--jshop-ink);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-white);
  box-shadow: var(--jshop-lift);
}

.jshop-qr + .jshop-hint { margin-top: 16px; text-align: center; font-size: 14px; color: var(--jshop-ink-2); }

.jshop-payqr {
  width: min(280px, 100%);
  margin: 4px auto 0;
  padding: 16px;
  border: 1.5px solid var(--jshop-ink);
  border-radius: var(--jshop-radius-lg);
  background: var(--jshop-white);
  box-shadow: var(--jshop-lift);
}

.jshop-payqr svg { display: block; width: 100%; height: auto; }

.jshop-payqr > .jshop-error { margin: 0; }

.jshop-payqr ~ .jshop-hint { text-align: center; font-variant-numeric: tabular-nums; }

.jshop-payqr + .jshop-hint { margin-top: 18px; font-size: 14px; font-weight: 600; color: var(--jshop-ink); }

.jshop-payqr ~ .jshop-hint:last-child {
  display: inline-block;
  width: 100%;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--jshop-paper-2);
  color: var(--jshop-ink-2);
}

.jshop-payqr ~ .jshop-hint:last-child:empty { display: none; }

/* ---------------------------------------------------------------- 轻提示 */

.jshop-toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  z-index: 9100;
  max-width: min(92vw, 480px);
  padding: 11px 20px;
  border: 1.5px solid var(--jshop-ink);
  border-radius: 999px;
  background: rgba(23, 23, 20, 0.94);
  color: var(--jshop-paper);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  box-shadow: 3px 3px 0 var(--jshop-brand);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.22s var(--jshop-ease);
}

.jshop-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- 悬停态（只在真正有指针的设备上生效，触屏不残留） */

@media (hover: hover) {
  .jshop-barbtn:hover:not(:disabled) { border-color: var(--jshop-ink); background: var(--jshop-white); }

  .jshop-barbtn--primary:hover:not(:disabled) {
    background: var(--jshop-brand);
    box-shadow: 2px 2px 0 var(--jshop-ink);
    transform: translate(-1px, -1px);
  }

  .jshop-btn:hover:not(:disabled) { box-shadow: var(--jshop-lift-sm); transform: translate(-1px, -1px); }

  .jshop-btn--ghost:hover:not(:disabled) { border-color: var(--jshop-ink); background: var(--jshop-white); }

  .jshop-linkbtn:hover:not(:disabled) { text-decoration-thickness: 2px; }

  .jshop-step:hover:not(:disabled) { background: var(--jshop-brand); }

  .jshop-spec:hover:not(:disabled) { border-color: var(--jshop-ink); }

  .jshop-dialog__close:hover { background: var(--jshop-paper-3); border-color: var(--jshop-ink); }

  .jshop-line > .jshop-linkbtn:hover:not(:disabled) { color: var(--jshop-danger); }

  .jshop-avatar:hover { box-shadow: var(--jshop-lift-sm); transform: translate(-1px, -1px); }

  .jshop-account__item:hover:not(:disabled) { background: var(--jshop-paper-2); }

  .jshop-account__item--quit:hover:not(:disabled) { background: var(--jshop-danger-soft); }
}

/* ---------------------------------------------------------------- 断点：贴底抽屉（≤ 640px，覆盖 320 / 390）
 * 遮罩改成底对齐、不留内边距；弹层满宽、只留上方圆角、从下往上滑入；
 * 尾部按钮撑满剩余宽度；页脚为空时把安全区补到弹层自身，正文最后一行不会贴着 Home 条。
 */

@media (max-width: 640px) {
  .jshop-mask { align-items: flex-end; padding: 0; }

  .jshop-dialog,
  .jshop-dialog.is-wide {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-width: 1.5px 0 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(23, 23, 20, 0.3);
    animation: jshop-rise-in 0.26s var(--jshop-ease) both;
  }

  /* 抽屉顶部的拖拽提示条（纯装饰） */
  .jshop-dialog::before {
    content: "";
    flex: 0 0 auto;
    width: 40px;
    height: 4px;
    margin: 10px auto -4px;
    border-radius: 999px;
    background: var(--jshop-line-strong);
  }

  .jshop-dialog:has(> .jshop-dialog__foot:empty) { padding-bottom: env(safe-area-inset-bottom, 0px); }

  .jshop-dialog__head { padding: 12px 16px; }

  .jshop-dialog__body { padding: 16px; }

  .jshop-dialog__foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }

  .jshop-dialog__foot > .jshop-btn { flex: 1 1 auto; }

  .jshop-foot__sum { font-size: 16px; }

  /* 商品行折成两行：勾选 + 图 + 信息在上，数量与删除靠右在下 */
  .jshop-line {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "tick thumb info info"
      ". . qty del";
  }

  .jshop-line > .jshop-line__qty { justify-self: end; margin-top: 10px; margin-left: 0; }

  .jshop-line > .jshop-linkbtn { margin-top: 10px; }

  .jshop-thumb { width: 56px; height: 56px; }

  .jshop-qr { height: 400px; }

  .jshop-toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
}

@media (max-width: 360px) {
  .jshop-dialog__foot { gap: 8px; }

  .jshop-dialog__foot > .jshop-btn { padding: 0 16px; }

  .jshop-qr { height: 380px; }
}

/* ---------------------------------------------------------------- 动效偏好 */

@media (prefers-reduced-motion: reduce) {
  .jshop-mask,
  .jshop-dialog,
  .jshop-toast,
  .jshop-mask *,
  #jicao-shop-bar *,
  #jicao-shop-buy * { animation: none; transition: none; }

  .jshop-barbtn:hover,
  .jshop-btn:hover,
  .jshop-avatar:hover,
  .jshop-avatar[aria-expanded="true"] { transform: none; }
}

/* ---------------------------------------------------------------- 首页页头里的账号栏
 * 首页 (styles.css) 的 .site-header 是固定高度的 flex 行，窄屏还会把导航收进抽屉。
 * 这里只调本层自己的元素，不动宿主页面的任何规则。
 */

.site-header #jicao-shop-bar { margin-left: clamp(10px, 1.5vw, 22px); }

@media (max-width: 920px) {
  .site-header #jicao-shop-bar { margin-left: auto; margin-right: 12px; gap: 6px; }

  .site-header .jshop-barbtn { min-height: 32px; padding: 0 11px; font-size: 13px; }

  .site-header .jshop-avatar { width: 32px; height: 32px; }
}

@media (max-width: 640px) {
  /* 页头挤不下第三个按钮；「我的订单」改从导航抽屉里的 data-jicao-shop="orders" 进 */
  .site-header .jshop-barbtn--orders { display: none; }
}
