/* ========================================
   v947：设计师手机端（DesignerMobile）独立工作台
   - 仅在「服务端模式 + 设计师角色 + 触屏/≤768px」时由 DesignerMobile 激活
   - 与管理端、员工端完全隔离：#designer-app + dm- 前缀类名
   - 设计约束：正文 ≥14px、可点区域 ≥44×44、主操作固定在屏幕下半区
   ======================================== */

@media (min-width: 769px) {
  #designer-app { display: none !important; }
}

#designer-app {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f1f7f6;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
#designer-app.hidden { display: none; }
#designer-app * { box-sizing: border-box; }
#designer-app button { font-family: inherit; }
#designer-app input, #designer-app textarea, #designer-app select { font-size: 16px; } /* iOS 防聚焦缩放 */

/* ===== 滚动区 ===== */
.dm-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

/* ===== 头部 ===== */
.dm-head {
  padding: calc(20px + env(safe-area-inset-top)) 18px 60px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #009E90 55%, #00B5A5 100%);
}
.dm-head.light {
  color: #1a1a1a;
  background: linear-gradient(180deg, #e4f4f0 0%, #eef7f5 60%, #f1f7f6 100%);
  padding-bottom: 14px;
}
.dm-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 20px;
  font-weight: 700;
}
.dm-head-sub { margin-top: 6px; font-size: 13px; opacity: 0.92; line-height: 1.5; }
.dm-back {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-head.light .dm-back { background: rgba(0, 0, 0, 0.06); }
.dm-overlap { margin-top: -42px; padding: 0 14px; }

/* ===== 卡片 ===== */
.dm-card {
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(15, 60, 55, 0.06);
}
.dm-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
}
.dm-muted { color: #6b7c78; font-size: 13px; line-height: 1.55; }
.dm-hr { height: 1px; background: #eef5f4; margin: 10px 0; }
.dm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #eef5f4;
}
.dm-row:last-child { border-bottom: 0; }
.dm-row-main { flex: 1; min-width: 0; }
.dm-row-title { font-size: 15px; font-weight: 600; white-space: normal; word-break: break-word; line-height: 1.45; }
.dm-row-sub { margin-top: 3px; font-size: 13px; color: #6b7c78; line-height: 1.5; }
.dm-arrow { color: #b8cbc7; font-size: 18px; flex: 0 0 auto; }

/* ===== 按钮 ===== */
.dm-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #dbe8e5;
  border-radius: 12px;
  background: #fff;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dm-btn:active { background: #eef5f4; }
.dm-btn.primary { border: 0; background: #009E90; color: #fff; }
.dm-btn.primary:active { background: #00857a; }
.dm-btn.ghost { background: rgba(0, 181, 165, 0.08); border-color: rgba(0, 181, 165, 0.24); color: #009E90; }
.dm-btn.danger { border-color: #fecaca; background: #fff1f1; color: #dc2626; }
.dm-btn.block { width: 100%; }
.dm-btn[disabled] { opacity: 0.45; }
.dm-actions { display: flex; gap: 8px; margin-top: 10px; }
.dm-actions .dm-btn { flex: 1; }

/* ===== 分段 / 芯片 ===== */
.dm-seg { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: #eef5f4; }
.dm-seg-item {
  flex: 1;
  min-height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #6b7c78;
}
.dm-seg-item.on { background: #fff; color: #009E90; box-shadow: 0 1px 4px rgba(15, 60, 55, 0.1); }
.dm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-chip {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #dbe8e5;
  border-radius: 999px;
  background: #fff;
  color: #5c6e6b;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dm-chip.on { border-color: #009E90; background: rgba(0, 181, 165, 0.1); color: #009E90; font-weight: 600; }
.dm-chip.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.dm-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 181, 165, 0.1);
  color: #009E90;
}
.dm-tag.gray { background: #f1f5f4; color: #6b7c78; }
.dm-tag.amber { background: #fef3e2; color: #b45309; }
.dm-tag.red { background: #feeaea; color: #dc2626; }
.dm-tag.green { background: #e7f8ef; color: #15803d; }
.dm-tag.blue { background: #e8f1ff; color: #1d4ed8; }

/* ===== 数字卡片 / 统计 ===== */
.dm-stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dm-stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(15, 60, 55, 0.05);
}
.dm-stat-num { font-size: 24px; font-weight: 800; color: #009E90; line-height: 1.1; }
.dm-stat-num.warn { color: #d97706; }
.dm-stat-label { margin-top: 4px; font-size: 12px; color: #6b7c78; }

/* ===== 底部导航 ===== */
.dm-tabbar {
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: #fff;
  border-top: 1px solid #e3eeec;
  flex-shrink: 0;
}
.dm-tab {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11.5px;
  color: #8a9a97;
}
.dm-tab.active { color: #009E90; font-weight: 700; }

/* ===== 段进度 ===== */
.dm-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px dashed #eef5f4;
}
.dm-step:last-child { border-bottom: 0; }
.dm-step-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: rgba(0, 181, 165, 0.1);
  color: #009E90;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-step.done .dm-step-ico { background: rgba(22, 163, 74, 0.1); color: #16a34a; }
.dm-step-main { flex: 1; min-width: 0; }
.dm-step-name { font-size: 15px; font-weight: 700; }
.dm-step-desc { margin-top: 3px; font-size: 13px; color: #6b7c78; }

/* ===== 柜体卡 ===== */
.dm-cab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e3eeec;
  border-radius: 14px;
  background: #fff;
  margin-bottom: 8px;
}
.dm-cab.done { border-color: rgba(22, 163, 74, 0.4); background: #f7fdf9; }
.dm-cab-main { flex: 1; min-width: 0; }
.dm-cab-name { font-size: 15px; font-weight: 700; }
.dm-cab-dims { margin-top: 4px; font-size: 13px; color: #6b7c78; }
.dm-cab-check {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  border: 1.5px solid #dbe8e5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
}
.dm-cab.done .dm-cab-check { background: #16a34a; border-color: #16a34a; }

/* ===== 尺寸录入 ===== */
.dm-dim { display: flex; gap: 8px; }
.dm-dim-item { flex: 1; min-width: 0; }
.dm-dim-label { font-size: 12.5px; color: #6b7c78; margin-bottom: 4px; text-align: center; }
.dm-dim-input {
  width: 100%;
  height: 52px;
  border: 1.5px solid #dbe8e5;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  outline: none;
}
.dm-dim-input.active { border-color: #00B5A5; box-shadow: 0 0 0 3px rgba(0, 181, 165, 0.14); }
.dm-dim-unit { margin-top: 3px; text-align: center; font-size: 11.5px; color: #9ca3af; }

.dm-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.dm-key {
  height: 52px;
  border: 1px solid #dbe8e5;
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
}
.dm-key:active { background: #e6f5f2; }
.dm-key.fn { font-size: 15px; background: #eef5f4; color: #5c6e6b; }

.dm-wall-hint { margin-top: 8px; font-size: 13px; line-height: 1.5; color: #6b7c78; }
.dm-wall-hint.bad { color: #dc2626; font-weight: 600; }

/* ===== 照片 ===== */
.dm-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dm-photo {
  position: relative;
  padding-top: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #eef5f4;
}
.dm-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dm-photo-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
}
.dm-photo-add {
  min-height: 96px;
  border: 1.5px dashed #b8d6d0;
  border-radius: 12px;
  background: #f7fcfb;
  color: #009E90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

/* ===== 复尺对比 ===== */
.dm-cmp { display: grid; grid-template-columns: 56px 1fr 1fr 76px; gap: 6px; align-items: center; }
.dm-cmp-head { font-size: 12px; color: #9ca3af; text-align: center; }
.dm-cmp-label { font-size: 13px; color: #5c6e6b; }
.dm-cmp-val { height: 44px; border: 1px solid #dbe8e5; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #5c6e6b; background: #f7fbfa; }
.dm-cmp-val.input { background: #fff; font-weight: 600; color: #1a1a1a; }
.dm-cmp-diff { text-align: center; font-size: 13px; color: #9ca3af; }
.dm-cmp-diff.bad { color: #dc2626; font-weight: 700; }
.dm-cmp-diff.warn { color: #b45309; font-weight: 600; }

/* ===== 弹层 ===== */
.dm-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 960;
  background: rgba(15, 45, 42, 0.44);
  display: flex;
  align-items: flex-end;
}
.dm-sheet {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 6px 16px calc(18px + env(safe-area-inset-bottom));
}
.dm-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: #d3e2df; margin: 8px auto 10px; }
.dm-sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.dm-field { margin-bottom: 14px; }
.dm-field-label { font-size: 13px; font-weight: 600; color: #5c6e6b; margin-bottom: 6px; }
.dm-input, .dm-textarea {
  width: 100%;
  border: 1px solid #dbe8e5;
  border-radius: 12px;
  background: #fff;
  color: #1a1a1a;
  padding: 0 12px;
  outline: none;
}
.dm-input { height: 46px; }
.dm-textarea { padding: 10px 12px; min-height: 84px; line-height: 1.55; resize: vertical; }
.dm-input:focus, .dm-textarea:focus { border-color: #00B5A5; }
.dm-sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.dm-sheet-actions .dm-btn { flex: 1; }

/* ===== 语音 ===== */
.dm-voice-row { display: flex; gap: 8px; align-items: flex-start; }
.dm-voice-row .dm-textarea { flex: 1; }
.dm-voice-btn {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid #dbe8e5;
  border-radius: 12px;
  background: #fff;
  color: #009E90;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.dm-voice-btn.rec { background: #feeaea; border-color: #fca5a5; color: #dc2626; }
.dm-voice-status { margin-top: 4px; font-size: 12px; color: #9ca3af; min-height: 16px; }
.dm-voice-audio { width: 100%; margin-top: 6px; }

/* ===== 空态 / 遮罩 ===== */
.dm-empty { text-align: center; padding: 40px 16px; color: #9ca3af; font-size: 14px; line-height: 1.6; }
.dm-busy {
  position: fixed;
  inset: 0;
  z-index: 990;
  background: rgba(15, 45, 42, 0.32);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  font-size: 14px;
}
.dm-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dm-spin 0.8s linear infinite;
}
@keyframes dm-spin { to { transform: rotate(360deg); } }
.dm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 995;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dm-lightbox img { max-width: 100%; max-height: 82vh; border-radius: 8px; }
.dm-lightbox-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  color: #e5e7eb;
  font-size: 13px;
  padding: 0 16px;
}
.dm-lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
}

/* ===== 提示条 ===== */
.dm-banner {
  margin: 0 14px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}
.dm-banner.amber { background: #fef3e2; color: #92400e; }
.dm-banner.red { background: #feeaea; color: #991b1b; }
.dm-banner.blue { background: #e8f1ff; color: #1e40af; }

/* ===== 待上传角标 ===== */
.dm-pending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3e2;
  color: #b45309;
  font-size: 12px;
  font-weight: 600;
}

/* ========================================
   v947 扩充：任务卡 / 左滑 / 四宫格 / 提醒 / 相册
   ======================================== */

/* 分组标题 */
.dm-group-title {
  margin: 14px 2px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #5c6e6b;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 四宫格指标 */
.dm-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.dm-grid4 > div { background: #f6fbfa; border-radius: 10px; padding: 8px 4px; text-align: center; }
.dm-grid4 > div b { display: block; font-size: 16px; font-weight: 800; color: #009E90; line-height: 1.2; }
.dm-grid4 > div span { display: block; margin-top: 2px; font-size: 11.5px; color: #8a9a97; }
.dm-grid4-i {
  background: #f6fbfa;
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.dm-grid4-n { font-size: 16px; font-weight: 800; color: #009E90; line-height: 1.2; }
.dm-grid4-l { margin-top: 2px; font-size: 11.5px; color: #8a9a97; }

/* 四状态卡 */
.dm-stat4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dm-stat4 .dm-stat { padding: 10px 4px; }
.dm-stat4 .dm-stat-num { font-size: 20px; }
.dm-stat4 .dm-stat-label { font-size: 11.5px; line-height: 1.35; }

/* 任务卡 + 左滑 */
.dm-task-list { margin-top: 4px; }
.dm-task {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 12px rgba(15, 60, 55, 0.06);
}
.dm-task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dm-task-kind { font-size: 12px; font-weight: 700; color: #009E90; }
.dm-task-when { font-size: 12.5px; color: #8a9a97; }
.dm-task-name { margin-top: 6px; font-size: 16px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.dm-task-meta { margin-top: 4px; font-size: 13px; color: #6b7c78; line-height: 1.55; word-break: break-word; }
.dm-task-ops { display: flex; gap: 8px; margin-top: 12px; }
.dm-task-ops .dm-btn { flex: 1; }
.dm-task-count { font-size: 12px; font-weight: 600; color: #8a9a97; }

.dm-swipe { position: relative; overflow: hidden; border-radius: 16px; margin-bottom: 10px; }
.dm-swipe-inner { position: relative; z-index: 2; transition: transform 0.18s ease; }
.dm-swipe-acts { position: absolute; inset: 0 0 0 auto; display: flex; z-index: 1; }
.dm-swipe-btn {
  width: 74px;
  border: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-swipe-btn.amber { background: #d97706; }
.dm-swipe-btn.green { background: #16a34a; }

/* 提醒中心 */
.dm-alert {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed #eef5f4;
}
.dm-alert:last-child { border-bottom: 0; }
.dm-alert-ico { flex: 0 0 22px; color: #d97706; }
.dm-alert-main { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.55; color: #3f4f4c; word-break: break-word; }
.dm-alert-time { font-size: 12px; color: #9ca3af; }

/* 沟通记录 */
.dm-log { padding: 10px 0; border-bottom: 1px dashed #eef5f4; }
.dm-log:last-child { border-bottom: 0; }
.dm-log-t { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8a9a97; }
.dm-log-c { margin-top: 4px; font-size: 14px; line-height: 1.6; word-break: break-word; }

/* 只读 / 灰条 */
.dm-banner.gray { background: #eef2f1; color: #4b5563; }
.dm-readonly-note { font-size: 13px; color: #6b7c78; }

/* 文字不截断（5.6） */
#designer-app .dm-head-title > span,
#designer-app .dm-task-name,
#designer-app .dm-cab-name { white-space: normal; word-break: break-word; overflow: visible; text-overflow: clip; }

/* 字号档位 */
#designer-app.dm-large { font-size: 16px; }
#designer-app.dm-large .dm-muted,
#designer-app.dm-large .dm-task-meta,
#designer-app.dm-large .dm-log-c,
#designer-app.dm-large .dm-alert-main { font-size: 15px; }
#designer-app.dm-large .dm-row-title,
#designer-app.dm-large .dm-task-name,
#designer-app.dm-large .dm-cab-name { font-size: 17px; }
#designer-app.dm-large .dm-btn { font-size: 16px; }

/* 相册多选 */
.dm-photo.sel { outline: 3px solid #00B5A5; outline-offset: -3px; }
.dm-photo-sel {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.dm-photo.sel .dm-photo-sel { background: #00B5A5; }

/* 下拉刷新 */
.dm-pull {
  height: 0;
  overflow: hidden;
  text-align: center;
  font-size: 12.5px;
  color: #8a9a97;
  transition: height 0.15s ease;
}
.dm-pull.on { height: 42px; line-height: 42px; }

/* 复尺态度 / 快照 */
.dm-att { display: flex; gap: 8px; margin-top: 10px; }
.dm-att .dm-btn { flex: 1; }
.dm-att .dm-btn.on { border-color: #009E90; color: #009E90; background: rgba(0, 181, 165, 0.08); }
.dm-snap { padding: 8px 0; border-bottom: 1px dashed #eef5f4; font-size: 13px; color: #5c6e6b; line-height: 1.6; }
.dm-snap:last-child { border-bottom: 0; }

/* 交底状态链 */
.dm-flow { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.dm-flow-i { font-size: 12px; color: #9ca3af; padding: 3px 8px; border-radius: 999px; background: #f1f5f4; }
.dm-flow-i.on { background: rgba(0, 181, 165, 0.12); color: #009E90; font-weight: 700; }
.dm-flow-i.bad { background: #feeaea; color: #dc2626; font-weight: 700; }

/* 施工视角预览 */
.dm-preview { background: #f6fbfa; border: 1px solid #d7ebe7; border-radius: 14px; padding: 12px; }
.dm-preview .dm-cab { background: #fff; }
