/* ==========================================================================
   MY STORE（Commerce Domain）样式 —— P9
   --------------------------------------------------------------------------
   用于三处：Public 商城（public/base.html）、客户购物车/订单（client/base.html）、
   商城后台（staff/base.html）。三端各有一套主题变量，因此本文件**不依赖**任何
   一端的变量，只使用自己的 `--mall-*`，避免在 ds.css / public.css 之间来回污染。
   视觉延续 P8-B「幕一国際物流」蓝白调性（navy / royal / blue），不重设计品牌。
   移动端纪律：所有网格用 minmax + 1 列回落，任何卡片禁止撑出横向滚动条。
   ========================================================================== */

.mall {
  --mall-navy: #0a1f44;
  --mall-royal: #0e3a8a;
  --mall-blue: #1e55c8;
  --mall-sky: #4da3ff;
  --mall-ink: #16233d;
  --mall-ink-soft: #3d4d6b;
  --mall-muted: #64748f;
  --mall-line: #e3eaf6;
  --mall-tint: #f0f5fd;
  --mall-tint-2: #e8f0fc;
  --mall-ok: #0b7a4b;
  --mall-ok-bg: #e6f7ee;
  --mall-warn: #9a5b00;
  --mall-warn-bg: #fff4e0;
  --mall-err: #b3261e;
  --mall-err-bg: #fdecea;
  --mall-radius: 14px;
  --mall-radius-sm: 10px;
  --mall-shadow: 0 10px 28px rgba(10, 31, 68, 0.08);
}

.mall *,
.mall *::before,
.mall *::after { box-sizing: border-box; }

.mall a { color: var(--mall-blue); text-decoration: none; }
.mall a:hover { color: var(--mall-royal); text-decoration: underline; }

/* --------------------------------------------------------------- 布局容器 */
.mall-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.mall-section { padding: 40px 0; }
.mall-section + .mall-section { padding-top: 0; }
.mall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}
.mall-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mall-blue);
  margin: 0 0 6px;
}
.mall-title { font-size: clamp(20px, 3.2vw, 28px); line-height: 1.3; margin: 0; color: var(--mall-navy); }
.mall-sub { margin: 6px 0 0; color: var(--mall-muted); font-size: 14px; }
.mall-crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--mall-muted); margin: 0 0 16px;
}
.mall-crumbs a { color: var(--mall-muted); }
.mall-crumbs span[aria-hidden] { opacity: .55; }

/* ------------------------------------------------------------------- Hero */
.mall-hero {
  background: linear-gradient(150deg, var(--mall-navy) 0%, var(--mall-royal) 58%, #1652b8 100%);
  color: #fff;
  padding: 56px 0 48px;
}
.mall-hero .mall-wrap { display: grid; gap: 24px; }
.mall-hero-title {
  font-size: clamp(26px, 4.6vw, 44px);
  line-height: 1.22;
  margin: 0 0 12px;
  color: #fff;
  letter-spacing: -0.01em;
}
.mall-hero-lead {
  margin: 0 0 22px;
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.75;
  color: rgba(255, 255, 255, .86);
  max-width: 640px;
}
.mall-hero-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .62);
}
.mall-hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ------------------------------------------------------------------ 按钮 */
.mall-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .06s ease;
  min-height: 42px;
}
.mall-btn:active { transform: translateY(1px); }
.mall-btn-primary {
  background: var(--mall-blue); color: #fff;
  box-shadow: 0 4px 14px rgba(30, 85, 200, .28);
}
.mall-btn-primary:hover { background: var(--mall-royal); color: #fff; text-decoration: none; }
.mall-btn-ghost {
  background: #fff; color: var(--mall-navy); border-color: var(--mall-line);
}
.mall-btn-ghost:hover { background: var(--mall-tint); border-color: var(--mall-sky); color: var(--mall-navy); text-decoration: none; }
.mall-btn-light { background: #fff; color: var(--mall-navy); }
.mall-btn-light:hover { background: var(--mall-tint-2); color: var(--mall-navy); text-decoration: none; }
.mall-btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.mall-btn-outline-light:hover { background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
.mall-btn-sm { padding: 7px 13px; font-size: 13px; min-height: 34px; border-radius: 8px; }
.mall-btn[disabled], .mall-btn.is-disabled {
  opacity: .5; cursor: not-allowed; box-shadow: none;
}

/* ------------------------------------------------------------------ 卡片 */
.mall-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.mall-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--mall-line);
  border-radius: var(--mall-radius);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.mall-card:hover { box-shadow: var(--mall-shadow); border-color: #cddcf5; transform: translateY(-2px); }
.mall-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--mall-tint);
  overflow: hidden;
}
.mall-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mall-card-media .mall-noimg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--mall-muted);
  background: repeating-linear-gradient(45deg, #f4f7fd, #f4f7fd 8px, #eef3fb 8px, #eef3fb 16px);
}
.mall-card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mall-card-brand { font-size: 11.5px; color: var(--mall-muted); letter-spacing: .04em; text-transform: uppercase; }
.mall-card-title {
  font-size: 15px; font-weight: 700; color: var(--mall-navy); margin: 0;
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mall-card-title a { color: inherit; }
.mall-card-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; }
.mall-price { font-size: 17px; font-weight: 700; color: var(--mall-navy); letter-spacing: -0.01em; }
.mall-price small { font-size: 11.5px; font-weight: 500; color: var(--mall-muted); margin-left: 2px; }
.mall-price-tbd { font-size: 13px; color: var(--mall-muted); font-weight: 600; }

/* ------------------------------------------------------------------ 徽标 */
.mall-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.6;
  background: var(--mall-tint-2); color: var(--mall-royal);
  white-space: nowrap;
}
.mall-badge-ok { background: var(--mall-ok-bg); color: var(--mall-ok); }
.mall-badge-warn { background: var(--mall-warn-bg); color: var(--mall-warn); }
.mall-badge-err { background: var(--mall-err-bg); color: var(--mall-err); }
.mall-badge-muted { background: #eef1f6; color: var(--mall-muted); }

/* ---------------------------------------------------------------- 工具栏 */
.mall-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: #fff; border: 1px solid var(--mall-line);
  border-radius: var(--mall-radius); padding: 14px;
  margin: 0 0 20px;
}
.mall-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1 1 160px; }
.mall-field > label, .mall-field-label {
  font-size: 12px; font-weight: 600; color: var(--mall-muted); letter-spacing: .02em;
}
.mall-input, .mall-select, .mall-textarea {
  width: 100%; min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--mall-line);
  border-radius: 9px;
  font-size: 14px;
  color: var(--mall-ink);
  background: #fff;
  font-family: inherit;
}
.mall-input:focus, .mall-select:focus, .mall-textarea:focus {
  outline: 2px solid rgba(46, 123, 255, .35); outline-offset: 1px; border-color: var(--mall-sky);
}
.mall-textarea { min-height: 84px; resize: vertical; }
.mall-toolbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* chip 行：横滑但隐藏原生滚动条，选中项自动滚入（脚本见 mall.js） */
.mall-chiprow {
  display: flex; gap: 8px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
  padding: 2px 2px 6px;
  margin: 0 0 18px;
  scroll-behavior: smooth;
}
.mall-chiprow::-webkit-scrollbar { display: none; }
.mall-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--mall-line);
  background: #fff;
  color: var(--mall-ink-soft);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.mall-chip:hover { border-color: var(--mall-sky); color: var(--mall-blue); text-decoration: none; }
.mall-chip.is-active { background: var(--mall-blue); border-color: var(--mall-blue); color: #fff; }

/* ------------------------------------------------------------------ 空态 */
.mall-empty {
  background: #fff; border: 1px dashed var(--mall-line);
  border-radius: var(--mall-radius);
  padding: 44px 24px; text-align: center;
}
.mall-empty h3 { margin: 0 0 8px; font-size: 17px; color: var(--mall-navy); }
.mall-empty p { margin: 0 0 16px; color: var(--mall-muted); font-size: 14px; }

/* ------------------------------------------------------------------ 详情 */
.mall-detail { display: grid; gap: 26px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
.mall-detail-media {
  border: 1px solid var(--mall-line); border-radius: var(--mall-radius);
  overflow: hidden; background: var(--mall-tint); aspect-ratio: 4 / 3;
  position: relative;
}
.mall-detail-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mall-detail-info { min-width: 0; }
.mall-detail-title { font-size: clamp(19px, 2.6vw, 26px); line-height: 1.35; margin: 4px 0 10px; color: var(--mall-navy); }
.mall-meta { display: grid; gap: 8px; margin: 16px 0; }
.mall-meta-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; font-size: 14px; }
.mall-meta-row dt, .mall-meta-row .mall-meta-k { color: var(--mall-muted); }
.mall-meta-row dd, .mall-meta-row .mall-meta-v { margin: 0; color: var(--mall-ink); min-width: 0; overflow-wrap: anywhere; }

.mall-sku {
  display: grid; gap: 10px;
  border: 1px solid var(--mall-line); border-radius: var(--mall-radius-sm);
  padding: 12px 14px; margin: 0 0 10px; background: #fff;
}
.mall-sku.is-selected { border-color: var(--mall-blue); box-shadow: 0 0 0 2px rgba(30, 85, 200, .12); }
.mall-sku-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.mall-sku-name { font-weight: 700; font-size: 14px; color: var(--mall-navy); }
.mall-sku-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mall-qty { display: inline-flex; align-items: center; border: 1px solid var(--mall-line); border-radius: 9px; overflow: hidden; }
.mall-qty input {
  width: 62px; border: 0; text-align: center; font-size: 14px;
  padding: 8px 0; font-family: inherit; color: var(--mall-ink);
}
.mall-qty input:focus { outline: none; }
.mall-qty button {
  width: 34px; height: 36px; border: 0; background: var(--mall-tint);
  color: var(--mall-navy); font-size: 16px; cursor: pointer;
}
.mall-qty button:hover { background: var(--mall-tint-2); }

/* ------------------------------------------------------------------ 说明块 */
.mall-note {
  border-left: 3px solid var(--mall-sky);
  background: var(--mall-tint);
  border-radius: 0 var(--mall-radius-sm) var(--mall-radius-sm) 0;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--mall-ink-soft);
}
.mall-note strong { display: block; color: var(--mall-navy); font-size: 13.5px; margin-bottom: 4px; }
.mall-note-warn { border-left-color: #e8a33d; background: var(--mall-warn-bg); color: #6b4000; }
.mall-note-warn strong { color: #6b4000; }
.mall-prose { font-size: 14px; line-height: 1.85; color: var(--mall-ink-soft); white-space: pre-line; }

/* ------------------------------------------------------------------ 表格 */
.mall-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mall-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.mall-table th, .mall-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--mall-line);
  vertical-align: middle;
}
.mall-table thead th {
  background: var(--mall-tint); color: var(--mall-ink-soft);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.mall-table tbody tr:hover { background: #fafcff; }
.mall-table td.num, .mall-table th.num { text-align: right; white-space: nowrap; }
.mall-table tfoot td { font-weight: 700; color: var(--mall-navy); background: #fafcff; }
.mall-table .mall-cell-sub { display: block; font-size: 11.5px; color: var(--mall-muted); margin-top: 2px; }

/* -------------------------------------------------------------- 定义列表 */
.mall-dl { display: grid; gap: 10px; margin: 0; }
.mall-dl > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; align-items: start; }
.mall-dl dt { color: var(--mall-muted); font-size: 13px; }
.mall-dl dd { margin: 0; color: var(--mall-ink); font-size: 14px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ 面板 */
.mall-panel {
  background: #fff; border: 1px solid var(--mall-line);
  border-radius: var(--mall-radius); padding: 18px 20px; margin: 0 0 18px;
}
.mall-panel > h2, .mall-panel > h3 {
  margin: 0 0 12px; font-size: 15.5px; color: var(--mall-navy);
}
.mall-panel-note { margin: 0 0 14px; font-size: 13px; color: var(--mall-muted); line-height: 1.75; }
.mall-cols { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.mall-cols-3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ------------------------------------------------------------------ KPI */
.mall-kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0 0 18px; }
.mall-kpi {
  background: #fff; border: 1px solid var(--mall-line);
  border-radius: var(--mall-radius); padding: 16px 18px;
}
.mall-kpi-k { font-size: 12px; color: var(--mall-muted); font-weight: 600; margin: 0 0 6px; }
.mall-kpi-v { font-size: 27px; font-weight: 700; color: var(--mall-navy); line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.mall-kpi-v small { font-size: 13px; font-weight: 600; color: var(--mall-muted); margin-left: 3px; }

/* -------------------------------------------------------------- 步骤条 */
.mall-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: mallstep; }
.mall-steps li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--mall-muted); font-weight: 600;
  background: #fff; border: 1px solid var(--mall-line); border-radius: 999px; padding: 7px 14px;
}
.mall-steps li::before {
  counter-increment: mallstep; content: counter(mallstep);
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--mall-tint-2); color: var(--mall-royal);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
}
.mall-steps li.is-on { color: var(--mall-navy); border-color: var(--mall-sky); background: var(--mall-tint); }
.mall-steps li.is-on::before { background: var(--mall-blue); color: #fff; }

/* -------------------------------------------------------------- 表单行 */
.mall-form { display: grid; gap: 14px; }
.mall-form .mall-field { flex: none; }
.mall-form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.mall-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mall-hint { font-size: 12px; color: var(--mall-muted); margin: 0; }

/* -------------------------------------------------------------- 时间线 */
.mall-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mall-timeline li { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.mall-timeline time { color: var(--mall-muted); font-variant-numeric: tabular-nums; }
.mall-timeline .mall-tl-text { color: var(--mall-ink); min-width: 0; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- 后台子导航 */
.mall-adminnav {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 6px; background: #fff;
  border: 1px solid var(--mall-line); border-radius: 12px;
}
.mall-adminnav a {
  padding: 8px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--mall-ink-soft); white-space: nowrap;
}
.mall-adminnav a:hover { background: var(--mall-tint); text-decoration: none; color: var(--mall-navy); }
.mall-adminnav a.is-active { background: var(--mall-blue); color: #fff; }

/* -------------------------------------------------------------- 图片小图 */
.mall-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--mall-tint); display: block; }

/* -------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
  .mall-detail { grid-template-columns: minmax(0, 1fr); }
  .mall-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .mall-wrap { padding: 0 14px; }
  .mall-hero { padding: 34px 0 30px; }
  .mall-section { padding: 28px 0; }
  .mall-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .mall-card-body { padding: 11px 12px 13px; }
  .mall-card-title { font-size: 13.5px; }
  .mall-price { font-size: 15px; }
  .mall-toolbar { padding: 12px; }
  .mall-field { flex: 1 1 100%; }
  .mall-toolbar-actions { flex: 1 1 100%; }
  .mall-toolbar-actions .mall-btn { flex: 1 1 auto; }
  .mall-dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .mall-meta-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .mall-timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .mall-panel { padding: 15px 14px; }
  .mall-kpi-v { font-size: 22px; }
  .mall-hero-cta .mall-btn { flex: 1 1 100%; }
}
