/* Phase16 修复：本页 .kco-done/.kco-toast 等类带 display:flex，会覆盖 hidden 属性的
   UA 默认 display:none，导致「提交成功」弹层页面一打开就显示（误以为可跳过地址）。
   全局兜底：凡带 hidden 属性一律隐藏，优先级最高。 */
[hidden] { display: none !important; }

/* KPOP.WANG 确认订单页（Phase14）—— 淘宝式下单：地址卡片 + 商品信息 + 付款详情
   自包含浅色样式，不依赖 sample.css；品牌色 #1677FF / 炭黑 #1D2129 / 边 #E5E6EB */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #F0F2F6; color: #1D2129;
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.kco-top { background: #fff; border-bottom: 1px solid #E5E6EB; position: sticky; top: 0; z-index: 20; }
.kco-top__in {
  max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 52px;
  display: flex; align-items: center; gap: 14px;
}
.kco-back { color: #86909C; font-size: 13px; }
.kco-back:hover { color: #1677FF; }
.kco-title { font-size: 17px; }
.kco-brand { margin-left: auto; font-size: 12px; color: #86909C; }

/* ---------- 布局 ---------- */
.kco-wrap { max-width: 1120px; margin: 20px auto 60px; padding: 0 20px; }
.kco-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.kco-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kco-side { position: sticky; top: 68px; }

.kco-card { background: #fff; border-radius: 12px; padding: 18px 20px; }
.kco-card__h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.kco-card__h b { font-size: 15px; }
.kco-card__tip { font-size: 12px; color: #86909C; }

/* ---------- 地址卡片 ---------- */
.kco-addrs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kco-addr {
  position: relative; border: 1.5px solid #E5E6EB; border-radius: 10px;
  padding: 10px 12px 12px; cursor: pointer; background: #fff; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.kco-addr:hover { border-color: #94BFFF; }
.kco-addr.is-on { border-color: #1677FF; box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
.kco-addr__top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.kco-addr__name { font-weight: 600; }
.kco-addr__mobile { color: #86909C; font-size: 12px; }
.kco-addr__tag {
  font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 4px;
  background: #E8F3FF; color: #1677FF;
}
.kco-addr__def {
  font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 4px;
  background: #FFF1E0; color: #D46B08;
}
.kco-addr__full { font-size: 12px; color: #4E5969; line-height: 1.5; min-height: 36px; }
.kco-addr__ops { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; }
.kco-addr__ops button {
  border: 0; background: none; padding: 0; color: #86909C; cursor: pointer; font-size: 12px;
}
.kco-addr__ops button:hover { color: #1677FF; }
.kco-addr__ops .kco-op-def { color: #D46B08; }
.kco-addr--add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: #86909C; border-style: dashed; min-height: 96px;
}
.kco-addr--add b { font-size: 20px; color: #C9CDD4; font-weight: 400; }
.kco-addr--add:hover { color: #1677FF; border-color: #1677FF; }
.kco-addr--add:hover b { color: #1677FF; }

/* ---------- 手填地址表单 ---------- */
.kco-addrform { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.kco-addrform__h { font-size: 13px; color: #86909C; }
.kco-frow { display: flex; gap: 10px; }
.kco-frow--3 input { flex: 1; min-width: 0; }
.kco-addrform input, .kco-addrform textarea {
  flex: 1; min-width: 0; border: 1px solid #E5E6EB; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; color: #1D2129; background: #fff; font-family: inherit;
}
.kco-addrform input:focus { outline: none; border-color: #1677FF; box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
.kco-saveto { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4E5969; cursor: pointer; }
.kco-saveto input { width: auto; flex: 0 0 auto; }
.kco-err { color: #F53F3F; font-size: 13px; }
.kco-addrform__btns { display: flex; gap: 10px; }
.kco-btn--mini { height: 32px; line-height: 30px; padding: 0 16px; font-size: 13px; border-radius: 7px; }
.kco-btn--solid { background: #1677FF; border-color: #1677FF; color: #fff; }

/* ---------- 商品信息 ---------- */
.kco-item { display: flex; gap: 14px; align-items: flex-start; }
.kco-item__img {
  flex: 0 0 96px; width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  background: #F7F8FA; display: flex; align-items: center; justify-content: center;
}
.kco-item__img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.kco-item__main { flex: 1; min-width: 0; }
.kco-item__name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.kco-item__sub { font-size: 12px; color: #86909C; margin-bottom: 8px; }
.kco-item__attrs { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #4E5969; }
.kco-item__attrs em { font-style: normal; color: #86909C; }
.kco-item__patterns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kco-pat {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  border: 1px solid #E5E6EB; border-radius: 6px; padding: 3px 8px 3px 4px; color: #4E5969;
}
.kco-pat img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.kco-pat--none { border-style: dashed; color: #86909C; }
.kco-item__right { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.kco-item__price { font-size: 14px; }
.kco-item__price b { font-size: 16px; color: #1D2129; }

/* 数量步进器 */
.kco-step { display: inline-flex; align-items: center; border: 1px solid #E5E6EB; border-radius: 8px; overflow: hidden; }
.kco-step button {
  width: 30px; height: 30px; border: 0; background: #fff; font-size: 16px; cursor: pointer; color: #4E5969;
}
.kco-step button:hover { background: #F7F8FA; }
.kco-step button:disabled { color: #C9CDD4; cursor: not-allowed; }
.kco-step input {
  width: 44px; height: 30px; border: 0; border-left: 1px solid #E5E6EB; border-right: 1px solid #E5E6EB;
  text-align: center; font-size: 14px; color: #1D2129;
}
.kco-step input:focus { outline: none; }

/* ---------- 备注 ---------- */
.kco-card textarea {
  width: 100%; border: 1px solid #E5E6EB; border-radius: 8px; padding: 9px 12px;
  font-size: 14px; color: #1D2129; resize: vertical; font-family: inherit;
}
.kco-card textarea:focus { outline: none; border-color: #1677FF; box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
.kco-note { margin: 10px 0 0; font-size: 12px; color: #86909C; }

/* ---------- 付款详情 ---------- */
.kco-pay { background: #fff; border-radius: 12px; padding: 18px 20px; }
.kco-pay__h { font-weight: 600; margin-bottom: 14px; }
.kco-pay__h span { font-weight: 400; color: #86909C; font-size: 12px; }
.kco-pay__rows { margin: 0 0 12px; }
.kco-pay__rows > div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.kco-pay__rows dt { color: #86909C; }
.kco-pay__rows dd { margin: 0; color: #1D2129; }
.kco-pay__off dd { color: #F53F3F; }
.kco-pay__tip dd { font-size: 12px; color: #86909C; }
.kco-pay__total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px dashed #E5E6EB; padding-top: 12px; margin-bottom: 14px;
}
.kco-pay__total b { font-size: 22px; color: #FF4D00; font-family: Tahoma, Arial, sans-serif; }
.kco-pay__note { margin: 0 0 12px; font-size: 12px; color: #D46B08; background: #FFF7E6; border-radius: 6px; padding: 6px 10px; }
.kco-pay__note:empty { display: none; }
.kco-submit {
  width: 100%; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(90deg, #FF7A00, #FF4D00); color: #fff; font-size: 16px; font-weight: 600;
}
.kco-submit:hover { filter: brightness(1.05); }
.kco-submit:disabled { filter: grayscale(.6); cursor: not-allowed; }
.kco-pay__safe { margin: 10px 0 0; font-size: 12px; color: #86909C; text-align: center; }

/* ---------- 成功浮层 ---------- */
.kco-done {
  position: fixed; inset: 0; z-index: 60; background: rgba(29,33,41,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.kco-done__box {
  background: #fff; border-radius: 14px; padding: 30px 34px; max-width: 420px; width: 100%;
  text-align: center;
}
.kco-done__ic {
  width: 52px; height: 52px; border-radius: 50%; background: #00B42A; color: #fff;
  font-size: 28px; line-height: 52px; margin: 0 auto 12px;
}
.kco-done__box > b { font-size: 17px; }
.kco-done__body { margin: 12px 0 18px; font-size: 13px; color: #4E5969; line-height: 1.9; text-align: left; }
.kco-done__btns { display: flex; gap: 10px; }
.kco-btn {
  flex: 1; text-align: center; height: 40px; line-height: 40px; border-radius: 9px;
  border: 1px solid #E5E6EB; font-size: 14px;
}
.kco-btn--solid { background: #1677FF; border-color: #1677FF; color: #fff; }

/* ---------- toast ---------- */
.kco-toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(29,33,41,.88); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 8px; z-index: 80; max-width: 80vw;
}

/* ---------- 移动端 / H5（≤768px 单栏） ---------- */
@media (max-width: 768px) {
  .kco-wrap { margin: 12px auto 200px; padding: 0 12px; }
  .kco-grid { grid-template-columns: 1fr; }
  .kco-side { position: fixed; left: 0; right: 0; bottom: calc(59px + env(safe-area-inset-bottom, 0px)); top: auto; z-index: 30; }
  .kco-pay {
    border-radius: 14px 14px 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(29,33,41,.10); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  }
  .kco-pay__h { display: none; }
  .kco-pay__rows { flex: 1; min-width: 130px; margin: 0; }
  .kco-pay__rows > div { padding: 1px 0; }
  .kco-pay__tip { display: none; }
  .kco-pay__total { border: 0; padding: 0; margin: 0; flex-direction: column; align-items: flex-end; gap: 0; }
  .kco-pay__total b { font-size: 20px; }
  .kco-pay__note { display: none; }
  .kco-submit { flex: 0 0 46%; width: auto; height: 42px; }
  .kco-pay__safe { display: none; }
  .kco-addrs { grid-template-columns: 1fr 1fr; }
  .kco-item__img { flex-basis: 76px; width: 76px; height: 76px; }
  .kco-item { flex-wrap: wrap; }
  .kco-item__right { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
  .kco-top__in { padding: 0 12px; }
  .kco-brand { display: none; }
}
@media (max-width: 400px) {
  .kco-addrs { grid-template-columns: 1fr; }
  .kco-frow { flex-wrap: wrap; }
  .kco-frow input { min-width: 100%; }
}

/* ---------- Phase15：地址智能识别 ---------- */
.kco-addrform__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kco-card__h .kco-smartbtn { margin-left: auto; }
.kco-smartbtn {
  border: 1px solid #FF7A00; color: #FF7A00; background: #FFF7ED;
  border-radius: 999px; font-size: 12px; line-height: 1; padding: 6px 12px;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.kco-smartbtn:active { transform: scale(.96); }
.kco-smart { display: flex; flex-direction: column; gap: 8px; }
.kco-smart textarea {
  width: 100%; box-sizing: border-box; border: 1px dashed #C9CDD4; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: #1D2129; resize: vertical;
  font-family: inherit; line-height: 1.5;
}
.kco-smart textarea:focus { outline: none; border-color: #1677FF; border-style: solid; }
.kco-smart__ops { display: flex; gap: 8px; }

/* H5：checkout 用固定下单区，不需要全站 tabbar 的 59px 占位，显式隐藏避免底部多余空白 */
body .kp-mtab-space { display: none; }
