* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px; font-size: 12px;
  font-weight: 600; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.5px; background: #f8fafc;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.data-table tbody tr:hover { background: #f8fafc; }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500; }

/* 输入框 */
.field {
  width: 100%; padding: 8px 12px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 14px; outline: none; transition: border 0.2s;
}
.field:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* 模态框 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 50; padding: 40px 20px; overflow-y: auto;
}
.modal-box {
  background: white; border-radius: 12px; width: 100%; max-width: 700px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
/* 宽表单弹窗（发货单明细行：归属订单+产品+数量+捆数+徽标 一行放不下 700px） */
.modal-box.modal-wide {
  max-width: 940px;
}
/* 弹窗内明细行：窄屏时徽标/捆数换行到第二行，不再溢出弹窗边缘 */
.modal-box .item-row { flex-wrap: wrap; row-gap: 4px; }

/* ============ 统一确认对话框（页面居中） ============ */
.dlg-mask {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.dlg-box {
  position: relative; width: 100%; max-width: 460px;
  background: #fff; border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 64px -12px rgba(15, 23, 42, 0.38), 0 0 0 1px rgba(15, 23, 42, 0.06);
  animation: dlg-pop .22s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes dlg-pop {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding-right: 26px; }
.dlg-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: #eef2ff;
}
.dlg-danger .dlg-icon { background: #fef2f2; }
.dlg-warning .dlg-icon { background: #fffbeb; }
.dlg-info .dlg-icon { background: #eff6ff; }
.dlg-title { font-size: 16px; font-weight: 600; color: #0f172a; line-height: 1.5; padding-top: 7px; }
.dlg-detail {
  margin: 14px 0 0; padding: 10px 12px;
  background: #f8fafc; border: 1px solid #eef2f7; border-radius: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.dlg-line { display: flex; gap: 8px; font-size: 13px; color: #475569; line-height: 1.6; }
.dlg-line-dot { flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: #a5b4c8; margin-top: 8px; }
.dlg-input-wrap { margin-top: 14px; }
.dlg-input-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.dlg-foot { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.dlg-btn {
  min-width: 92px; padding: 9px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, box-shadow .15s;
}
.dlg-btn:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }
.dlg-btn-cancel { background: #fff; border-color: #e2e8f0; color: #475569; }
.dlg-btn-cancel:hover { background: #f8fafc; }
.dlg-ok-primary { background: #4f46e5; color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .65); }
.dlg-ok-primary:hover { background: #4338ca; }
.dlg-ok-danger { background: #e11d48; color: #fff; box-shadow: 0 6px 16px -6px rgba(225, 29, 72, .65); }
.dlg-ok-danger:hover { background: #be123c; }
.dlg-x {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px;
  border: 0; border-radius: 8px; background: transparent; color: #94a3b8;
  font-size: 13px; line-height: 1; cursor: pointer;
}
.dlg-x:hover { background: #f1f5f9; color: #475569; }
.dlg-enter-active, .dlg-leave-active { transition: opacity .18s; }
.dlg-enter-from, .dlg-leave-to { opacity: 0; }

/* 卡片hover */
.stat-card { transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* 动画 */
.fade-enter-active, .fade-leave-active { transition: opacity 0.2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

[v-cloak] { display: none; }

/* ============ 固定模块表头（v2.51.6） ============ */
.page-header {
  position: sticky; top: 0; z-index: 30;
  margin: -24px -24px 4px; padding: 18px 24px 12px;
  background: linear-gradient(180deg, rgba(243,244,246,.97) 82%, rgba(243,244,246,0));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
/* 渐变标题：时尚醒目 */
.page-header h2 {
  font-weight: 800; letter-spacing: .5px; font-size: 22px;
  background: linear-gradient(95deg, #4338ca 0%, #4f46e5 35%, #0ea5e9 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #4f46e5;
}
/* 工具栏按钮：统一提亮、悬浮上浮 */
.page-header button {
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .10);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.page-header button:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 5px 14px rgba(15, 23, 42, .16);
  filter: brightness(1.06);
}
.page-header button:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(15,23,42,.10); }
/* 仪表盘等 space-y-6 模块：底部留更大间距 */
.page-header.space6 { margin-bottom: 12px; }

/* ============ 右侧下滑悬浮入口（v2.51.6） ============ */
.scroll-fab {
  position: fixed; right: 12px; top: 50%; transform: translateY(-50%);
  z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 7px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(160deg, #4f46e5, #6366f1 55%, #0ea5e9);
  color: #fff; font-family: inherit;
  box-shadow: 0 6px 20px -4px rgba(79, 70, 229, .55), 0 0 0 1px rgba(255,255,255,.25) inset;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.scroll-fab:hover {
  transform: translateY(-50%) scale(1.07);
  box-shadow: 0 10px 26px -4px rgba(79, 70, 229, .65), 0 0 0 1px rgba(255,255,255,.3) inset;
  filter: brightness(1.06);
}
.scroll-fab:active { transform: translateY(-50%) scale(.97); }
.scroll-fab .sf-arrow { font-size: 15px; line-height: 1; font-weight: 700; }
.scroll-fab .sf-txt { font-size: 11px; line-height: 1.2; font-weight: 600; letter-spacing: 1px; writing-mode: vertical-lr; }
.scroll-fab.at-bottom { background: linear-gradient(160deg, #0891b2, #06b6d4 55%, #22d3ee); box-shadow: 0 6px 20px -4px rgba(8, 145, 178, .55), 0 0 0 1px rgba(255,255,255,.25) inset; }

/* ============ v2.64.45 手机端适配（≤768px：手机 / 竖屏平板） ============ */
@media (max-width: 768px) {
  /* 1) 触控目标：顶栏与工具栏按钮加高到 40px 以上（手指点得准） */
  header button, header a,
  .page-header button, .page-header select, .page-header input {
    min-height: 40px;
  }
  .page-header button { padding-left: 12px; padding-right: 12px; }

  /* 2) 弹窗全屏化 + 内部滚动（表单再长也不会超出屏幕） */
  .modal-overlay { padding: 0 !important; align-items: stretch !important; }
  .modal-box {
    max-width: 100% !important; width: 100% !important;
    height: 100% !important; max-height: 100% !important;
    border-radius: 0 !important;
    overflow-y: auto !important; -webkit-overflow-scrolling: touch;
  }
  .dlg-mask { padding: 12px !important; }

  /* 3) 表单控件字号 ≥16px：避免 iOS Safari 聚焦时自动放大整页 */
  input, select, textarea { font-size: 16px !important; }

  /* 4) 表格：压缩内边距；首列吸附，横向滑动时订单号 / 型号始终可见 */
  table { font-size: 12px; }
  table th, table td { padding-left: 6px !important; padding-right: 6px !important; }
  table td:first-child, table th:first-child {
    position: sticky; left: 0; background: #fff; z-index: 5;
    box-shadow: 1px 0 0 rgba(148,163,184,.35);
  }
  table th:first-child { z-index: 12; }
  /* 横向滚动条可见，提示"可以左右滑" */
  .overflow-x-auto { -webkit-overflow-scrolling: touch; }
  .overflow-x-auto::-webkit-scrollbar { height: 6px; }
  .overflow-x-auto::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

  /* 5) 页面留白收紧，把宽度让给内容 */
  .p-6 { padding: 12px !important; }
  .page-header { margin: -12px -12px 4px; padding: 12px 12px 10px; }
  .page-header h2 { font-size: 18px; }

  /* 6) 排产表格外小按钮（▲▼ 微调 / 标签）折中加到 28px，仍紧凑但能点准 */
  button[class*="text-[11px]"] { min-height: 28px; min-width: 28px; }

  /* 7) v2.64.47 包着表格的 overflow-hidden 容器在手机上改为可横滚
        （overflow-hidden 会把 900~1100px 宽的表格硬裁掉右侧列，滑都滑不了） */
  .overflow-hidden:has(> table), .overflow-hidden:has(> div > table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* 8) 表格内操作按钮（详情/编辑/删除等）加高到 32px，成为合格触控目标 */
  td button { min-height: 32px; padding-top: 4px !important; padding-bottom: 4px !important; }

  /* 9) 其余 text-xs 小按钮（分组头筛选标签 / 批量完工等）统一拉到 32px */
  button[class*="text-xs"] { min-height: 32px; }

  /* 10) 表格内下拉（生产状态等）统一 32px */
  td select, td input { min-height: 32px; }
}
