/* ============================================================
   铭盛发货日报 · 划单推送 - H5 预览页样式
   清爽商务风：浅灰背景 + 白色卡片 + 蓝色主色
   ============================================================ */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --success: #0d904f;
  --warning: #f9ab00;
  --danger: #ea4335;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .05);
  /* 全站统一宋体：优先系统安装的宋体，逐级回落到衬线字体，保证各浏览器可显示 */
  --font-song: "Songti SC", "SimSun", "宋体", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 表单控件默认不继承字体，显式继承以保证宋体生效 */
button, input, select, textarea { font-family: inherit; }

body {
  font-family: var(--font-song);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.page { max-width: 480px; margin: 0 auto; padding: 0 12px 24px; }

/* ---------- 顶部栏 ---------- */
.header {
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: #fff;
  margin: 0 -12px 12px;
  padding: 20px 16px 16px;
  border-radius: 0 0 16px 16px;
}
.header-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.header-sub { font-size: 12px; opacity: .85; margin-top: 4px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; align-items: center; gap: 10px; }
.field label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.input-date {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; color: var(--text); background: #fff;
  min-height: 44px;
}
.tabs { display: flex; gap: 8px; }
.tab {
  flex: 1; min-height: 44px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8f9fa; color: var(--text-secondary); font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.tab.active {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600;
}

/* ---------- 过滤行（含未审核开关 + 范围提示） ---------- */
.filter-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fafbfc; border: 1px dashed var(--border); border-radius: 8px;
  padding: 8px 12px;
}
.check-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--text); font-weight: 500; white-space: nowrap;
  cursor: pointer;
}
.check-label input { width: 18px; height: 18px; accent-color: var(--primary); }
.range-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ---------- 徽标 ---------- */
.badge {
  font-size: 12px; color: var(--primary); background: var(--primary-light);
  padding: 3px 10px; border-radius: 999px; font-weight: 500;
}

/* ---------- 预览区 ---------- */
.preview {
  background: #fafbfc; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-size: var(--preview-fs, 14px); white-space: pre-wrap; word-break: break-word;
  max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
/* 单品汇总行：强制单行显示，字号由脚本按容器宽度自适应（--preview-fs） */
.preview .md-item {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.75;
}
.preview .md-item .md-name { font-weight: 600; }
.preview .md-title { font-size: 16px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.preview .md-summary { font-weight: 600; color: var(--text); margin-bottom: 6px; }
/* 段标题（产品汇总） */
.preview .md-section {
  font-weight: 700; color: var(--primary-dark); margin: 12px 0 6px;
  font-size: 14.5px; letter-spacing: 0.5px;
}
/* 段分隔线（—————— 详细划单 ——————） */
.preview .md-sep {
  text-align: center; color: var(--text-secondary); margin: 10px 0;
  font-size: 12px; letter-spacing: 2px; white-space: nowrap; overflow: hidden;
}
.preview .md-region {
  font-weight: 700; color: var(--primary-dark); margin: 10px 0 4px;
  border-left: 3px solid var(--primary); padding-left: 8px;
}
/* 划单明细：产品标题（带小计）——顶格左对齐 + 浅色底突出 */
.preview .md-product {
  font-weight: 700; color: var(--primary-dark); margin: 10px 0 4px;
  background: var(--primary-light); border-radius: 6px; padding: 5px 10px;
}
.preview .md-product .md-product-sub { color: var(--warning); font-weight: 600; font-size: 12.5px; }
/* 明细行（顶格左对齐） */
.preview .md-tag {
  display: inline-block; color: var(--primary); background: var(--primary-light);
  border-radius: 4px; padding: 0 6px; margin-right: 6px;
  font-size: 12px; font-weight: 500; line-height: 1.6;
}
.preview .md-customer { font-weight: 600; margin: 4px 0 2px; color: var(--text); }
.preview .md-line { color: var(--text); }
.preview .md-subtotal { color: var(--warning); font-weight: 600; }
.preview .md-total {
  color: #d64541; font-weight: 700; font-size: 15px; margin-top: 8px;
  border-top: 1px dashed var(--border); padding-top: 6px;
}
.preview .empty { color: var(--text-secondary); text-align: center; padding: 24px 0; }

/* ---------- 按钮 ---------- */
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  min-height: 44px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; cursor: pointer; background: #fff;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-outline { color: var(--primary); border-color: #a8c7fa; background: #fff; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Token ---------- */
.token-box { margin-top: 10px; }
.token-box summary { font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.input-token {
  width: 100%; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; min-height: 44px;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.log-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.log-table th {
  background: var(--primary-light); color: var(--primary-dark); text-align: left;
  padding: 8px 6px; white-space: nowrap; font-weight: 600;
}
.log-table td { padding: 8px 6px; border-bottom: 1px solid #f0f1f3; vertical-align: top; }
.log-table tr:last-child td { border-bottom: none; }
.status-success { color: var(--success); font-weight: 600; }
.status-failed { color: var(--danger); font-weight: 600; }
.status-skipped, .status-already { color: var(--text-secondary); }
.status-pending { color: var(--warning); font-weight: 600; }
.log-content { color: var(--text-secondary); font-size: 11.5px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 链接 ---------- */
.link { color: var(--primary); font-size: 13px; cursor: pointer; }
.link:active { opacity: .7; }

/* ---------- 空状态 / 页脚 ---------- */
.empty { color: var(--text-secondary); text-align: center; padding: 18px 0; font-size: 13px; }
.footer { text-align: center; color: var(--text-secondary); font-size: 12px; padding: 12px 0 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%) translateY(20px);
  background: rgba(32, 33, 36, .92); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(234, 67, 53, .95); }
