/* ============================================================
   117mart 代购系统 共用样式（浅色主题）
   客户端（日语）与管理端（中文）共用
   视觉识别：暖纸底 + 松绿主色 + 朱色品牌点缀（和风）
   ============================================================ */
:root {
  --primary: #0e8a6d;        /* 松绿 */
  --primary-dark: #0a6b55;
  --primary-light: #e7f5f0;
  --accent: #d9532b;         /* 朱色（品牌点缀，仅 logo/小装饰） */
  --bg: #f6f5f0;             /* 暖纸色 */
  --card: #ffffff;
  --border: #e5e2d8;
  --text: #26241f;
  --muted: #7a7568;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(60, 55, 40, 0.07), 0 1px 2px rgba(60, 55, 40, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans JP",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 通用布局 ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.page-header {
  background: var(--card);
  border-bottom: 3px solid var(--primary);
  padding: 14px 0;
  box-shadow: var(--shadow);
}
.page-header .inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px 4px 10px 4px;
  background: linear-gradient(135deg, #e2653a, var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ---------- 按钮（胶囊形） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text);
  padding: 8px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #faf9f4; border-color: #cfcaba; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 999px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field .label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
label.field .req { color: var(--red); }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 109, 0.14);
}
textarea { resize: vertical; min-height: 70px; }

/* ---------- 可搜索下拉（combo） ---------- */
.combo { position: relative; }
.combo-input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.combo-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 109, 0.14);
}
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  z-index: 1000;
}
.combo-opt {
  padding: 9px 12px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid #f3f1ea;
}
.combo-opt:last-child { border-bottom: none; }
.combo-opt:hover, .combo-opt.active { background: var(--primary); color: #fff; }
.combo-empty { padding: 9px 12px; font-size: 13px; color: var(--muted); }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 12px; font-size: 12.5px; font-weight: 700;
  color: var(--muted); border-bottom: 2px solid var(--border);
  background: #faf9f4; white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; transition: background 0.1s; }
.tbl tbody tr:hover { background: #faf9f4; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 状态徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-s-awaiting_payment  { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-s-awaiting_shipment { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-s-shipped           { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.badge-s-arrived_warehouse { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-s-stored            { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }
.badge-s-to_japan          { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-s-cancelled         { background: #faf9f4; color: #475569; border-color: #cbd5e1; }

/* ---------- 金额 ---------- */
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.money-in { color: var(--green); }
.money-out { color: var(--text); }
.money-neg { color: var(--accent); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(14, 138, 109, 0.10), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(217, 83, 43, 0.07), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  border-top: 4px solid var(--accent);
  box-shadow: 0 6px 32px rgba(60, 55, 40, 0.10);
  padding: 34px 28px 30px;
}
.login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 19px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-error {
  background: #fef2f2; color: var(--red); border: 1px solid #fecaca;
  border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 14px;
}

/* ---------- 标签页（胶囊式） ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding: 4px 0; }
.tab {
  padding: 8px 18px; font-size: 14px; font-weight: 600; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px; background: var(--card);
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: var(--border); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.chip {
  padding: 5px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer;
}
.chip:hover { border-color: #cbd5e1; color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-bar select, .filter-bar input { width: auto; padding: 6px 10px; font-size: 13.5px; }
.filter-bar .filter-search { min-width: 280px; }
.filter-bar .filter-search:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

/* 联想搜索命中片段高亮（和风黄底，和背景协调） */
mark { background: rgba(217, 83, 43, 0.18); color: inherit; padding: 0 2px; border-radius: 3px; font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; animation: fadeIn 0.15s;
}
.modal {
  background: var(--card); border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  animation: slideUp 0.2s;
}
.modal.wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); border-radius: 16px 16px 0 0; z-index: 1;
}
.modal-head h3 { font-size: 16.5px; }
.modal-close { border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--card); border-radius: 0 0 16px 16px;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }

/* ---------- 订单时间线 ---------- */
.timeline { padding: 4px 0; }
.tl-step { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.tl-step:last-child { padding-bottom: 4px; }
.tl-step::before {
  content: ""; position: absolute; left: 8px; top: 20px; bottom: 0;
  width: 2px; background: var(--border);
}
.tl-step:last-child::before { display: none; }
.tl-step.done::before { background: var(--primary); }
.tl-dot {
  width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2.5px solid #cbd5e1; background: var(--card); z-index: 1;
}
.tl-step.done .tl-dot { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px #fff; }
.tl-step.current .tl-dot { border-color: var(--primary); background: #fff; box-shadow: inset 0 0 0 5px var(--primary); }
.tl-title { font-weight: 700; font-size: 14.5px; }
.tl-step.pending .tl-title { color: #94a3b8; font-weight: 500; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.tl-note {
  font-size: 13px; background: #faf9f4; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; margin-top: 4px; color: var(--text);
  overflow-wrap: anywhere;
}
.tl-cancel {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--red);
  border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-top: 8px;
}

/* ---------- 图片 ---------- */
.thumb {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); background: #faf9f4; display: block;
}
.row-check { width: 16px; height: 16px; cursor: pointer; accent-color: #0e8a6d; }
.thumb-lg { width: 100%; max-width: 320px; border-radius: 10px; }
.img-empty {
  width: 52px; height: 52px; border-radius: 8px; background: #faf9f4;
  border: 1px dashed var(--border); color: #cbd5e1;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}

/* 上传拖放区 */
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 22px;
  text-align: center; color: var(--muted);
  transition: all 0.15s; font-size: 14px; background: #faf9f4;
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.dropzone img { max-height: 140px; max-width: 100%; border-radius: 8px; margin-bottom: 8px; }

/* 拖放区内的「点击上传文件」文字按钮（仅这几个字触发本地选择） */
.upload-link {
  font-size: 15px; font-weight: 700; color: var(--primary);
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.upload-link:hover { color: var(--primary-dark); }

/* ---------- 提示条 ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; border-radius: 10px; padding: 11px 18px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
  animation: slideUp 0.2s; max-width: 340px;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ---------- 凭证展示（客户UID+密码一次性显示） ---------- */
.cred-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
  padding: 16px; margin: 12px 0; font-size: 16px;
}
.cred-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.cred-row .k { color: var(--muted); font-size: 13px; width: 70px; flex: none; }
.cred-row .v { font-weight: 800; font-family: Consolas, monospace; letter-spacing: 0.5px; }
.cred-warn { color: #b45309; font-size: 13px; margin-top: 10px; font-weight: 600; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14.5px; }
.empty .ico { font-size: 34px; margin-bottom: 8px; opacity: 0.5; }

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 入库包裹状态徽章 ---------- */
.badge-s-pending  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-s-matched  { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }

/* ---------- 转运预报状态徽章 ---------- */
.badge-s-awaiting_arrival { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-s-arrived          { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-s-awaiting_fee     { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-s-shipped          { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.badge-s-completed        { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* ---------- 运费明细（5 项） ---------- */
.fee-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 4px; }
.fee-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.fee-table .fee-label { color: var(--muted); font-size: 13px; }
.fee-table .fee-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fee-table .fee-readonly { color: var(--muted); font-size: 12px; }
.fee-table .fee-total td { border-top: 2px solid var(--border); border-bottom: none; font-size: 15px; font-weight: 800; }
.fee-table .fee-total .fee-label { color: var(--text); }

/* 5 项运费输入行 */
.fee-input-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fee-input-row .fee-name { flex: none; width: 120px; font-size: 13px; color: var(--muted); }
.fee-input-row .fee-input { flex: 1; }
.fee-input-row .fee-hint { flex: none; width: 200px; font-size: 12px; color: var(--muted); }
.fee-input-row input { width: 100%; }

/* 匹配结果展示 */
.match-result { border-radius: 10px; padding: 12px 14px; margin: 8px 0 14px; font-size: 14px; }
.match-result.match-hit  { background: #f0fdfa; border: 1px solid #99f6e4; color: #0f766e; }
.match-result.match-none { background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; }
.match-result .match-icon { font-size: 18px; margin-right: 6px; }

/* 候选订单列表（待匹配包裹人工挂载用） */
.candidate-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.candidate-item { padding: 10px 14px; border-bottom: 1px solid #f3f1ea; cursor: pointer; transition: background 0.1s; }
.candidate-item:last-child { border-bottom: none; }
.candidate-item:hover { background: var(--primary-light); }
.candidate-item.selected { background: var(--primary); color: #fff; }

/* 扫码按钮 */
.btn-scan {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--primary); background: var(--primary-light); color: var(--primary);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-scan:hover { background: var(--primary); color: #fff; }
.btn-scan:disabled { opacity: 0.5; cursor: not-allowed; }

/* 照片缩略图网格 */
.photo-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.photo-thumb {
  width: 64px; height: 64px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border); background: #faf9f4;
}
.photo-add {
  width: 64px; height: 64px; border-radius: 6px; border: 2px dashed #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #94a3b8; cursor: pointer; background: #faf9f4;
}
.photo-add:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 手机适配 ---------- */
@media (max-width: 640px) {
  .form-row { flex-direction: column; gap: 0; }
  .card { padding: 14px; }
  .page-header .inner { padding: 0 12px; }
  .tbl th, .tbl td { padding: 8px 8px; }
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; }
}
