/* 飞影进销存系统 · 全局样式（蓝白简洁风，自适应手机/电脑） */
:root {
  --primary: #2f6bff;
  --primary-dark: #1e50d8;
  --primary-light: #eaf0ff;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e5e8ef;
  --text: #1f2733;
  --muted: #7a8494;
  --danger: #e5484d;
  --danger-light: #fdecec;
  --warn: #f5a623;
  --warn-light: #fdf3e3;
  --ok: #1fae6d;
  --ok-light: #e6f6ef;
  --blue: #2f6bff;
  --blue-light: #eaf0ff;
  --sidebar-w: 200px;
  --topbar-h: 52px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }

/* ===== 布局 ===== */
#app { height: 100vh; display: flex; flex-direction: column; }

/* 顶栏 */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand {
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.topbar .right { display: flex; align-items: center; gap: 12px; }
.menu-btn {
  display: none;
  background: none; border: none; font-size: 20px;
  color: var(--text); padding: 4px 8px;
}
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.boss-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--warn-light); color: #b7791f;
}

/* 主体 */
.layout { flex: 1; display: flex; overflow: hidden; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 10px 8px;
}
.group { font-size: 11px; color: var(--muted); padding: 12px 12px 6px; letter-spacing: 1px; }
.menu {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--text); font-size: 13.5px; cursor: pointer;
  transition: background 0.15s;
  border: none; background: none; width: 100%; text-align: left;
}
.menu:hover { background: var(--bg); }
.menu.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.menu .ico { width: 18px; text-align: center; font-size: 15px; }
.menu .badge {
  margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 8px;
  background: var(--danger); color: #fff;
}

/* 内容区 */
.content { flex: 1; overflow-y: auto; padding: 20px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.card-hd h3 { font-size: 15px; font-weight: 600; }
.card-bd { padding: 16px; }
.card-bd.flush { padding: 0; }

/* ===== 指标卡 ===== */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.metric .lb { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.metric .val { font-size: 22px; font-weight: 700; }
.metric .val.red { color: var(--danger); }
.metric .val.green { color: var(--ok); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfc; color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: #f8fafd; cursor: pointer; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.r { text-align: right; }

/* ===== 标签 ===== */
.tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px;
  line-height: 1.6;
}
.tag.ok { background: var(--ok-light); color: var(--ok); }
.tag.warn { background: var(--warn-light); color: #b7791f; }
.tag.danger { background: var(--danger-light); color: var(--danger); }
.tag.blue { background: var(--blue-light); color: var(--primary); }
.tag.gray { background: #eef1f5; color: var(--muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  transition: all 0.15s;
}
.btn:hover { border-color: #c8ced9; background: #fafbfc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #d13a3f; }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}
.field textarea { resize: vertical; min-height: 60px; }
.checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 180px; }
.remind-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 14px; margin-bottom: 14px; background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 8px; font-size: 13px; color: #8a5a00; }
.ship-items { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.ship-item-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.ship-item-row.shipped { opacity: 0.55; background: #f5f5f5; }
.ship-item-row .muted { color: var(--muted); font-size: 12px; }
.track-result { padding: 12px; background: #f7f9ff; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; max-height: 280px; overflow-y: auto; }
.toolbar .search input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}

/* ===== 警告条 ===== */
.warn-bar {
  background: var(--warn-light); border: 1px solid #f5d9a6; border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.warn-bar .cnt {
  background: var(--warn); color: #fff; border-radius: 50%;
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 30, 50, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: #fff; border-radius: 12px; width: 90%; max-width: 560px;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.modal-bd { padding: 20px; }
.modal-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--muted); }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6bff 0%, #1e50d8 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.login-card .sub { color: var(--muted); text-align: center; font-size: 13px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-err { color: var(--danger); font-size: 12px; margin-top: 10px; text-align: center; }

/* ===== 空状态 / 加载 ===== */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 10px 20px; border-radius: 8px;
  z-index: 300; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ===== 明细标签页 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  padding: 10px 16px; border: none; background: none; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== 进度条 ===== */
.stage-steps { display: flex; align-items: center; gap: 0; margin: 16px 0; flex-wrap: wrap; }
.stage {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 20px; font-size: 12px; background: #eef1f5; color: var(--muted);
}
.stage.active { background: var(--primary); color: #fff; }
.stage.failed { background: var(--danger); color: #fff; }
.stage-arrow { color: var(--muted); margin: 0 4px; }

/* ===== 售后返修：长路径/日志换行 + 可配置路径 ===== */
.repair-page .form-row > *, .repair-page .field, .repair-page .grow { min-width: 0; }
.repair-wrap-text {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
  vertical-align: top;
}
.repair-log-wrap { max-height: 220px; overflow: auto; }
.repair-log-table td:last-child { min-width: 260px; max-width: 480px; }
.repair-route-manager .route-node-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(220px, 1.5fr) auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.repair-route-manager .route-node-row.logistics { grid-template-columns: minmax(260px, 1fr) auto; }
.repair-route-manager .route-node-row input, .repair-route-manager .route-node-row select {
  width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff;
}
.repair-route-manager .route-node-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ===== 响应式（手机端）===== */
@media (max-width: 760px) {
  .sidebar {
    position: fixed; left: -100%; top: var(--topbar-h); bottom: 0;
    width: 240px; z-index: 150; transition: left 0.25s; box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    height: auto;
  }
  .sidebar.open { left: 0; }
  .menu-btn { display: block; }
  .topbar { padding: 0 8px; gap: 4px; }
  .topbar .brand { flex: 1; min-width: 0; gap: 6px; font-size: 14px; }
  .topbar .logo { width: 28px; height: 28px; flex: 0 0 28px; font-size: 14px; }
  .brand-title { overflow: hidden; text-overflow: ellipsis; }
  .site-badge { display: none; }
  .topbar .right { gap: 4px; flex-shrink: 0; }
  .user-chip { gap: 0; }
  .user-name, .user-role { display: none; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }
  .account-btn { padding: 5px 7px; font-size: 12px; }
  .desktop-only { display: none; }
  .mobile-only { display: inline; }
  .content { padding: 14px 10px 24px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 18px; }
  .page-sub { margin-bottom: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .repair-page .form-row { grid-template-columns: 1fr !important; }
  .repair-route-manager .route-node-row, .repair-route-manager .route-node-row.logistics { grid-template-columns: 1fr; }
  .repair-route-manager .route-node-actions { justify-content: flex-start; }
  .repair-log-table td:last-child { min-width: 220px; }
  .card-bd { padding: 12px; }
  .card-hd { padding: 12px; }
  .modal { width: 94%; max-height: 88vh; }
  .modal-hd { padding: 14px; }
  .modal-bd { padding: 14px; }
  .modal-ft { padding: 12px 14px; }
}

@media (max-width: 600px) {
  th, td { padding: 8px 10px; }
  .toolbar { gap: 8px; align-items: stretch; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; }
  .toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar .btn { flex: 1 1 auto; justify-content: center; padding: 7px 10px; }
  .stock-table { min-width: 0; display: block; }
  .stock-table tr:first-child { display: none; }
  .stock-table tr:not(:first-child) {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    grid-template-areas:
      "img main qty"
      "img cat cost"
      "img actions actions";
    align-items: start;
    gap: 3px 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
  }
  .stock-table td {
    display: block;
    padding: 0;
    border: none;
    white-space: normal;
    text-align: left;
  }
  .stock-table .stock-img { grid-area: img; }
  .stock-table .stock-main { grid-area: main; min-width: 0; }
  .stock-table .stock-main b { white-space: normal; line-height: 1.45; }
  .stock-table .stock-cat { grid-area: cat; color: var(--muted); font-size: 12px; }
  .stock-table .stock-qty { grid-area: qty; text-align: right; font-size: 16px; font-weight: 700; white-space: nowrap; }
  .stock-table .stock-cost { grid-area: cost; text-align: right; font-size: 11px; white-space: nowrap; }
  .stock-table .stock-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-start; margin-top: 4px; }
  .stock-table .stock-actions .btn.sm { padding: 4px 8px; font-size: 11px; margin-left: 0 !important; }
  .stock-table tr.stock-empty-row { display: block; padding: 0; border: 0; }
  .stock-table tr.stock-empty-row td { display: block; padding: 28px 10px; text-align: center; }
  .login-card { padding: 28px 20px; }
}
.sidebar-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 140; display: none;
}
.sidebar-mask.show { display: block; }

/* ===== AI 助手（聊天） ===== */
.chat-box { border: 1px solid var(--line); }
.chat-empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.quick-wrap { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.quick-btn { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 16px; cursor: pointer; font-size: 13px; }
.quick-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-row { display: flex; margin-bottom: 10px; }
.chat-row.user { justify-content: flex-end; }
.chat-row.ai { justify-content: flex-start; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.chat-row.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-row.ai .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.muted { color: var(--muted); }

/* ===== 报表中心 ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ===== 全局搜索 ===== */
.search-big { display: flex; gap: 10px; margin: 16px 0; }
.search-big input { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }

/* ===== 待办中心 ===== */
tr.done td { color: var(--muted); text-decoration: line-through; }

/* ===== CRM 标签与跟进 ===== */
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tag-row a { color: inherit; text-decoration: none; margin-left: 4px; }
.follow-list { max-height: 300px; overflow-y: auto; }
.follow-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.follow-item:last-child { border-bottom: none; }
.fl-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fl-content { font-size: 14px; }
.fl-next { font-size: 12px; color: var(--primary); margin-top: 4px; }
textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit; }

/* ===== 品牌搜索下拉（商品编辑里的品牌输入框） ===== */
.brand-combo { position: relative; }
.brand-combo input { width: 100%; }
.brand-suggest {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 50, 0.14);
  max-height: 220px; overflow-y: auto;
}
.brand-suggest-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid #f2f4f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-suggest-item:last-child { border-bottom: none; }
.brand-suggest-item:hover, .brand-suggest-item.active { background: var(--primary-light); color: var(--primary-dark); }
.brand-suggest-empty { padding: 10px 12px; font-size: 12px; color: var(--muted); }

/* ===== 通用选择器 PickerModal ===== */
.picker-modal { max-width: 560px; }
/* 选择器弹窗需盖在普通弹窗之上（比如从验收弹窗里点「选择验收人」） */
.picker-mask { z-index: 300; }
.picker-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.picker-select-all { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.picker-list { max-height: 380px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.picker-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid #f0f0f0; cursor: pointer;
  transition: background 0.15s;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: #f7f9ff; }
.picker-item.active { background: #eef3ff; }
.picker-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.picker-name { font-size: 14px; font-weight: 500; }
.picker-tag { font-size: 11px; color: var(--muted); background: #f0f0f0; padding: 2px 8px; border-radius: 10px; }
.picker-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
/* 供货商选择器：对接人名字可直接点击带入进货单 */
.picker-contact-label { white-space: nowrap; }
.picker-contact-chip { display: inline-block; padding: 2px 8px; border: 1px solid #cfe0ff; border-radius: 10px; color: #2563eb; background: #f5f9ff; cursor: pointer; line-height: 1.5; }
.picker-contact-chip:hover { background: #e4efff; border-color: #8fb6ff; }
.picker-stock { color: var(--primary); font-weight: 600; }
.picker-stock.zero { color: var(--danger, #e74c3c); }
.picker-check { color: var(--primary); font-weight: 700; font-size: 16px; }
/* 组合商品在列表里直接缩进展示配方明细 */
.composite-detail { margin-top: 5px; padding: 6px 8px; border-left: 2px solid #b7cfff; background: #f7faff; border-radius: 0 5px 5px 0; }
.composite-line { color: #52657f; font-size: 11px; line-height: 1.6; }
/* 销售单配套提醒 */
.kit-reminder { margin-top: 9px; padding: 8px 10px; border-left: 3px solid #f5a623; background: #fffaf0; border-radius: 0 6px 6px 0; font-size: 12px; line-height: 1.65; }
.kit-reminder b { color: #8a5a00; }
.kit-reminder .kit-line { color: #52657f; }
/* 商品名分组：多型号默认收起，展开后只比较品牌/型号 */
.picker-tip { margin: -4px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.picker-group { border-bottom: 1px solid var(--line); }
.picker-group:last-child { border-bottom: none; }
.picker-group-hd { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; background: #fbfcff; }
.picker-group-hd:hover { background: #f1f5ff; }
.picker-group-arrow { width: 16px; flex: 0 0 16px; color: var(--primary); font-size: 14px; }
.picker-group-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.picker-group-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.picker-group-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.picker-group-select { flex: 0 0 auto; padding: 3px 8px; }
.picker-group-items { background: #fff; }
.picker-group-items .picker-item { padding-left: 38px; }
.picker-variant-name { font-size: 13px; font-weight: 500; }
.picker-group-hd.composite { background: #f1f6ff; }
.picker-child-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 42px; border-bottom: 1px dashed #edf0f6; background: #fbfcff; font-size: 12px; }
.picker-child-row:last-child { border-bottom: none; }
.picker-child-mark { color: #9aa8bd; }
.picker-child-row .grow { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .picker-child-row { padding-left: 28px; }
}
@media (max-width: 600px) {
  .picker-group-hd { align-items: flex-start; flex-wrap: wrap; }
  .picker-group-meta { margin-left: 24px; }
  .picker-group-select { margin-left: auto; }
  .picker-group-items .picker-item { padding-left: 28px; }
}

/* 选择器触发框（可点击的输入框样式） */
.picker-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; min-height: 38px; font-size: 14px;
}
.picker-trigger .placeholder { color: #bbb; }
.picker-trigger .arrow { color: #aaa; }

/* 明细行卡片 */
.item-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; }
.item-card .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.item-card .row .grow { flex: 1; min-width: 120px; }

/* ===== 全局图片压缩 / 拍照编辑 ===== */
.camera-pick-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.camera-pick-btn:active { background: var(--primary-light); }
.img-editor-mask {
  position: fixed; inset: 0; z-index: 600; background: rgba(15, 23, 42, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.img-editor-card {
  width: min(760px, 100%); max-height: 94vh; background: #fff;
  border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.img-editor-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
}
.img-editor-close { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; }
.img-editor-preview {
  flex: 1; min-height: 220px; max-height: 60vh; overflow: auto;
  background: #111827; display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.img-editor-preview canvas { display: block; max-width: 100%; border-radius: 4px; }
.img-editor-tools {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--line);
}
.img-editor-select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; font-size: 12px; max-width: 140px;
}
.img-editor-bright { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.img-editor-bright input { width: 110px; }
.img-editor-ft {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--line);
}
@media (max-width: 600px) {
  .img-editor-mask { padding: 0; align-items: flex-end; }
  .img-editor-card { width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .img-editor-preview { max-height: 52vh; }
  .img-editor-tools { gap: 6px; padding: 8px 10px; }
  .img-editor-bright { width: 100%; }
  .img-editor-bright input { flex: 1; width: auto; }
  .camera-pick-btn { width: 100%; justify-content: center; }
}

/* ===== 附近客户（GPS + 距离） ===== */
.nearby-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.nearby-tools select { padding:7px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; font-size:13px; }
.nearby-list { max-height:52vh; overflow-y:auto; border:1px solid var(--line); border-radius:10px; }
.nearby-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:12px 14px; border-bottom:1px solid var(--line); }
.nearby-row:last-child { border-bottom:none; }
.nearby-main { min-width:0; flex:1; }
.nearby-addr { color:#64748b; font-size:12px; margin-top:4px; line-height:1.5; }
.nearby-contact { color:var(--muted); font-size:12px; margin-top:3px; }
.nearby-side { text-align:right; flex:0 0 auto; }
.nearby-dist { color:var(--primary); font-weight:700; font-size:14px; white-space:nowrap; }
.nearby-actions { display:flex; gap:4px; justify-content:flex-end; margin-top:6px; }
.nearby-actions .btn.sm { padding:4px 7px; font-size:11px; }
@media (max-width:600px) {
  .nearby-row { flex-direction:column; gap:6px; padding:10px; }
  .nearby-side { width:100%; display:flex; align-items:center; justify-content:space-between; text-align:left; }
  .nearby-actions { margin-top:0; }
  .nearby-tools select { flex:1; }
}

/* 客户列表对接人：只显示姓名，完整电话放 title 悬停提示 */
.contact-summary {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
@media (max-width: 600px) {
  .contact-summary { max-width: 110px; }
}

/* 客户订单弹窗：手机端改为卡片，确保「查看明细」按钮可见可点 */
@media (max-width: 600px) {
  .order-records-table thead { display: none; }
  .order-records-table,
  .order-records-table tbody,
  .order-records-table tr,
  .order-records-table td { display: block; width: 100%; box-sizing: border-box; }
  .order-records-table tr {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 10px; margin-bottom: 10px; background: #fff;
  }
  .order-records-table td {
    border: none; padding: 3px 0; text-align: left !important;
    white-space: normal; word-break: break-all;
  }
  .order-records-table td::before {
    content: attr(data-label) "："; display: inline-block;
    min-width: 46px; color: var(--muted); font-weight: 400;
  }
  .order-records-table td[data-label="操作"]::before { display: none; }
  .order-records-table td[data-label="操作"] .btn { width: 100%; margin-top: 6px; }
  .order-records-table tr .empty { text-align: center; }
}
