/* ==========================================================================
   v6：购物车 / 确认订单 共用（cart/template/pc/Ciyun/css/ciyun-buy.css）
   左侧商品卡 + 右侧吸顶结算卡；≤900 结算卡变底部固定条。
   ========================================================================== */
.cy-buy {
  --b-ink: #16223a; --b-ink2: #3d4a60; --b-mut: #5f6b80; --b-mut2: #6f7a8e;
  --b-line: #e4e8ef; --b-soft: #eef1f6; --b-bg2: #f7f9fc;
  --b-pri: #2f6bf0; --b-pri-d: #1f57d6; --b-pri-bg: #eef3fe; --b-price: #d0342c;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--b-ink); line-height: 1.5715;
}
.cy-buy, .cy-buy * { box-sizing: border-box; }
.cy-buy__main { min-width: 0; }
/* 旧外壳；el-main 默认 overflow:auto 会让右栏 sticky 失效（相对 el-main 而不是视口），这两页改由文档滚动 */
html body main.el-main { overflow: visible !important; }
.template .main-title, .template .search-box { display: none !important; }
.template > .el-container > .el-container > .el-footer { display: none !important; }

/* 步骤条（与订购页一致） */
.cy-buy .cy-steps {
  display: flex; align-items: center; margin: 0 0 16px; padding: 0 18px; height: 48px;
  background: #fff; border: 1px solid var(--b-line); border-radius: 6px; list-style: none;
  font-size: 13px; color: var(--b-mut2); white-space: nowrap; overflow: hidden;
}
.cy-buy .cy-steps li { display: flex; align-items: center; gap: 8px; flex: none; }
.cy-buy .cy-steps li + li::before { content: ""; flex: none; width: 40px; height: 1px; background: #dfe4ec; margin: 0 12px 0 4px; }
.cy-buy .cy-steps b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--b-soft); color: var(--b-mut); font-size: 12px; font-weight: 600; }
.cy-buy .cy-steps li.on { color: var(--b-ink); font-weight: 600; }
.cy-buy .cy-steps li.on b { background: var(--b-pri); color: #fff; }
.cy-buy .cy-steps li.done { color: var(--b-ink2); }
.cy-buy .cy-steps li.done b { background: var(--b-pri-bg); color: var(--b-pri); }

/* 页头 */
.cy-buy__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.cy-buy__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 22px; font-weight: 600; line-height: 1.3; color: var(--b-ink); }
.cy-buy__count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--b-pri-bg); color: var(--b-pri); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cy-buy__sub { margin: 4px 0 0; font-size: 13px; color: var(--b-mut); }
.cy-buy__warn { margin: 0 0 12px; padding: 9px 12px; border: 1px solid #f6d9a8; background: #fffaf0; border-radius: 4px; font-size: 13px; color: #8a5a12; }

/* 工具条：全选 / 已选 / 删除 / 搜索 */
.cy-buy__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; min-height: 48px; margin: 0 0 12px; padding: 0 16px;
  background: #fff; border: 1px solid var(--b-line); border-radius: 6px; font-size: 13px; color: var(--b-mut);
}
.cy-buy__bar .el-checkbox__label { font-size: 13px !important; color: var(--b-ink2) !important; }
.cy-buy__sel b { color: var(--b-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cy-buy__bar .el-link { font-size: 13px !important; }
.cy-buy__bar .el-link.el-link--danger { color: #c62828 !important; }
.cy-buy__bar .el-link.el-link--danger:hover { color: #a51d1d !important; }
.cy-buy__bar > *, .cy-buy__sel { white-space: nowrap; }
.cy-buy__search { margin-left: auto; flex: 0 1 240px; min-width: 160px; }
@media screen and (min-width: 901px) and (max-width: 1200px) { .cy-buy__search { flex-basis: 100%; order: 9; margin: 0 0 10px; } .cy-buy__bar { padding-top: 10px; } }
.cy-buy__search .el-input__inner { height: 32px !important; line-height: 32px !important; font-size: 13px !important; }

/* 商品卡 */
.cy-buy__list { min-height: 120px; }
.cy-buy__list .el-checkbox-group { display: grid; gap: 12px; font-size: inherit; line-height: inherit; }
.cy-buy--settle .cy-buy__list { display: grid; gap: 12px; }
.cy-item {
  background: #fff; border: 1px solid var(--b-line); border-radius: 6px; overflow: hidden;
  transition: border-color .16s;
}
.cy-item.is-on { border-color: #b9cbf6; }
.cy-item.is-off { opacity: .82; }
.cy-item__hd {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px;
  border-bottom: 1px solid var(--b-soft); background: var(--b-bg2);
}
.cy-item__hd .el-checkbox { display: flex; align-items: center; margin: 0; min-width: 0; flex: 0 1 auto; }
.cy-item__hd .el-checkbox__label { display: block; padding-left: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cy-item__hd .el-checkbox__label .cy-item__name { display: block; }
.cy-item__name { margin: 0; line-height: 1.4; font-size: 14.5px; font-weight: 600; color: var(--b-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cy-item__hd .el-checkbox__input.is-checked + .el-checkbox__label .cy-item__name { color: var(--b-ink); }
.cy-item__cycle { flex: none; height: 20px; line-height: 18px; padding: 0 6px; border: 1px solid var(--b-line); border-radius: 3px; background: #fff; font-size: 12px; color: var(--b-mut); }
.cy-item__acts { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.cy-item__edit { padding: 4px 8px; font-size: 13px; color: var(--b-pri); cursor: pointer; border-radius: 4px; }
.cy-item__edit:hover { background: var(--b-pri-bg); color: var(--b-pri-d); }
.cy-item__del {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 4px; background: none;
  color: var(--b-mut2); cursor: pointer; transition: color .16s, background-color .16s;
}
.cy-item__del:hover { color: var(--b-price); background: #fdf0ef; }
.cy-item__del svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.cy-item__bd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px 16px 16px; }
.cy-item__bd--off { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cy-item__bd--off .no-goods-tips { font-size: 13px; color: var(--b-mut); }
.cy-item__spec { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 24px; margin: 0; align-content: start; }
.cy-item__spec > div { display: flex; gap: 10px; min-width: 0; font-size: 13px; line-height: 1.6; }
.cy-item__spec dt { flex: none; width: 64px; color: var(--b-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cy-item__spec dd { margin: 0; min-width: 0; color: var(--b-ink); overflow-wrap: anywhere; }
.cy-item__spec dd em { margin-left: 6px; font-style: normal; font-size: 12px; color: var(--b-mut2); font-variant-numeric: tabular-nums; }

.cy-item__money {
  display: grid; grid-template-columns: minmax(0, 1fr) 150px 180px; gap: 16px; align-items: start;
  padding-top: 12px; border-top: 1px dashed var(--b-soft);
}
.cy-item__cell { min-width: 0; }
.cy-item__lab { display: block; margin-bottom: 6px; font-size: 12px; color: var(--b-mut2); }
.cy-item__unit { font-size: 13px; color: var(--b-ink); font-variant-numeric: tabular-nums; line-height: 1.6; }
.cy-item__unit .default-color { color: var(--b-mut); }
.cy-item__cell .el-input-number--small { width: 120px; line-height: 30px; }
.cy-item__cell .el-input-number--small .el-input__inner { height: 32px !important; line-height: 32px !important; font-size: 13px !important; }
.cy-item__cell .qty-num, .cy-item__cell .qty-tips { margin: 6px 0 0; font-size: 12px; color: var(--b-mut2); }
.cy-item__cell .qty-num.red-text, .cy-item__cell .qty-tips { color: var(--b-price); }
.cy-item__cell--total { text-align: right; }
.cy-item__cell--total .cy-item__lab { text-align: right; }
.cy-item__total { display: inline-flex; align-items: center; gap: 4px; }
.cy-item__total b { font-size: 18px; font-weight: 600; color: var(--b-price); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cy-item__total .total-icon { color: var(--b-mut2); cursor: pointer; font-size: 14px; }
.cy-item .original-price { margin: 2px 0 0; font-size: 12px; color: var(--b-mut2); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.cy-item .discount-box { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 8px; }
.cy-item .discount-codeNumber { display: inline-block; margin-top: 6px; padding: 0 6px; border: 1px dashed #f1c48f; border-radius: 3px; font-size: 12px; color: #9a4a05; }
.cy-buy .discount-text, .cy-buy .event-text, .cy-buy [class*="discount"] .el-tag {
  font-size: 12px !important; line-height: 18px !important; height: 20px; padding: 0 6px !important;
  color: #9a4a05 !important; border: 1px solid #f1c48f !important; background: #fff8ef !important; border-radius: 3px !important; cursor: pointer;
}

/* 空状态 */
.cy-buy__empty {
  display: grid; justify-items: center; gap: 10px; padding: 56px 16px 64px; background: #fff;
  border: 1px solid var(--b-line); border-radius: 6px; text-align: center;
}
.cy-buy__empty svg { width: 56px; height: 56px; fill: none; stroke: #c3ccda; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cy-buy__empty p { margin: 0 0 4px; font-size: 14px; color: var(--b-mut); }
.cy-buy__empty .cy-btn { height: 36px; padding: 0 18px; display: inline-flex; align-items: center; border-radius: 4px; font-size: 14px; }

/* 右侧结算卡 */
.cy-buy__aside { position: sticky; top: calc(var(--cy-top, 52px) + 20px); min-width: 0; }
.cy-pay { background: #fff; border: 1px solid var(--b-line); border-radius: 6px; padding: 18px 20px 20px; }
.cy-pay__t { line-height: 1.4; margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--b-ink); }
.cy-pay__rows { margin: 0; }
.cy-pay__rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.cy-pay__rows dt { color: var(--b-mut); }
.cy-pay__rows dd { margin: 0; color: var(--b-ink); font-variant-numeric: tabular-nums; }
.cy-pay__rows dd.minus { color: #1f8a4c; }
.cy-pay__total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--b-soft); }
.cy-pay__total span { font-size: 13px; color: var(--b-mut); }
.cy-pay__total b { font-size: 28px; font-weight: 600; color: var(--b-price); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.cy-pay__total b small { font-size: 16px; font-weight: 500; margin-right: 1px; }
.cy-pay .cy-pay__agree.el-checkbox { display: flex; align-items: flex-start; margin: 14px 0 0; white-space: normal; cursor: pointer; }
.cy-pay .cy-pay__agree .el-checkbox__input { margin-top: 2px; }
.cy-pay .cy-pay__agree .el-checkbox__label { padding-left: 8px; font-size: 12.5px !important; line-height: 1.6; color: var(--b-mut) !important; }
.cy-pay .cy-pay__agree a { color: var(--b-pri); cursor: pointer; }
.cy-pay .cy-pay__go.el-button {
  display: block; width: 100%; height: 42px; margin: 14px 0 0; padding: 0; border-radius: 4px;
  background: var(--b-pri); border-color: var(--b-pri); font-size: 15px; font-weight: 500;
}
.cy-pay .cy-pay__go.el-button:hover, .cy-pay .cy-pay__go.el-button:focus { background: var(--b-pri-d); border-color: var(--b-pri-d); }
.cy-pay__notes { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--b-soft); list-style: none; display: grid; gap: 4px; }
.cy-pay__notes li { position: relative; padding-left: 12px; font-size: 12px; line-height: 1.6; color: var(--b-mut); }
.cy-pay__notes li::before { content: ""; position: absolute; left: 2px; top: .66em; width: 4px; height: 4px; border-radius: 50%; background: #b3bccb; }

/* ---------- 中屏 ---------- */
@media screen and (max-width: 1100px) {
  .cy-buy { grid-template-columns: minmax(0, 1fr) 280px; }
}

/* ---------- ≤900：结算卡变底部固定条 ---------- */
@media screen and (max-width: 900px) {
  .cy-buy { display: block; padding-bottom: 84px; }
  .cy-buy .cy-steps { height: 44px; padding: 0 14px; font-size: 12.5px; }
  .cy-buy .cy-steps li + li::before { width: 16px; margin: 0 8px 0 2px; }
  .cy-buy__head { align-items: center; }
  .cy-buy__head .cy-quick-btn { flex: none; }
  .cy-buy__title { font-size: 19px; }
  .cy-buy__sub { display: none; }
  .cy-buy__bar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; }
  .cy-buy__search { order: 9; width: 100%; margin: 0; }
  .cy-item__hd { padding: 0 12px; }
  .cy-item__bd { padding: 12px; }
  .cy-item__spec { grid-template-columns: minmax(0, 1fr); }
  .cy-item__money { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .cy-item__hd { flex-wrap: nowrap; }
  .cy-item__cycle { display: none; }
  .cy-item__money > .cy-item__cell:first-child { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; }
  .cy-item__money > .cy-item__cell:first-child .cy-item__lab { margin: 0; }

  .cy-buy__aside { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 700; }
  .cy-pay {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
    border-radius: 0; border-width: 1px 0 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(20, 40, 90, .08);
  }
  .cy-pay__t, .cy-pay__rows, .cy-pay__notes { display: none; }
  .cy-pay__total { grid-column: 1; grid-row: 1; margin: 0; padding: 0; border: 0; justify-content: flex-start; }
  .cy-pay__total b { font-size: 22px; }
  .cy-pay .cy-pay__go.el-button { grid-column: 2; grid-row: 1 / span 2; width: auto; min-width: 112px; padding: 0 20px; margin: 0; }
  .cy-pay__agree { grid-column: 1; grid-row: 2; margin: 0; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .cy-item { transition: none; } }
