/* =========================================================
   食品销售 CRM - 全局样式
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: #f5f7fa;
  color: #1f2329;
  -webkit-font-smoothing: antialiased;
}

/* ========== 登录页 ========== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef3fb, #f7f9fc);
  padding: 20px;
}
.login-box {
  background: #fff; border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  padding: 40px 32px; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: #1677ff; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-logo p { color: #999; font-size: 14px; }

.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 14px; margin-bottom: 6px; color: #646a73; }
.form-item input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #dcdfe6; border-radius: 6px;
  font-size: 14px; outline: none; transition: border .2s;
}
.form-item input:focus { border-color: #1677ff; }

.btn-primary {
  width: 100%; height: 42px; border: none; border-radius: 6px;
  background: #1677ff; color: #fff; font-size: 15px;
  cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: #0e5fd8; }
.btn-primary:disabled { background: #a0c4ff; cursor: not-allowed; }

.msg { text-align: center; font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.error { color: #f5222d; }
.msg.success { color: #52c41a; }

/* ========== 主框架 ========== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: #001529; color: #fff;
  flex-shrink: 0; display: flex; flex-direction: column;
 height: 100vh;
  position: sticky;
  top: 0;
}
.sidebar .brand {
  padding: 20px 16px; font-size: 17px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: #1677ff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.sidebar .brand .txt small { display: block; font-size: 11px; color: #8c9bb5; font-weight: 400; margin-top: 2px; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; min-height: 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #c4ccd8; text-decoration: none;
  font-size: 14px; transition: all .2s;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: #1677ff; color: #fff; border-left-color: #fff; }
.sidebar nav a .ico { font-size: 16px; width: 20px; text-align: center; }

.sidebar .user-area {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: background .2s;
}
.sidebar .user-area:hover { background: rgba(255,255,255,0.06); }
.sidebar .user-area .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1677ff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.sidebar .user-area .u-info { flex: 1; min-width: 0; }
.sidebar .user-area .u-name { font-size: 14px; color: #fff; }
.sidebar .user-area .u-sub { font-size: 12px; color: #8c9bb5; margin-top: 2px; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid #eee;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.topbar .title { font-size: 16px; font-weight: 500; }
.topbar .user { font-size: 14px; color: #646a73; display: flex; align-items: center; gap: 12px; }
.topbar .user button {
  border: none; background: transparent; color: #1677ff;
  cursor: pointer; font-size: 14px;
}

.content { flex: 1; padding: 16px; overflow-y: auto; }

.mobile-header { display: none; }

/* ========== 工作台 ========== */
.hello { font-size: 20px; font-weight: 600; margin: 8px 0 4px; }
.hello-date { color: #8f959e; font-size: 13px; margin-bottom: 16px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  position: relative;
}
.stat-card .label { color: #646a73; font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 22px; font-weight: 600; }
.stat-card .ico {
  position: absolute; right: 16px; top: 18px;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.ico-blue { background: #e8f0ff; color: #1677ff; }
.ico-orange { background: #fff2e6; color: #ff7d00; }
.ico-yellow { background: #fffbe6; color: #faad14; }
.ico-green { background: #e8f8ef; color: #00b42a; }
.ico-red { background: #ffece8; color: #f53f3f; }

.block {
  background: #fff; border-radius: 12px; padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); margin-bottom: 16px;
}
.block-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-item {
  border: 1px solid #eef0f3; border-radius: 10px;
  padding: 18px 8px; text-align: center; cursor: pointer;
  transition: all .2s; background: #fff;
}
.quick-item:hover { border-color: #1677ff; box-shadow: 0 4px 16px rgba(22,119,255,0.08); }
.quick-item .q-ico {
  width: 44px; height: 44px; margin: 0 auto 10px;
  border-radius: 50%; background: #e8f0ff; color: #1677ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.quick-item .q-txt { font-size: 14px; color: #1f2329; }

.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 10px; background: #fafbfc;
}
.todo-item .t-left { display: flex; align-items: center; gap: 10px; }
.todo-item .t-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.todo-item .t-title { font-size: 14px; color: #1f2329; }
.todo-item .t-sub { font-size: 12px; color: #8f959e; margin-top: 2px; }
.todo-item .t-right { text-align: right; }
.todo-item .t-num { font-size: 16px; font-weight: 600; }
.todo-item .t-badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
  padding: 0 5px; border-radius: 9px; font-size: 11px; text-align: center;
  background: #f53f3f; color: #fff;
}

/* ========== 页面头部 ========== */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 17px; font-weight: 600; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn-default, .btn-primary {
  height: 34px; padding: 0 14px; border-radius: 6px; font-size: 14px;
  cursor: pointer; transition: all .2s;
}
.btn-default { background: #fff; border: 1px solid #dcdfe6; color: #1f2329; }
.btn-default:hover { border-color: #1677ff; color: #1677ff; }
.btn-primary { background: #1677ff; border: none; color: #fff; }
.btn-primary:hover { background: #0e5fd8; }
.page-actions .btn-default,
.page-actions .btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; height: 36px; padding: 0 16px;
}
.page-actions .bi { font-size: 15px; line-height: 1; }

/* ========== 筛选栏 ========== */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 14px;
  flex-wrap: wrap; align-items: center;
}
.filter-bar .flt-input {
  height: 34px; padding: 0 10px; border: 1px solid #dcdfe6;
  border-radius: 6px; font-size: 14px; outline: none;
  background: #fff;
  flex: 0 1 260px;       /* 关键：限制最大宽度 */
  min-width: 160px;
}
.filter-bar .flt-input:focus { border-color: #1677ff; }

.filter-bar .date-btn-group {
  display: flex; gap: 8px; align-items: center; flex: 0 0 auto;
}
.filter-bar .date-btn-group .date-btn {
  min-width: 118px; padding: 6px 10px; font-size: 13px;
  display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #dcdfe6; border-radius: 8px;
  cursor: pointer;
}
.filter-bar .date-btn-group .date-btn.active { border-color: #1677ff; color: #1677ff; }
.filter-bar .date-btn-group .to { color: #8f959e; font-size: 13px; }
.filter-bar .date-btn-group input[type="date"] {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px; overflow: hidden;
}

/* 关键：查询/导出按钮不拉伸 */
.filter-bar .btn-primary,
.filter-bar .btn-default {
  height: 34px;
  padding: 0 18px;
  white-space: nowrap;
  flex: 0 0 auto;         /* 不拉伸 */
  width: auto !important; /* 强制正常宽度 */
  min-width: 60px;
  max-width: 100px;
}
/* ========== 日期按钮组 ========== */
.date-btn-group {
  display: flex; gap: 10px; align-items: center;
}
.date-btn-group .date-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: #fff; border: 1px solid #dcdfe6;
  border-radius: 8px; font-size: 14px; color: #1f2329;
  cursor: pointer; min-width: 130px;
}
.date-btn-group .date-btn:hover { border-color: #1677ff; color: #1677ff; }
.date-btn-group .date-btn.active { border-color: #1677ff; color: #1677ff; }
.date-btn-group .date-btn .db-ico { font-size: 15px; }
.date-btn-group .to { color: #8f959e; font-size: 13px; }
.date-btn-group input[type="date"] {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px; overflow: hidden;
}

/* ========== 批量操作栏 ========== */
.batch-bar {
  display: flex; align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 8px 12px; margin-bottom: 12px;
  background: #f0f6ff; border: 1px solid #d6e6ff; border-radius: 8px;
  overflow-x: auto;
}
.batch-bar .batch-info {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #1f2329; white-space: nowrap;
  flex: 0 0 auto;
}
.batch-bar .batch-actions {
  display: flex; gap: 8px;
  flex-wrap: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
.batch-bar .batch-actions button,
.batch-bar .batch-actions .btn-default,
.batch-bar .batch-actions .btn-primary {
  flex: 0 0 auto !important;
  width: auto !important;
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* ========== Tab ========== */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid #f0f0f0;
  margin-bottom: 14px; overflow-x: auto;
}
.tabs .tab {
  padding: 10px 16px; font-size: 14px; cursor: pointer;
  color: #646a73; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.tabs .tab:hover { color: #1677ff; }
.tabs .tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 500; }
.tabs .tab .tab-cnt { color: #8f959e; font-size: 12px; margin-left: 2px; }
.tabs .tab.active .tab-cnt { color: #1677ff; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid #f0f0f0; text-align: left;
}
.data-table th { background: #fafbfc; color: #646a73; font-weight: 500; white-space: nowrap; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .empty { text-align: center; color: #8f959e; padding: 30px 0; }
.data-table a { color: #1677ff; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table .op-link { margin-right: 10px; }
.data-table .op-link.danger { color: #f53f3f; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; line-height: 18px;
}
.badge-A { background: #fff2e6; color: #ff7d00; }
.badge-B { background: #e8f0ff; color: #1677ff; }
.badge-C { background: #f2f3f5; color: #646a73; }
.badge-ok { background: #e8f8ef; color: #00b42a; }
.badge-off { background: #ffece8; color: #f53f3f; }
.badge-pending { background: #fff7e6; color: #faad14; }
.badge-audited { background: #e8f0ff; color: #1677ff; }
.badge-shipped { background: #e8f8ef; color: #00b42a; }
.badge-done { background: #f2f3f5; color: #646a73; }
.badge-cancelled { background: #f2f3f5; color: #8f959e; text-decoration: line-through; }
.badge-returned { background: #ffece8; color: #f53f3f; }

/* 线索状态 */
.badge-lead-new { background: #e8f0ff; color: #1677ff; }
.badge-lead-following { background: #fff7e6; color: #faad14; }
.badge-lead-converted { background: #e8f8ef; color: #00b42a; }
.badge-lead-dropped { background: #f2f3f5; color: #8f959e; }

/* 商机阶段 */
.badge-opp-contact { background: #e8f0ff; color: #1677ff; }
.badge-opp-need { background: #e8f8ef; color: #00b42a; }
.badge-opp-quote { background: #fff7e6; color: #faad14; }
.badge-opp-negotiate { background: #fff2e6; color: #ff7d00; }
.badge-opp-won { background: #e8f8ef; color: #00b42a; font-weight: 600; }
.badge-opp-lost { background: #f2f3f5; color: #8f959e; text-decoration: line-through; }

/* ========== 分页 ========== */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
.pager .pager-total { color: #8f959e; font-size: 13px; margin-right: auto; }
.pager .pg-btn {
  height: 32px; padding: 0 12px; border: 1px solid #dcdfe6; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.pager .pg-btn:disabled { color: #c4ccd8; cursor: not-allowed; }
.pager .pg-cur { font-size: 13px; color: #646a73; }
.pager .pg-size {
  height: 32px; border: 1px solid #dcdfe6; border-radius: 6px; padding: 0 6px;
}

/* ========== 弹窗 ========== */
.modal-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 3000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 420px;
  padding: 24px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.modal .sub { color: #8f959e; font-size: 13px; margin-bottom: 16px; }
.modal .form-item { margin-bottom: 14px; }
.modal .form-item label { display: block; font-size: 13px; color: #646a73; margin-bottom: 6px; }
.modal .form-item input,
.modal .form-item select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px; outline: none;
  background: #fff;
}
.modal .form-item input:focus,
.modal .form-item select:focus { border-color: #1677ff; }
.modal .btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal .btn-cancel {
  height: 36px; padding: 0 16px; border: 1px solid #dcdfe6; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 14px;
}
.modal .btn-ok {
  height: 36px; padding: 0 16px; border: none; border-radius: 6px;
  background: #1677ff; color: #fff; cursor: pointer; font-size: 14px;
}
.modal .btn-ok:hover { background: #0e5fd8; }
.modal .msg { margin-top: 10px; font-size: 13px; text-align: center; min-height: 18px; }
.modal .msg.error { color: #f5222d; }
.modal .msg.success { color: #52c41a; }
.modal .req { color: #f53f3f; }

.form-row { display: flex; gap: 14px; }
.form-row .form-item { flex: 1; }
.form-row .form-item.col-2 { flex: 2; }

.credit-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.credit-btns .cb {
  padding: 6px 14px; border: 1px solid #dcdfe6; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px; color: #1f2329;
}
.credit-btns .cb.active { background: #1677ff; border-color: #1677ff; color: #fff; }

.detail-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.detail-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.detail-table td:first-child { color: #8f959e; width: 110px; }

/* ========== 用户弹出菜单 ========== */
.popup-mask {
  display: none; position: fixed; inset: 0; z-index: 2000;
}
.popup-mask.show { display: block; }
.popup-menu {
  position: fixed; z-index: 2001;
  background: #fff; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  min-width: 200px; overflow: hidden;
  padding: 6px 0;
}
.popup-menu .pm-head {
  padding: 10px 16px 12px; border-bottom: 1px solid #f0f0f0;
}
.popup-menu .pm-head .pm-name { font-size: 14px; font-weight: 600; }
.popup-menu .pm-head .pm-user { font-size: 12px; color: #8f959e; margin-top: 2px; }
.popup-menu .pm-item {
  padding: 10px 16px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.popup-menu .pm-item:hover { background: #f5f7fa; }
.popup-menu .pm-item.danger { color: #f53f3f; }

/* ========== 可搜索选择器 ========== */
.ss-wrap { position: relative; }
.ss-input-box { position: relative; }
.ss-input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px; outline: none;
  background: #fff;
}
.ss-input:focus { border-color: #1677ff; }

.ss-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  z-index: 9999;
  max-height: 280px;
  overflow-y: auto;
}
.ss-list { padding: 4px 0; }
.ss-item { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.ss-item:hover, .ss-item.active { background: #f0f6ff; }
.ss-item .ss-main { color: #1f2329; }
.ss-item .ss-sub { font-size: 13px; color: #646a73; margin-top: 2px; font-weight: 500; }
.ss-empty { padding: 16px; text-align: center; color: #8f959e; font-size: 13px; }

.ss-sheet {
  position: fixed; inset: 0; z-index: 99999;
  background: #fff; display: flex; flex-direction: column;
}
.ss-sheet-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid #f0f0f0;
  background: #fff;
}
.ss-sheet-search {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: #f5f7fa; border-radius: 8px; padding: 0 10px; height: 38px;
}
.ss-sheet-search .ss-ico { color: #8f959e; }
.ss-sheet-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; height: 100%;
}
.ss-sheet-cancel {
  border: none; background: transparent; color: #1677ff;
  font-size: 15px; cursor: pointer; padding: 6px 4px;
}
.ss-sheet-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.ss-sheet-list .ss-item {
  padding: 12px 16px; border-bottom: 1px solid #f5f7fa;
  cursor: pointer; font-size: 15px;
}
.ss-sheet-list .ss-item:active { background: #f0f6ff; }
.ss-sheet-list .ss-main { color: #1f2329; line-height: 1.4; }
.ss-sheet-list .ss-sub { color: #646a73; font-size: 14px; margin-top: 4px; font-weight: 500; }
.ss-sheet-empty { text-align: center; color: #8f959e; padding: 40px 0; }

/* ========== 导入弹窗 ========== */
.import-modal .modal-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; position: relative;
}
.import-modal .modal-head .m-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: #e8f0ff; color: #1677ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
}
.import-modal .modal-head h3 { margin: 0; font-size: 17px; }
.import-modal .modal-head .close-x {
  position: absolute; right: 0; top: 2px;
  cursor: pointer; color: #8f959e; font-size: 20px; line-height: 1;
}
.import-modal .modal-head .close-x:hover { color: #1f2329; }
.import-modal .tip {
  color: #646a73; font-size: 13px; line-height: 1.7; margin-bottom: 14px;
}
.import-modal .tip a { color: #1677ff; cursor: pointer; text-decoration: none; }
.import-modal .tip a:hover { text-decoration: underline; }
.import-modal .dropzone {
  border: 1.5px dashed #e5e6eb; border-radius: 10px;
  padding: 34px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: #fff;
}
.import-modal .dropzone:hover,
.import-modal .dropzone.dragover { border-color: #1677ff; background: #f7fbff; }
.import-modal .dropzone .dz-icon {
  display: flex; justify-content: center; margin-bottom: 10px;
}
.import-modal .dropzone .dz-icon svg { width: 26px; height: 26px; }
.import-modal .dropzone .dz-main { color: #1677ff; font-size: 14px; margin-bottom: 6px; }
.import-modal .dropzone .dz-sub { color: #8f959e; font-size: 12px; }
.import-modal .file-name {
  margin-top: 12px; color: #1f2329; font-size: 13px; text-align: center;
}

/* ========== 订单明细卡片 ========== */
.ord-items-cards { display: block; }
.ord-item-card {
  border: 1px solid #eef0f3; border-radius: 10px;
  padding: 12px; margin-bottom: 10px; background: #fff;
}
.ord-item-card .oic-line { margin-bottom: 10px; }
.ord-item-card .oic-line:last-child { margin-bottom: 0; }
.ord-item-card .oic-label {
  display: block; font-size: 12px; color: #8f959e; margin-bottom: 4px;
}
.ord-item-card .oic-inline {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
}
.ord-item-card .oic-field { flex: 1; min-width: 60px; }
.ord-item-card .oic-field input {
  width: 100%; height: 36px; padding: 0 8px;
  border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px;
}
.ord-item-card .oic-amount {
  height: 36px; line-height: 36px; font-weight: 600; color: #1f2329;
}
.ord-item-card .row-mat-mount .ss-input { height: 40px; font-size: 14px; }

/* ========== 客户 / 通用卡片 ========== */
.cust-cards { display: none; }
.cust-card {
  background: #fff; border-radius: 12px; padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
  cursor: pointer; position: relative;
}
.cust-card .cc-check {
  position: absolute; top: 10px; right: 10px; z-index: 2;
}
.cust-card .cc-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; padding-right: 6px;
}
.cust-card .cc-name { font-size: 16px; font-weight: 600; color: #1f2329; flex: 1; word-break: break-all; }
.cust-card .cc-level { flex-shrink: 0; }
.cust-card .cc-row { font-size: 13px; color: #646a73; margin-top: 6px; }
.cust-card .cc-detail {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid #f5f7fa;
  color: #1677ff; font-size: 14px;
}
.cust-card a { color: #1677ff; text-decoration: none; }
.cust-card a.danger { color: #f53f3f; }

/* ========== 角色权限 ========== */
.role-layout {
  display: flex; gap: 16px; align-items: flex-start;
}
.role-side {
  width: 240px; flex-shrink: 0;
  border: 1px solid #eef0f3; border-radius: 10px;
  padding: 10px; background: #fafbfc;
}
.role-side-title {
  font-size: 13px; color: #8f959e; padding: 4px 8px 8px;
}
.role-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: all .15s; margin-bottom: 4px;
}
.role-item:hover { background: #fff; }
.role-item.active { background: #1677ff; color: #fff; }
.role-item .ri-name { font-size: 14px; font-weight: 500; }
.role-item .ri-sub { font-size: 12px; color: #8f959e; margin-top: 2px; }
.role-item.active .ri-sub { color: rgba(255,255,255,0.8); }

.role-main {
  flex: 1; min-width: 0;
  border: 1px solid #eef0f3; border-radius: 10px;
  padding: 16px; background: #fff;
}

.role-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 14px; border-bottom: 1px solid #f0f0f0; margin-bottom: 14px;
  flex-wrap: wrap; gap: 10px;
}
.role-header .rh-name { font-size: 17px; font-weight: 600; }
.role-header .rh-desc { font-size: 13px; color: #8f959e; margin-top: 4px; }
.role-header .rh-actions { display: flex; gap: 8px; }

.perm-groups { display: flex; flex-direction: column; gap: 14px; }
.perm-group {
  border: 1px solid #eef0f3; border-radius: 8px; padding: 12px 14px;
}
.pg-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.pg-title { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.pg-count { font-size: 12px; color: #8f959e; }
.pg-body {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
}
.pg-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #1f2329; cursor: pointer;
  min-width: 120px;
}
.pg-item input { cursor: pointer; }

/* ========== 区域多选（对齐飞书） ========== */
.region-checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
  padding: 4px 0;
}
.region-check-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: #1f2329;
  cursor: pointer;
  padding: 4px 0;
}
.region-check-item input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: #1677ff;
  margin: 0;
  flex-shrink: 0;
}
.region-check-item span {
  line-height: 1.4;
}

/* ========== 财务统计卡 ========== */
.fin-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 14px;
}
.fin-stat {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid #f0f0f0;
}
.fin-stat .fs-label { font-size: 13px; color: #8f959e; margin-bottom: 6px; }
.fin-stat .fs-value { font-size: 22px; font-weight: 600; }

.form-hint { font-size: 12px; color: #8f959e; margin-top: 6px; line-height: 1.5; }

/* ========== 数据备份 ========== */
.backup-card {
  background: #fff; border-radius: 10px;
  border: 1px solid #eef0f3;
  padding: 18px 20px; margin-bottom: 16px;
}
.backup-card .bc-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}

.switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
}
.switch input { display: none; }
.switch .slider {
  position: absolute; cursor: pointer;
  inset: 0; background: #ccc; border-radius: 24px;
  transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .slider { background: #1677ff; }
.switch input:checked + .slider::before { transform: translateX(20px); }

.clear-group {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  background: #fafbfc; padding: 12px 14px; border-radius: 8px;
  border: 1px solid #eef0f3;
}
.clear-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer;
}

/* ========== 手机适配 ========== */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; z-index: 1000;
    transform: translateX(-100%); transition: transform .25s ease;
    height: auto;  
}
  .sidebar.open { transform: translateX(0); }
  .sidebar nav { display: block; }
  .sidebar nav a { padding: 14px 20px; font-size: 15px; }

  .mask {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.35); z-index: 999;
  }
  .mask.show { display: block; }

  .main-area { width: 100%; }

  .mobile-header {
    display: flex; align-items: center; gap: 12px;
    background: #fff; padding: 12px 14px; border-bottom: 1px solid #eee;
    position: sticky; top: 0; z-index: 10;
  }
  .mobile-header .hamburger {
    font-size: 20px; cursor: pointer; padding: 4px 8px; color: #1f2329;
  }
  .mobile-header .m-title { font-size: 16px; font-weight: 600; flex: 1; text-align: center; padding: 0 8px; }

  .topbar { display: none; }
  .content { padding: 12px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .hello { font-size: 18px; }
  .stat-card .value { font-size: 18px; }

  /* 表格/卡片切换 */
  .cust-table-wrap { display: none; }
  .cust-cards { display: block; }

  /* 财务统计卡 1 列 */
  .fin-stats { grid-template-columns: 1fr; }

  /* 弹窗 */
  .modal { padding: 16px; max-height: 92vh; border-radius: 12px; }
  .modal h3 { font-size: 16px; margin-bottom: 4px; }
  .modal .sub { font-size: 12px; margin-bottom: 12px; }
  .modal .form-item { margin-bottom: 10px; }
  .modal .form-item label { font-size: 12px; margin-bottom: 4px; }
  .modal .form-item input,
  .modal .form-item select { height: 36px; font-size: 14px; }
  .modal .btn-row {
    position: sticky; bottom: 0;
    background: #fff; padding-top: 10px;
    margin-top: 10px; border-top: 1px solid #f0f0f0;
  }

  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-item { width: 100%; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .flt-input { width: 100% !important; flex: none !important; }
  .filter-bar .btn-primary,
  .filter-bar .btn-default { width: 100%; }
  .date-btn-group { width: 100%; }
  .date-btn-group .date-btn { flex: 1; min-width: 0; }

  .batch-bar { flex-wrap: wrap; overflow-x: visible; }
  .batch-bar .batch-actions { flex-wrap: wrap; }
  .batch-bar .batch-actions button { flex: 1 1 auto !important; }

  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn-default,
  .page-actions .btn-primary { flex: 1; justify-content: center; }

  /* 角色权限：上下布局 */
  .role-layout { flex-direction: column; }
  .role-side {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
  }
  .role-main { padding: 12px; }
  .role-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .role-header .rh-actions { width: 100%; display: flex; gap: 8px; }
  .role-header .rh-actions button { flex: 1; }
  .pg-body { flex-direction: column; gap: 8px; }
  .pg-item { min-width: 100%; }

  /* 区域多选 1 列 */
  .region-checks { grid-template-columns: 1fr; gap: 10px; }

  /* 清空分组 1 列 */
  .clear-group { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
  .cust-cards { display: none; }
  .ord-items-cards { display: none; }
  .ss-sheet { display: none !important; }
}

@media (min-width: 1400px) {
  .sidebar { width: 240px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ========== 权限配置：照飞书 ========== */
.role-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.role-card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 12px;
  padding: 16px 18px;
  transition: all .2s;
}
.role-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.role-card .rc-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 10px;
}
.role-card .rc-name { font-size: 16px; font-weight: 600; }
.role-card .rc-code { font-size: 12px; color: #8f959e; margin-top: 4px; font-family: monospace; }
.role-card .rc-meta {
  font-size: 13px; color: #646a73; display: flex; gap: 18px; flex-wrap: wrap;
}
.role-card .rc-meta b { color: #1f2329; }
.role-card .rc-actions {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid #f5f7fa;
  display: flex; gap: 14px; font-size: 13px;
}
.role-card .rc-actions a {
  color: #1677ff; text-decoration: none; cursor: pointer;
}
.role-card .rc-actions a:hover { text-decoration: underline; }

/* 权限弹窗：折叠 */
.perm-accordion {
  max-height: 60vh;
  overflow-y: auto;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
}
.pa-group { border-bottom: 1px solid #f5f7fa; }
.pa-group:last-child { border-bottom: none; }
.pa-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 4px; cursor: pointer; user-select: none;
}
.pa-header:hover { background: #fafbfc; }
.pa-title { display: flex; align-items: center; gap: 8px; }
.pa-name { font-size: 14px; font-weight: 600; color: #1f2329; }
.pa-count { font-size: 12px; color: #8f959e; background: #f2f3f5; padding: 1px 8px; border-radius: 10px; }
.pa-arrow { color: #8f959e; font-size: 14px; }
.pa-body { padding: 0 4px 14px; }
.pa-item {
  display: flex; align-items: center;
  padding: 8px 0; font-size: 13px; cursor: pointer;
}
.pa-item input[type="checkbox"] {
  width: 16px; height: 16px; margin-right: 10px;
  accent-color: #1677ff; cursor: pointer;
}
.pa-item-name { color: #1f2329; flex: 1; }
.pa-item-code { color: #c4ccd8; font-size: 12px; font-family: monospace; }

@media (max-width: 768px) {
  .role-cards { grid-template-columns: 1fr; }
  .perm-accordion { max-height: 65vh; }
  .pa-item-code { display: none; }
}

/* =====添加手机右侧返回工作台的图标 =====*/
.mobile-header .home-btn {
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  color: #1f2329;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mobile-header .home-btn:active {
  opacity: 0.6;
}

/* ========== 显隐工具类 ========== */
.only-mobile { display: none; }

@media (max-width: 768px) {
  .only-desktop { display: none !important; }
  .only-mobile  { display: block; }
}

@media (min-width: 769px) {
  .only-mobile { display: none; }
}

/* ========== 订单卡片（移动端） ========== */
.ord-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
  position: relative;
  cursor: pointer;
}
.ord-card .oc-check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.ord-card .oc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-right: 30px;
  margin-bottom: 8px;
}
.ord-card .oc-customer {
  font-size: 16px;
  font-weight: 600;
  color: #1f2329;
  flex: 1;
}
.ord-card .oc-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f2f3f5;
  color: #646a73;
  flex-shrink: 0;
}
.ord-card .oc-status.pending { background: #fff7e6; color: #faad14; }
.ord-card .oc-status.audited { background: #e8f0ff; color: #1677ff; }
.ord-card .oc-status.shipped { background: #e8f8ef; color: #00b42a; }
.ord-card .oc-status.done { background: #f2f3f5; color: #646a73; }
.ord-card .oc-status.cancelled { background: #f2f3f5; color: #8f959e; text-decoration: line-through; }
.ord-card .oc-status.returned { background: #ffece8; color: #f53f3f; }
.ord-card .oc-no { font-size: 13px; color: #646a73; margin-bottom: 6px; }
.ord-card .oc-amount { font-size: 18px; font-weight: 600; color: #1677ff; margin-bottom: 8px; }
.ord-card .oc-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #8f959e;
  padding-top: 10px;
  border-top: 1px solid #f5f7fa;
}
.ord-card .oc-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid #f5f7fa;
  color: #1677ff;
  font-size: 13px;
}

.date-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-group .date-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #1f2329;
  min-width: 140px;
  outline: none;
}
.date-group .date-input:focus {
  border-color: #1677ff;
}
.date-group .date-to {
  color: #8f959e;
  font-size: 13px;
}

/* ========== 报表中心：手机适配补充 ========== */
.rpt-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.rpt-chart {
  width: 100%;
  height: 320px;
}
.rpt-table .data-table {
  min-width: 640px;
}

@media (max-width: 768px) {
  .rpt-two-col { grid-template-columns: 1fr; }
  .rpt-chart { height: 240px; }
  .rpt-table .data-table { min-width: 560px; }
}
@media (max-width: 420px) {
  .rpt-chart { height: 200px; }
  .rpt-table .data-table { min-width: 520px; }
}



/* ========== 回款弹窗：应收/明细列表行 ========== */
/* 说明：.form-item input 全局规则会撑坏列表里的输入框，这里用更高优先级覆盖 */
.form-item .pf-rec-row,
.form-item .pe-item-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #f2f3f5;
  width: auto !important;
  height: auto !important;
}
.form-item .pf-rec-row:last-child,
.form-item .pe-item-row:last-child { border-bottom: none; }

/* 复选框 */
.form-item .pf-rec-row input[type="checkbox"].pf-rec-chk {
  flex: 0 0 16px;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  padding: 0 !important;
  margin: 0;
  border: 1px solid #dcdfe6;
  border-radius: 3px;
  accent-color: #1677ff;
  cursor: pointer;
}

/* 中间信息区 */
.form-item .pf-rec-row .pf-rec-info {
  flex: 1 1 auto;
  min-width: 0;
}
.form-item .pf-rec-row .pf-rec-title {
  font-size: 13px;
  color: #1f2329;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-item .pf-rec-row .pf-rec-sub {
  font-size: 12px;
  color: #8f959e;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-item .pf-rec-row .pf-rec-balance {
  color: #f53f3f;
  font-weight: 600;
}

/* 金额输入框 */
.form-item .pf-rec-row input[type="number"].pf-rec-amt,
.form-item .pe-item-row input[type="number"].pe-item-amt {
  flex: 0 0 130px;
  width: 130px !important;
  height: 36px !important;
  padding: 0 10px !important;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 13px;
  text-align: right;
  box-sizing: border-box;
}
.form-item .pf-rec-row input[type="number"].pf-rec-amt:disabled,
.form-item .pe-item-row input[type="number"].pe-item-amt:disabled {
  background: #f5f7fa;
  color: #8f959e;
  cursor: not-allowed;
}


/* =========================================================
   订单详情弹窗：保持表格原样，窄屏横向滚动 + 物料列拉长
   ========================================================= */
@media (max-width: 768px) {
  /* 详情弹窗里的表格容器横向滚动 */
  .modal .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 给详情表格一个最小宽度，避免被压扁 */
  .modal .table-wrap .data-table {
    min-width: 720px;
    table-layout: auto;
  }

  /* 所有单元格不换行，避免文字互相挤压 */
  .modal .table-wrap .data-table th,
  .modal .table-wrap .data-table td {
    white-space:normal;
    vertical-align: middle;
  }

  /* 物料名称列（第一列）拉长；长名允许折行，避免超出容器 */
  .modal .table-wrap .data-table th:first-child,
  .modal .table-wrap .data-table td:first-child {
    min-width: 200px;
    max-width: 320px;
    white-space: normal;
    word-break: break-all;
  }
}

/* =========================================================
   财务详情弹窗：窄屏横向滚动（列少，min-width 调小）
   ========================================================= */
@media (max-width: 768px) {
  .modal .fin-detail-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal .fin-detail-table-wrap .data-table {
    min-width: 560px;
    table-layout: auto;
  }
  .modal .fin-detail-table-wrap .data-table th,
  .modal .fin-detail-table-wrap .data-table td {
    white-space: nowrap;
    vertical-align: middle;
  }
}
