@charset "utf-8";
/* 响应式样式 */

/* 各模块展示卡片流：手机端 2 列 → 超窄 1 列 */
@media (max-width: 640px) {
  .mod-row-2, .mod-row-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mod-row-1 { grid-template-columns: 1fr; }
  .mod-num b { font-size: 22px; }
  .mod-cat { max-width: 120px; }
}
@media (max-width: 400px) {
  .mod-row-2, .mod-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 264px; max-width: 82vw; height: 100vh; height: 100dvh; overflow-y: auto;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    padding: 14px; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: 2px 0 18px rgba(0, 0, 0, .28);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { padding: 4px 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .sidebar .nav { flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 10px 0; }
  .sidebar .nav-item, .sidebar .nav-group-title { min-height: 44px; display: flex; align-items: center; }
  /* 底部用户区在移动端显示，退出登录可用 */
  .sidebar-foot { display: block; margin-top: auto; padding-top: 12px; }
  .nav-toggle { display: inline-flex; }
  .main { width: 100%; }
  .content { padding: 12px; }
  /* 表单字号 ≥16px，避免 iOS 聚焦时自动放大页面 */
  input[type="text"], input[type="search"], input[type="number"], input[type="password"],
  input[type="datetime-local"], input[type="date"], input[type="time"], select, textarea { font-size: 16px; }
  /* 主要操作 / 导航 / 分页的触控目标不小于 44px（表格内紧凑按钮除外） */
  .filters .btn, .toolbar-right .btn, .pagination button { min-height: 44px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .maintenance-grid { grid-template-columns: 1fr; }
  .maint-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .focus-ops { flex-direction: column; }
  /* 卡片头部允许换行 */
  .card-head { flex-wrap: wrap; gap: 10px; }
  .card-head h3 { width: 100%; margin: 0; }
  .card-head .toolbar-right { width: 100%; justify-content: flex-start; }
  /* 筛选栏全宽换行 */
  .filters { width: 100%; }
  .filters > * { flex: 1 1 auto; min-width: 0; }
  .filters input[type="search"], .filters input[type="text"] { min-width: 120px; }
  /* 工具栏换行 */
  .toolbar-right { flex-wrap: wrap; }
  /* 表格字体缩小，允许横向滚动 */
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 备份/审计弹窗表格：窄屏保持最小宽度触发横向滚动，避免列被挤压 */
  #backup-table { min-width: 480px; }
  #audit-table { min-width: 760px; }
  /* 圆通账单明细表格：列多且含编辑输入框，窄屏保持完整列宽，横向滚动查看数据 */
  #billTable { min-width: 1040px; }
  #billTable .cell-input { padding: 6px 6px; font-size: 13px; }
  /* 圆通报销明细表格：窄屏同样保持列宽，横向滚动查看截图 */
  #expenseTable { min-width: 520px; }
  /* 批量操作栏换行 */
  .bulk-bar { flex-wrap: wrap; }
  .bulk-bar > * { flex: 0 0 auto; }
  /* 分页居中 */
  .pagination { justify-content: center; flex-wrap: wrap; gap: 4px; }
  /* 一体化卡片分页：取消桌面端「共 N 条」贴左的自动边距，手机端整体居中 */
  .card-table > .pagination > span:first-child { margin-right: 0; }
  /* 弹窗全宽（!important 覆盖各页面内联 max-width，保证手机端自适应） */
  .modal { max-width: calc(100vw - 24px) !important; }
  .modal-mask { padding: 12px; align-items: flex-start; }
  /* 弹窗表单网格单列 */
  .form-grid { grid-template-columns: 1fr; }
  /* 自定义选择框全宽 */
  .cs-wrapper { width: 100%; }
  .cs-trigger { min-height: 40px; height: 40px; }
  /* 按钮全宽可选 */
  .btn { min-height: 40px; }
  /* 统计卡片 */
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 22px; }
}

/* ==================== 双级类目导航 ==================== */
.nav-group { margin-top: 4px; }
.nav-group-title {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; border: 0; cursor: pointer; color: #c3cad9;
  font-size: 14px; letter-spacing: .5px; padding: 8px 10px 4px; text-align: left;
  text-transform: none; border-radius: 8px;
  /* 与 .nav-item 同一套口径：只过渡实际变化的背景色与文字色，避免整层重绘 */
  background-color: transparent;
  transition: background-color .15s, color .15s;
}
.nav-group-title:hover { background: rgba(255, 255, 255, .06); color: #cdd3de; }
.nav-group-title .nav-icon { font-size: 15px; width: 20px; }
.nav-item.nav-sub .nav-icon.sub { font-size: 13px; }

/* ==================== 侧边栏用户区 ==================== */
.user-mini { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
}
.user-name { font-size: 12px; color: #cdd3de; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name i { font-style: normal; font-size: 10px; color: var(--success); border: 1px solid rgba(34,197,94,.4); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.btn-logout {
  width: 100%; padding: 7px 0; border: 1px solid rgba(255,255,255,.14); border-radius: 7px;
  background: transparent; color: #cbd2de; font-size: 12px; cursor: pointer;
  transition: background-color .15s, color .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-change-pwd {
  width: 100%; padding: 7px 0; margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 7px;
  background: transparent; color: #cbd2de; font-size: 12px; cursor: pointer;
  transition: background-color .15s, color .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-change-pwd:hover { background: rgba(255,255,255,.08); color: #fff; }
.foot-btn-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; }
.ver { margin-top: 8px; text-align: center; font-size: 10px; color: #5a6273; }

/* ==================== 系统设置：标签页 / 状态 ==================== */
.settings-tabs.sub { margin-bottom: 12px; }
.form-hint { margin: 6px 0 0; font-size: 12px; color: var(--text-3); }
.form-group { margin: 16px 0; }
.group-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 10px; font-weight: 600; }

/* ==================== 账号管理：权限勾选 ==================== */
/* 分段控件（批量操作按钮组） */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button {
  padding: 4px 10px; font-size: 12px; line-height: 1.5; border: 0;
  border-right: 1px solid var(--border); background: #fff; color: var(--text-2);
  cursor: pointer; transition: background-color .15s, color .15s; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #eef3ff; color: var(--primary); }
.seg button.seg-danger:hover { background: #fef2f2; color: var(--danger); }

.perm-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding: 8px 12px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
}
.perm-toolbar-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.perm-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.perm-group { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.perm-group-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 9px 12px; margin: 0; background: #f5f8ff; cursor: pointer; user-select: none;
  transition: background-color .15s;
}
.perm-group-title:hover { background: #eef3ff; }
.perm-group-title:first-child { margin-top: 0; }
.perm-caret { font-size: 12px; color: var(--text-3); width: 14px; text-align: center; flex: none; }
.perm-title-right { margin-left: auto; display: flex; align-items: center; }
.perm-group.perm-collapsed .perm-group-body { display: none; }
.perm-group-body {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 12px;
  background: #fcfdff;
}
.perm-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px;
}
.perm-item:hover { border-color: var(--primary); }
.perm-select {
  min-width: 84px; padding: 4px 6px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
.perm-select:disabled { opacity: .5; cursor: not-allowed; }
.perm-ic { font-size: 14px; }
.perm-lb { flex: 1; min-width: 0; }
.perm-cell { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==================== 一级类目收缩导航 ==================== */
.nav-caret { margin-left: auto; font-size: 11px; transition: transform .18s; color: #6b7387; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group-body { overflow: hidden; max-height: 300px; transition: max-height .2s ease; }
.nav-group.collapsed .nav-group-body { max-height: 0; }
.nav-item.nav-sub { padding-left: 26px; white-space: nowrap; }

.fields-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
/* select 字段选项编辑（独占一行，不挤压其他列） */
.fc-options-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px 10px 56px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}
.fc-options-label { font-size: 12px; color: var(--text-3); flex: none; }
.fc-opt-list { display: flex; flex-wrap: wrap; gap: 4px; }
.fc-opt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 12px; background: #eef3ff; color: var(--primary); border-radius: 12px; }
.fc-opt-del { border: 0; background: transparent; color: var(--text-3); cursor: pointer; line-height: 1; padding: 0 2px; display: flex; align-items: center; justify-content: center; }
.fc-opt-del:hover { color: var(--danger); }
.fc-opt-input { width: 140px; padding: 4px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; }

.fields-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.fields-row:first-child { border-top: 0; }
.fields-row:hover { background: #f7f9fd; }
.fields-head { background: var(--bg); font-size: 12px; color: var(--text-2); font-weight: 600; }
.fc-order { width: 64px; display: flex; gap: 4px; }
.fc-btn { width: 24px; height: 24px; border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; color: var(--text); }
.fc-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.fc-btn:disabled { opacity: .4; cursor: not-allowed; }
.fc-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.fc-label { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.fc-label:focus { border-color: var(--primary); outline: none; }
.fc-tag { font-size: 10px; color: var(--primary); background: #e8efff; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.fc-tag.builtin { color: var(--text-3); background: var(--bg); }
.fc-type { width: 120px; }
.fc-type-select { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.fc-type-static { font-size: 12px; color: var(--text-2); }
.fc-sw { width: 46px; text-align: center; }
.fc-sw input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.fc-op { width: 70px; text-align: right; }
.fields-add { margin-top: 14px; padding: 14px; background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fields-add input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; flex: 1; min-width: 180px; }
.fields-add select { padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ==================== 类目管理 ==================== */
.category-tree { margin-top: 6px; }
.cat-node { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.cat-caret { font-size: 12px; color: var(--text-3); width: 14px; text-align: center; flex: none; user-select: none; }
.cat-level1 > .cat-row { cursor: pointer; }
.cat-level1 > .cat-row:hover { background: #eef3ff; }
.cat-level1.cat-collapsed > .cat-children { display: none; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.cat-level1 > .cat-row { background: #f5f8ff; }
.cat-level2 > .cat-row { background: #fff; }
.cat-level2 { margin-left: 26px; border-color: #e6ebf5; }
.cat-node.cat-off { opacity: .62; }
.cat-icon { font-size: 16px; width: 22px; text-align: center; }
.cat-name { font-weight: 600; font-size: 14px; }
.cat-count { font-size: 12px; color: var(--text-3); background: var(--bg); border-radius: 10px; padding: 2px 8px; }
.cat-badge { font-size: 10px; border-radius: 4px; padding: 1px 6px; }
.cat-badge-l1 { color: #4338ca; background: #e0e7ff; }
.cat-badge-l2 { color: #047857; background: #d1fae5; }
.cat-status { flex: 1; text-align: right; }
.tag-off { font-size: 11px; color: #b45309; background: #fef3c7; border-radius: 4px; padding: 1px 6px; }
.cat-actions { display: flex; gap: 6px; }
.cat-children { padding: 4px 8px; }

/* ==================== 弹窗排版 ==================== */
.modal-sm { max-width: 520px; }
.modal-lg { max-width: 720px; }
.modal-body { padding: 14px 16px; max-height: 72vh; overflow-y: auto; }
.modal .modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
}
/* 表单弹窗：按钮区在 <form> 内，抵消 form 左右/下方内边距；分隔线上方间隔与无表单弹窗一致（body 底部 14px + 边距 10px = 24px） */
.modal form > .modal-foot {
  margin: 24px -22px -22px;
}
/* 批量粘贴列表表头：空态不占位，避免分隔线上方间隔偏大 */
.bp-rows-head:empty { display: none; }
/* AI 配置弹窗（form 内边距为 0）恢复标准 foot 间距 */
#ai-config-form > .modal-foot {
  margin: 10px 0 0;
}
.modal-subinfo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f8ff;
  border: 1px solid #e3ebff;
}
.modal-subinfo .mod-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px;
  background: #e0e7ff; color: #4338ca;
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.modal-subinfo .mod-desc { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.panel-section { margin-top: 14px; }
.panel-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.panel-divider { border-top: 1px dashed var(--border); margin: 16px 0 0; }
.status-add input { flex: 1; min-width: 180px; }
.status-add { display: flex; gap: 8px; align-items: center; width: 100%; }

/* ==================== 首页排版 ==================== */
.home-layout { display: flex; flex-direction: column; margin-top: 6px; }
.layout-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.layout-title {
  font-size: 14px; font-weight: 600;
  padding: 10px 12px;
  background: #f5f8ff;
  cursor: pointer;
  transition: background-color .15s;
  display: flex; align-items: center; gap: 10px;
}
.layout-title:hover { background: #eef3ff; }
.layout-title .cat-caret {
  font-size: 12px; color: var(--text-3);
  width: 14px; text-align: center; flex: none;
  user-select: none;
}
/* 折叠：隐藏标题之外的所有内容（首页排版的 .layout-list、钉钉通知的 .form-item 等通用） */
.layout-section.collapsed > :not(.layout-title) { display: none !important; }
/* 展开后内容区左右内边距，和标题对齐；.layout-body 为分区内通用内容容器（如限流网格、物流商 chips） */
.layout-section > .form-item,
.layout-section > #dt-modules,
.layout-section > #dt-bots,
.layout-section > #dt-bot-head,
.layout-section > .layout-body,
.layout-section > .layout-desc { padding-left: 12px; padding-right: 12px; }
/* 标题与首个内容之间统一 12px 顶部间距（相邻兄弟即标题后的第一个元素，含以 .layout-desc 开头者，覆盖其默认 8px） */
.layout-section > .layout-title + * { padding-top: 12px; }
/* 内容区底部留 padding，最后一个内容容器不贴边 */
.layout-section > .form-item:last-child,
.layout-section > #dt-modules:last-child,
.layout-section > #dt-bots:last-child,
.layout-section > .layout-body:last-child { padding-bottom: 12px; }
/* 钉钉通知链接/物流轨迹限流网格等多列输入框，手机上变单列 */
@media (max-width: 640px) {
  .dt-link-grid { grid-template-columns: 1fr !important; }
  .dt-style-grid { grid-template-columns: 1fr !important; }
  .trk-limit-grid { grid-template-columns: 1fr !important; }
}
.layout-desc {
  font-size: 12px; color: var(--text-3);
  margin: 0; padding: 8px 12px 4px;
  background: #fff;
}
/* form-item 自身已带左右内边距，其内部说明段不再重复 12px 缩进，仅保留上下间距 */
.form-item > .layout-desc { padding-left: 0; padding-right: 0; }
/* 说明段作为分区最后一个元素时，底部留白与其他末尾容器统一为 12px */
.layout-section > .layout-desc:last-child { padding-bottom: 12px; }
.layout-list {
  border: none; border-radius: 0;
  overflow: hidden;
  padding: 4px 8px 8px;
  background: #fff;
}
.layout-group + .layout-group { border-top: 1px solid var(--border); }
.layout-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #fff;
}
.layout-row + .layout-row { border-top: 1px solid var(--border); }
.lr-cat { background: #f5f8ff; font-weight: 600; cursor: pointer; border-radius: 6px; transition: background-color .15s; }
.lr-cat:hover { background: #eef3ff; }
.lr-sub { padding-left: 46px; background: #fbfcfe; }
.lr-fold {
  width: 16px; text-align: center; flex: none;
  color: var(--text-3); font-size: 12px; user-select: none; pointer-events: none;
}
.lr-icon { font-size: 15px; width: 22px; text-align: center; }
.lr-name { flex: 1; min-width: 0; font-size: 14px; }
.lr-badge { font-size: 10px; border-radius: 4px; padding: 1px 6px; color: #4338ca; background: #e0e7ff; }
.lr-sub .lr-badge { color: #047857; background: #d1fae5; }
.lr-sw { width: 46px; display: flex; justify-content: center; }
.lr-op { display: flex; gap: 6px; }
.layout-empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 13px; }
/* 开关（switch） */
.switch {
  position: relative; display: inline-block;
  width: 38px; height: 22px; cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0;
  background: #ccd3df; border-radius: 22px;
  transition: background-color .18s;
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .18s;
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:disabled + i { opacity: .5; cursor: not-allowed; }

/* 表单字段标题 label 的命中区：在 flex 纵向容器（.form-item / .form-group / .fc-calc-item
   等）里 label 默认被拉伸到整行，文字右侧的大片空白也属于 label，而 label 通过 for 关联
   控件，点空白会聚焦/弹出关联输入框，开关字段则直接切换。统一收缩到文字宽度并关闭指针
   事件：标题只是说明文字，点它（文字本身或两侧空白）都不应有任何反应，只有控件可点。
   例外：label 自身包裹控件（.switch / .dt-check-chip / 勾选项等，整块可点本就是设计）、
   控件是兄弟元素的整块上传框（kb.php 投喂弹窗 #feed-drop-zone，其 input 在 label 外）、
   左文字右按钮的 .ui-flex-between-wrap、分组标题 .group-label 保持原样 */
label:not(:has(input, select, textarea)):not(#feed-drop-zone):not(.ui-flex-between-wrap):not(.group-label) {
  align-self: flex-start;
  pointer-events: none;
}

/* 弹窗内「通知时间」开关 + 日期选择器 */
.reminder-control-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 36px;
}
.reminder-date-wrap {
  display: flex; align-items: center; gap: 10px;
  animation: reminderSlide .2s ease-out;
}
@keyframes reminderSlide {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.reminder-date-wrap input[type="date"] {
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
  color: var(--text-1); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.reminder-date-wrap input[type="date"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

/* ==================== 提醒中心批量操作 ==================== */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.bulk-tip { font-size: 13px; color: var(--text-2); margin-right: 4px; }
.bulk-tip b { color: var(--primary); }
.bulk-bar .status-select { min-width: auto; }
.bulk-bar .cs-wrapper { width: auto; min-width: auto; }
/* 复选框列（表头 th 与动态渲染的 td 都带 .th-check）：选择器写为 .data-table .th-check 以提高优先级，
   否则 text-align:center 会被 style.css 的 .data-table th/td{text-align:left} 覆盖而失效 */
.data-table .th-check { width: 40px; text-align: center; }
.data-table .th-check input[type="checkbox"],
.row-check { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
#reminder-table tbody tr.row-selected { background: #f0f6ff; }
#reminder-table tbody tr.row-selected:hover { background: #eaf2ff; }

/* ==================== 类目弹窗 · 图标选择器 ==================== */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  max-height: 200px;
  overflow-y: auto;
}
.icon-opt {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1;
  font-size: 22px; line-height: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.icon-opt:hover { border-color: var(--primary); background: #f0f6ff; }
.icon-opt.active { border-color: var(--primary); background: #e8f1ff; box-shadow: 0 0 0 2px rgba(64,128,255,.25); }
#cat-modal .form-item { margin-bottom: 16px; }
#cat-modal .form-item label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text-1); }
#cat-modal #cat-name-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
#cat-modal #cat-name-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(64,128,255,.15); }

/* ==================== 栏目配置 · 是否提醒开关 ==================== */
.reminder-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 0 0 12px;
  border: 1px solid #e6ecf5; border-radius: 8px;
  background: #f7faff;
}
.reminder-toggle-text { font-size: 13px; color: var(--text-2); text-decoration: none; }
.reminder-toggle .switch { display: inline-flex; }

/* ==================== 类目管理 · 弹窗内 tab（基本信息 / 栏目配置） ==================== */
.modal-tabs {
  display: flex; gap: 8px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.modal-tabs .mtab {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.modal-tabs .mtab:hover { color: var(--text); background: #f5f7fa; }
.modal-tabs .mtab.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--info-bg);
  border-color: var(--border);
}
#cat-modal .modal-body { max-height: 62vh; overflow: auto; }
#cat-tab-basic { padding: 4px 0; }
#cat-tab-fields { padding: 4px 0; }

/* ==================== 加载占位（骨架屏） ==================== */
.skeleton-tip {
  color: var(--text-3); font-size: 13px; padding: 28px 16px;
  text-align: center; letter-spacing: .5px;
}
.stat-grid .skeleton-tip { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .todo-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .todo-actions {
    opacity: 1;
  }
  /* AI 配置弹窗：开关行允许换行，switch 固定宽度不被挤压 */
  .reminder-control-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .reminder-control-row .switch {
    flex: 0 0 auto;
  }
  .reminder-control-row .hint {
    flex: 1 1 100%;
  }
}
.search-tip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.search-keywords { color: var(--primary); font-weight: 600; }
.search-summary { color: var(--text-3); }
.search-results { display: flex; flex-direction: column; gap: 16px; }
.search-group .card-head { display: flex; align-items: center; justify-content: space-between; }
.search-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-3);
}
.search-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .6; }
.search-empty p { font-size: 14px; margin: 0; }
.cell-tracking { font-family: 'Consolas', 'Monaco', monospace; font-weight: 600; color: var(--text); }
.cell-category { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.cell-remark { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.status-tag {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-done { background: #d1fae5; color: #065f46; }
.link-btn {
  font-size: 12px; color: var(--primary); text-decoration: none;
  padding: 4px 10px; border-radius: 6px;
  transition: background-color .15s;
}
.link-btn:hover { background: var(--info-bg); text-decoration: none; }

/* ==================== 智能客服 ==================== */
.support-wrap { max-width: 860px; margin: 0 auto; }
.support-chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; padding: 0; overflow: hidden; }
.support-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #f0f5ff, #f8fbff);
  flex: none;
}
.support-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #5b5bf7, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex: 0 0 42px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .25);
}
.support-head-info { flex: 1; min-width: 0; }
.support-title { font-size: 15px; font-weight: 600; color: var(--text); }
.support-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.support-clear-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-3);
  padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; flex: none;
  white-space: nowrap; transition: color .15s, border-color .15s, background-color .15s;
}
.support-clear-btn:hover { color: #e5484d; border-color: #f5c6c9; background: #fff5f5; }

.support-messages {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg);
}
.msg { display: flex; align-items: flex-start; gap: 10px; max-width: 82%; }
/* 用户提问靠右展示（气泡在左、头像在最右，微信式布局） */
.msg-user { flex-direction: row-reverse; margin-left: auto; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex: 0 0 32px; background: #fff;
  border: 1px solid var(--border);
}
.msg-user .msg-avatar { background: #eef3ff; border-color: #dbe6ff; }
.msg-bubble {
  padding: 11px 15px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.7; word-break: break-word;
  background: #fff; border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  white-space: pre-wrap;
}
.msg-bot .msg-bubble { border-top-left-radius: 4px; }
.msg-user .msg-bubble {
  background: var(--primary); color: #fff;
  border-color: var(--primary); border-top-right-radius: 4px;
}

/* 打字中三点动画 */
.typing-bubble { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; }
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #9ca3af; display: inline-block;
  animation: typingBlink 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBlink {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

.support-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--card); flex: none;
}
.support-input input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  outline: none; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.support-input input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.support-input .btn { flex: none; }
.support-channel-select {
  flex: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 8px; font-size: 13px; font-family: inherit;
  background: #fff; color: var(--text); outline: none; cursor: pointer;
  max-width: 110px; transition: border-color .15s;
}
.support-channel-select:focus { border-color: var(--primary); }

/* 渠道管理列表 */
.channel-list .channel-item:last-child { border-bottom: none; }
.channel-list .channel-item:hover { background: var(--bg-hover); }
.channel-list .channel-item-editing:hover { background: transparent; }
.btn-icon { margin-right: 2px; }

/* ==================== 物流知识管理 ==================== */
.kb-kws {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: none;
  line-height: 1.6;
  overflow: hidden;
}
.kb-kw {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef3ff 0%, #f0f5ff 100%);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.15);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  flex-shrink: 0;
}
.kb-kw:hover {
  background: linear-gradient(135deg, #e0ebff 0%, #e8f0ff 100%);
  border-color: rgba(99, 102, 241, 0.3);
}
.kb-kw-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  background: #f5f7fa;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  cursor: help;
  transition: background-color .15s ease, color .15s ease;
  flex-shrink: 0;
}
.kb-kw-more:hover {
  background: #eef1f5;
  color: var(--text);
}
.kb-q { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 下拉菜单（导出/导入/数据管理等）：弹层宽度跟随触发按钮宽度 */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  /* 与触发按钮的间距：全站浮层统一 2px（下拉菜单 / 选择框 / 日期面板 / 行内菜单同一口径） */
  position: absolute; right: 0; top: calc(100% + 2px);
  /* 与触发按钮同宽：父级 .dropdown 的宽度就是按钮宽度，故用 100%；
     box-sizing 保证内边距算在宽度内，不额外撑宽 */
  width: 100%; box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 30;
}
.dropdown-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  color: var(--text); border-radius: 6px; cursor: pointer;
  transition: background-color .15s, color .15s;
  /* 菜单宽度等于按钮宽度后，长文案内容区偏窄：
     固定单行显示，超出部分落在右侧内边距内，避免折成两行撑高菜单 */
  white-space: nowrap;
}
.dropdown-item:hover { background: var(--info-bg); color: var(--primary); }

/* 数据管理下拉：左对齐按钮，文字与按钮对齐（宽度已由 .dropdown-menu 统一为按钮宽度） */
.dm-menu {
  right: auto;
  left: 0;
}
/* 按钮靠近视口右缘时由 JS 切换为右对齐（向左展开），避免超出视口产生横向滚动 */
.dm-menu.dm-menu-right {
  left: auto;
  right: 0;
}
.dm-menu .dropdown-item {
  padding-left: 16px;
  padding-right: 16px;
}

/* ==================== 右下角浮动智能客服 ==================== */
.support-widget {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 0;
  z-index: 1000;
  pointer-events: none; /* 容器不拦截事件，子元素各自开启 */
}
/* 贴边机器人头：默认只露出左侧一半，鼠标悬停滑出完整图标 */
.support-widget-btn {
  position: fixed;
  right: -28px; /* 直径 56px，露一半（28px） */
  top: 46%;
  transform: translateY(-50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b5bf7, #8b5cf6);
  border: 2px solid #fff;
  box-shadow: 0 3px 12px rgba(99, 102, 241, .4);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1;
  pointer-events: auto;
  transition: right .28s ease, box-shadow .2s ease;
  z-index: 1001;
}
.support-widget-btn:hover,
.support-widget-btn.is-hover {
  right: 0; /* 完整滑出 */
  box-shadow: 0 5px 18px rgba(99, 102, 241, .5);
}
/* 悬停时左侧浮出的「智能客服」提示气泡 */
.support-widget-btn::after {
  content: '智能客服';
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #5b5bf7;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease .05s;
}
.support-widget-btn:hover::after,
.support-widget-btn.is-hover::after { opacity: 1; }
/* 客服面板：点击头像后从右边缘贴边弹出 */
.support-widget-panel {
  position: fixed;
  right: 18px;
  top: 46%;
  transform: translateY(-50%);
  width: 360px; max-width: calc(100vw - 60px);
  height: 520px; max-height: calc(100vh - 60px);
  background: #fff; border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, .18);
  display: flex; flex-direction: column; overflow: hidden;
  pointer-events: auto;
  z-index: 1000;
}
.support-widget-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #f0f5ff, #f8fbff);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.support-widget-title { font-size: 14px; font-weight: 600; color: var(--text); }
.support-widget-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.support-widget-head-right { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.support-widget-min {
  width: 26px; height: 26px; border-radius: 6px;
  border: 0; background: transparent; color: var(--text-3);
  font-size: 16px; cursor: pointer; line-height: 1; flex: none;
}
.support-widget-min:hover { background: rgba(15, 23, 42, .06); color: var(--text); }
.support-widget-clear {
  width: 26px; height: 26px; border-radius: 6px;
  border: 0; background: transparent; color: var(--text-3);
  font-size: 14px; cursor: pointer; line-height: 1; flex: none;
}
.support-widget-clear:hover { background: rgba(15, 23, 42, .06); color: #e5484d; }
.support-widget-messages {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg);
}
.support-widget-messages .msg { max-width: 92%; }
.support-widget-messages .msg-avatar { width: 28px; height: 28px; font-size: 14px; flex-basis: 28px; }
.support-widget-messages .msg-bubble { font-size: 13px; padding: 9px 13px; }
.support-widget-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
  background: var(--card); flex: none;
}
.support-widget-input input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  outline: none; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.support-widget-input input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.support-widget-input .btn { flex: none; padding: 8px 14px; font-size: 13px; }

/* 知识库 · 关键词自动生成 */
.kw-row { display: flex; align-items: center; gap: 8px; }
.kw-row input { flex: 1; min-width: 0; }
.kw-row .btn { flex: none; white-space: nowrap; }
#kb-kw-auto-tip { color: var(--primary); font-weight: 500; }

/* ==================== 移动端深度适配（≤640px） ==================== */
@media (max-width: 640px) {
  /* 内容区更紧凑 */
  .content { padding: 10px; }
  /* 卡片内边距缩小 */
  .card { padding: 14px; margin-bottom: 12px; }
  .card-head { margin-bottom: 10px; padding: 0; }
  /* 模块筛选工具栏：手机端允许换行，防止横向溢出 */
  .module-toolbar { flex-wrap: wrap; gap: 8px; }
  .module-toolbar > * { flex: 0 0 auto; }
  /* 表格更紧凑 */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  /* 知识库表格列多：手机端固定最小宽度，横向滚动查看，避免列被挤压截断 */
  #kb-table { min-width: 780px; }
  /* 顶部工具栏（窄屏）：压缩标题与右侧按钮，全局搜索仅图标 */
  .topbar { padding: 0 12px; gap: 8px; }
  .page-title { max-width: 30vw; font-size: 15px; }
  .topbar-actions { gap: 4px; }
  .global-search-wrap { margin-left: 0; gap: 2px; }
  .global-search-btn { width: 38px; height: 38px; padding: 0; font-size: 0; gap: 0; justify-content: center; }
  .global-search-btn svg { width: 18px; height: 18px; margin: 0; }
  /* 弹窗全宽贴边 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { max-width: 100vw !important; border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; }
  .modal-head { padding: 14px 16px; }
  .modal form, .modal-body { padding: 14px 16px; }
  .modal .modal-foot { padding: 14px 16px; margin-top: 10px; }
  /* 表单弹窗：移动端分隔线上方间隔与无表单弹窗一致（24px） */
  .modal form > .modal-foot { margin: 24px -14px -14px; }
  /* 确认/提示弹窗：移动端同样抵消 .app-modal form 内边距（左右 20px / 底部 10px），与其他弹窗一致 */
  .app-modal .modal form > .modal-foot { margin: 24px -20px -10px; }
  #ai-config-form > .modal-foot { margin: 10px 0 0; }
  /* 弹窗按钮全宽 */
  .modal-foot .btn { flex: 1; min-height: 44px; }
  /* 表单元素 */
  .form-item { gap: 6px; margin-bottom: 12px; }
  .form-item label { font-size: 13px; }
  input, select, textarea { min-height: 44px; }
  /* 自定义选择框 */
  .cs-trigger { min-height: 44px; height: 44px; padding: 8px 12px; font-size: 15px; }
  .cs-dropdown { max-width: calc(100vw - 24px); }
  .cs-list { max-height: 40vh; }
  .cs-item { padding: 12px 14px; font-size: 15px; min-height: 44px; display: flex; align-items: center; }
  .cs-search-input { min-height: 40px; font-size: 15px; }
  /* 按钮 */
  .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
  .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  /* 筛选栏 */
  .filters { gap: 8px; }
  .filters .cs-wrapper { width: 100%; }
  .filters input[type="search"], .filters input[type="text"] { width: 100%; }
  .filters .btn { width: 100%; }
  /* 筛选条件：整行撑满，控件自适应 */
  .filters .fc-item { width: 100%; }
  .filters .fc-item input.filter-field,
  .filters .fc-item .cs-wrapper,
  .filters .fc-item .dp-wrap { width: auto; flex: 1; min-width: 0; }
  /* 工具栏 */
  .toolbar-right { width: 100%; gap: 8px; }
  /* 智能客服头部（窄屏）：收紧间距、头像缩小、隐藏副标题，标题保留完整 */
  .support-head { padding: 12px 12px; gap: 8px; flex-wrap: wrap; }
  .support-avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: 18px; }
  .support-sub { display: none; }
  .link-more { font-size: 12px; }
  .support-clear-btn { padding: 4px 10px; font-size: 12px; }
  /* 手机端：头部按钮只留图标，隐藏文字 */
  .support-head-right .btn span { display: none; }
  .support-head-right .btn { padding: 4px 8px; font-size: 12px; }
  .toolbar-right .btn { flex: 1; }
  /* 批量操作栏 */
  .bulk-bar { padding: 10px 12px; gap: 8px; }
  .bulk-bar .cs-wrapper { width: 100%; }
  .bulk-bar .btn { flex: 1; }
  /* 分页 */
  .pagination { gap: 4px; }
  .pagination button { min-width: 36px; min-height: 36px; padding: 6px 10px; font-size: 13px; }
  /* 统计卡片 */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 12px; }
  /* 数据维护：健康检查统计卡窄屏单列 */
  .maint-stats-grid { grid-template-columns: 1fr; }
  /* 物流聚合导航 - 平台卡片 */
  .nav-platform-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nav-platform-card { padding: 12px 10px; }
  .nav-platform-name { font-size: 13px; }
  .nav-platform-url { font-size: 11px; }
  /* 导航页面头部 */
  .nav-page-head { flex-direction: column; gap: 12px; padding: 16px; }
  .nav-page-title h1 { font-size: 20px; }
  /* 邮编分区 - 上传区域 */
  .zoning-upload-area { padding: 24px 16px; }
  /* 利润计算 */
  .result-table { font-size: 12px; }
  .result-table th, .result-table td { padding: 6px 8px; }
  /* 发票页面 */
  .goods-table { font-size: 12px; }
  .goods-table th, .goods-table td { padding: 6px 4px; }
  .goods-select-trigger { min-height: 36px; font-size: 13px; padding: 4px 8px; }
  .goods-table .form-input { padding: 6px 8px; font-size: 13px; }
  /* 快捷工具（首页） */
  .quick-tool { padding: 9px 10px; gap: 8px; }
  .quick-tool .qt-icon { width: 28px; height: 28px; flex-basis: 28px; font-size: 15px; }
  /* 批量填写运单号：行列表手机端堆叠为单列 */
  .bp-rows-head { display: none; }
  .bp-row { grid-template-columns: 1fr !important; gap: 4px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
  .bp-row:last-child { border-bottom: 0; }
  .bp-row .bp-tracking { background: transparent; }
  .bp-cell { flex-direction: column; align-items: stretch; }
  .bp-cell::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted, #64748b); margin: 4px 0 2px; }
}

/* ==================== 小屏手机（≤380px） ==================== */
@media (max-width: 380px) {
  .nav-platform-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .modal-foot { flex-direction: column; }
  .modal-foot .btn { width: 100%; }
}

/* ==================== 移动端深度适配补充 ==================== */

/* 弹窗标题长文本截断：避免手机端标题挤压右侧关闭按钮 */
.modal-head h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 手机端弹窗整体滚动时，标题栏固定在顶部不滚走（配合 ≤640px .modal{overflow-y:auto}） */
@media (max-width: 640px) {
  .modal-head { position: sticky; top: 0; z-index: 2; }

  /* 设置页-字段配置行窄屏换行：标签输入框占满一行，类型/开关/操作换行排列，避免横向挤压 */
  .fields-row { flex-wrap: wrap; gap: 6px; padding: 10px 10px; }
  .fields-row .fc-name { flex-basis: 100%; }
  .fields-row .fc-type { width: auto; flex: 1; min-width: 100px; }
  .fields-row .fc-op { width: auto; }
  .fc-options-row { padding-left: 12px; }
}

/* 设置页-首页排版 / 类目管理 / 物流规则：窄屏自适应（行内容换行堆叠，不整块横向滚动） */
@media (max-width: 860px) {
  #tab-home .home-layout,
  #tab-categories .category-tree,
  #tab-logistics .category-tree,
  #logistics-rules-list {
    overflow-x: visible;
  }
  #tab-home .layout-list,
  #tab-categories .cat-node,
  #tab-logistics .cat-node {
    min-width: 0;
  }
  /* 类目管理 / 物流规则：节点行换行，名称占行、操作按钮整行排布 */
  #tab-categories .cat-row,
  #tab-logistics .cat-row {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  #tab-categories .cat-name,
  #tab-logistics .cat-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    line-height: 1.5;
  }
  #tab-categories .cat-actions,
  #tab-logistics .cat-actions {
    flex-basis: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  /* 首页排版：布局行换行，开关留在首行、上移/下移按钮整行排布 */
  #tab-home .layout-row {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  #tab-home .lr-name {
    flex: 1 1 auto;
    min-width: 0;
  }
  #tab-home .lr-op {
    flex-basis: 100%;
    display: flex;
    gap: 6px;
  }
  /* 展开的布局行撑开卡片，需放开 layout-section 的裁剪，滚动由外层 home-layout 接管 */
  #tab-home .layout-section { overflow: visible; }
}

/* iOS Safari 地址栏/底部横条适配：100dvh 优于 100vh（地址栏收起时 100vh 会超出可视区），
   先声明 100vh 兜底再声明 100dvh，不支持的浏览器自动忽略后者 */
.app-shell { min-height: 100vh; min-height: 100dvh; }
.support-chat { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
.support-widget-panel { max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px); }

/* iOS 安全区（刘海 / 底部横条）内边距适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .content { padding-bottom: max(44px, env(safe-area-inset-bottom)); }
  .modal-mask { padding-bottom: env(safe-area-inset-bottom); }
  .modal .modal-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .app-modal .modal form > .modal-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .sidebar-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

/* 钉钉发送前预览弹窗：手机端竖排适配 */
@media (min-width: 641px) {
  .dt-preview-modal .modal-head {
    padding: 16px 20px;
  }
  .dt-preview-modal .modal-body {
    padding: 16px 20px;
  }
  .dt-preview-modal .modal-foot {
    padding: 14px 20px;
  }
}
@media (max-width: 640px) {
  .dt-rec-row, .dt-batch-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .dt-rec-row > span:first-child {
    font-size: 13px !important;
    font-weight: 600;
  }
  /* 字段行：checkbox+标签+按钮 在一行，输入框独占一行 */
  .dt-rec-row > div, .dt-batch-row > div {
    flex-wrap: wrap;
    gap: 6px;
  }
  .dt-rec-row .dt-fval, .dt-batch-row .dt-batch {
    width: 100% !important;
    flex: 1 1 100%;
  }
  .dt-batch-row > span:first-child {
    font-size: 13px;
    font-weight: 600;
  }
  /* 手机端按钮最小高度满足触控 */
  .dt-preview-modal .btn {
    min-height: 36px !important;
    padding: 6px 14px !important;
  }
}

/* 钉钉预览弹窗：紧凑输入框和按钮 */
.dt-preview-modal input[type="text"] {
  padding: 4px 8px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}
/* 消息标题/结尾提示语：用工作台标准输入框样式，不继承紧凑样式 */
.dt-preview-modal input.form-input {
  padding: 8px 12px !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  min-height: 40px;
}
.dt-preview-modal input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0 !important;
  vertical-align: middle;
  position: relative;
  top: 1px;
}
.dt-preview-modal .dt-rec-row,
.dt-preview-modal .dt-batch-row {
  min-height: 48px;
  box-sizing: border-box;
}
/* 批量修改行更紧凑 */
.dt-preview-modal .dt-batch-row {
  min-height: 36px;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}
.dt-preview-modal .dt-rec-row > div,
.dt-preview-modal .dt-batch-row > div {
  line-height: 1;
}
.dt-preview-modal .dt-rec-row span,
.dt-preview-modal .dt-batch-row span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.dt-preview-modal .btn {
  padding: 4px 10px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  min-height: auto !important;
}
/* 底部操作按钮用标准大小，和其他弹窗统一 */
.dt-preview-modal .modal-foot .btn {
  padding: 8px 16px !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  min-height: 40px !important;
}

/* ===== 订单列表快捷操作：合并按钮，hover 弹出菜单 ===== */
.quick-dropdown {
  position: relative;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.quick-trigger {
  padding: 4px 8px !important;
  font-size: 16px !important;
  line-height: 1;
  opacity: 0.35;
  transition: opacity .15s ease;
}
tr:hover .quick-trigger {
  opacity: 1;
}
.quick-menu {
  display: none;
  position: fixed;
  min-width: 136px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 5px 4px;
  z-index: 100;
}
/* 显示时机与坐标由 JS 控制：先以 fixed 定位再打开，
   菜单不参与 .table-wrap 的滚动区域，不会把容器撑出纵向滚动条 */
.quick-menu.show {
  display: block;
}
/* 命中桥接：菜单与按钮之间的 2px 缝隙默认落在 td 上，指针停在缝隙里会被判定离开而收起。
   上下各放一个透明伪元素覆盖这 2px：指针停在缝隙中命中的是菜单（伪元素属于菜单），
   伪元素不参与布局、不改变行高，视觉缝隙保持透明 */
.quick-menu::before,
.quick-menu::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
}
.quick-menu::before { top: -2px; }    /* 向下弹出时覆盖上方缝隙 */
.quick-menu::after { bottom: -2px; }  /* 向上弹出时覆盖下方缝隙 */
.quick-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--text, #333);
}
/* 图标尺寸与批量操作下拉统一（覆盖 iconHtml 默认 18px） */
.quick-menu-item svg { width: 16px; height: 16px; flex: 0 0 auto; }
.quick-menu-item:hover {
  background: var(--bg-hover, #f0f0f5);
}
