/* ========================================
   v1040：手机端统一骨架与设计令牌（管理端 / 设计师端 / 施工端）
   - 只提供「外观外壳」：颜色、字号、圆角、间距、图标圆形底色、卡片骨架
   - 所有类名以 ms- 前缀，PC 端不出现任何 ms- 元素（.ms-mobile-only 在宽屏隐藏）
   - 不改路由、权限、页面栈、数据口径；各端旧样式保留兜底
   ======================================== */

/* ===== 0. 设计令牌（新命名，PC 端无引用，零影响） ===== */
:root {
  --ms-primary: #00B5A5;
  --ms-primary-deep: #0f766e;
  --ms-primary-soft: #e7f6f3;
  --ms-ink: #12312c;
  --ms-ink-2: #1a1a1a;
  --ms-sub: #6b7c78;
  --ms-sub-2: #8a9a97;
  --ms-line: #e6f0ed;
  --ms-line-dash: #e6f0ed;
  --ms-page: #f2f8f7;
  --ms-white: #fff;
  --ms-radius-card: 16px;
  --ms-radius-pill: 999px;
  --ms-pad-card: 14px;
  --ms-gap-card: 10px;
  --ms-fs-greet: 23px;
  --ms-fs-title: 15px;
  --ms-fs-value: 20px;
  --ms-fs-body: 14px;
  --ms-fs-sub: 12px;
  --ms-fs-mini: 11px;
  --ms-hit: 44px;
  --ms-ico-circle: 36px;
  --ms-avatar: 42px;
}

/* PC 宽屏一律不显示手机骨架 */
.ms-mobile-only { display: none; }
/* 仅 PC 显示（手机端隐藏）：用于与身份版内容并存时保留 PC 原样 */
.ms-pc-only { display: block; }

/* ===== 1. 顶部：浅青水彩渐变头 ===== */
.ms-head {
  position: relative;
  overflow: hidden;
  padding: calc(12px + env(safe-area-inset-top)) 16px 30px;
  background: linear-gradient(168deg, #e6f5f1 0%, #eaf7f4 42%, #f4faf8 100%);
  color: var(--ms-ink);
}
.ms-head::before {
  content: '';
  position: absolute;
  left: -40px; top: -70px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 181, 165, 0.16) 0%, rgba(0, 181, 165, 0) 70%);
  pointer-events: none;
}
.ms-head::after {
  content: '';
  position: absolute;
  right: -30px; bottom: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 199, 187, 0.18) 0%, rgba(129, 199, 187, 0) 70%);
  pointer-events: none;
}
.ms-head > * { position: relative; z-index: 2; }

.ms-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
}
.ms-brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.ms-brand-logo {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
  border-radius: 8px;
}
.ms-brand-txt { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ms-brand-txt b {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
  color: var(--ms-ink);
  white-space: nowrap;
}
.ms-brand-txt i {
  margin-top: 1px;
  font-size: 7.5px;
  font-style: normal;
  letter-spacing: 1.6px;
  color: #6f8b86;
  white-space: nowrap;
}

.ms-head-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ms-head .mv-user {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(0, 181, 165, 0.18);
  box-shadow: none;
  max-width: none;
  padding: 2px 7px 2px 2px;
  border-radius: var(--ms-radius-pill);
}
.ms-head .mv-avatar {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: var(--ms-primary-deep);
  font-size: 11px;
}
.ms-head .mv-name { font-size: 12px; max-width: 56px; color: var(--ms-ink); }
.ms-head .mv-pill { height: 20px; padding: 0 6px; border-radius: var(--ms-radius-pill); background: #fff; border-color: rgba(0,181,165,.24); }
.ms-head .mv-pill-ico { font-size: 9px; color: var(--ms-primary-deep); }
.ms-head .mv-pill-txt { font-size: 9px; color: var(--ms-primary-deep); }
.ms-head .mv-mine-switch { display: none; }

.ms-role-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--ms-radius-pill);
  background: #fff;
  border: 1px solid rgba(0, 181, 165, 0.24);
  color: var(--ms-primary-deep);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
/* 设计师端单端口：右上只保留一个圆形身份字标「设」 */
#designer-app .ms-head .ms-role-pill {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
}

.ms-icon-btn {
  position: relative;
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(0, 181, 165, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ms-primary-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.ms-icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; }
/* 视觉 32px，触控热区补足到 44px */
.ms-icon-btn::after { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; }
.ms-icon-btn .ms-dot {
  position: absolute;
  top: 5px; right: 4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #e05252;
  border: 1.5px solid #fff;
  box-sizing: content-box;
}
.ms-icon-btn .ms-dot[hidden] { display: none; }

.ms-exit {
  position: relative;
  min-height: 32px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #3d5450;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ms-exit svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.ms-exit::after { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }

.ms-greet-row { margin-top: 12px; max-width: calc(100% - 140px); }
.ms-greet {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--ms-fs-greet);
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.25;
  color: var(--ms-ink);
}
.ms-wave { width: 20px; height: 20px; flex: 0 0 20px; color: #0e9c8f; }
.ms-wave svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.ms-greet-sub {
  margin: 6px 0 0;
  font-size: var(--ms-fs-sub);
  line-height: 1.5;
  color: #5b6f6b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右上：淡水彩房屋插画 + 手写标语 */
.ms-head-art {
  position: absolute;
  right: 8px; top: 52px;
  width: 140px; height: 100px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.96;
}
.ms-head-art img { width: 100%; height: 100%; display: block; object-fit: contain; }
.ms-head-slogan {
  position: absolute;
  right: 12px; top: 156px;
  z-index: 1;
  transform: rotate(-6deg);
  text-align: center;
  pointer-events: none;
  color: #1f6b64;
  opacity: 0.82;
}
.ms-head-slogan b {
  display: block;
  font-family: 'STKaiti', 'KaiTi', '楷体', 'Songti SC', serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 1px;
}
.ms-head-slogan i {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  font-style: italic;
  letter-spacing: 0.6px;
  color: #4f8881;
}

/* ===== 2. 卡片通用骨架 ===== */
.ms-card {
  background: var(--ms-white);
  border-radius: var(--ms-radius-card);
  padding: var(--ms-pad-card);
  margin-bottom: var(--ms-gap-card);
  box-shadow: 0 2px 10px rgba(15, 60, 55, 0.05);
}
.ms-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ms-card-hd b { font-size: var(--ms-fs-title); font-weight: 700; color: var(--ms-ink-2); }
.ms-card-link {
  border: 0;
  background: transparent;
  padding: 4px 0 4px 8px;
  font-size: var(--ms-fs-sub);
  font-weight: 500;
  color: var(--ms-sub-2);
  cursor: pointer;
}

/* ===== 3. 统计卡：三列等宽 + 竖虚线 ===== */
.ms-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: -16px;
  padding: 14px 10px;
}
.ms-stat {
  min-width: 0;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.ms-stat + .ms-stat { border-left: 1px dashed var(--ms-line-dash); }
.ms-stat-ico {
  width: var(--ms-ico-circle);
  height: var(--ms-ico-circle);
  border-radius: 50%;
  background: var(--ms-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.ms-stat-ico.solid { background: var(--ms-primary); color: #fff; }
.ms-stat-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.ms-stat-label {
  font-size: var(--ms-fs-sub);
  color: var(--ms-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-stat-value {
  font-size: var(--ms-fs-value);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ms-ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-stat-value small { font-size: 11px; font-weight: 600; color: var(--ms-sub-2); margin-left: 2px; }
.ms-stat-sub {
  font-size: var(--ms-fs-mini);
  line-height: 1.4;
  color: var(--ms-sub-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-stat-sub.up { color: #16a34a; }
.ms-stat-sub svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; vertical-align: -1px; }
.ms-stat-bar { width: 100%; height: 4px; border-radius: 2px; background: #eef5f4; overflow: hidden; margin-top: 4px; }
.ms-stat-bar > i { display: block; height: 100%; border-radius: 2px; background: var(--ms-primary); }

/* ===== 4. 快捷操作卡 ===== */
.ms-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.ms-quick-item {
  flex: 1 1 56px;
  max-width: 96px;
  min-height: var(--ms-hit);
  border: 0;
  background: transparent;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}
.ms-quick-item:active { opacity: 0.72; }
.ms-quick-ico {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--ms-primary-soft);
  color: var(--ms-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ms-quick-ico svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.ms-quick-label {
  font-size: var(--ms-fs-sub);
  line-height: 1.3;
  color: #3d5450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ms-quick-badge {
  position: absolute;
  top: -2px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #d9534f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

/* ===== 5. 动态 / 待办卡 ===== */
.ms-feed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--ms-hit);
  padding: 10px 0;
  border-bottom: 1px dashed var(--ms-line-dash);
  cursor: pointer;
}
.ms-feed-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.ms-feed-ico {
  width: var(--ms-avatar);
  height: var(--ms-avatar);
  flex: 0 0 var(--ms-avatar);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ms-primary-soft);
  color: var(--ms-primary);
}
.ms-feed-ico svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.ms-feed-ico.orange { background: #fdf1e3; color: #e08a2e; }
.ms-feed-ico.purple { background: #f2edfd; color: #7c5cd6; }
.ms-feed-ico.gray { background: #f1f5f4; color: #8a9a97; }
.ms-feed-main { flex: 1; min-width: 0; }
.ms-feed-title {
  font-size: var(--ms-fs-body);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ms-ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-feed-sub {
  margin-top: 3px;
  font-size: var(--ms-fs-sub);
  line-height: 1.35;
  color: var(--ms-sub-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-feed-time { flex: 0 0 auto; font-size: var(--ms-fs-mini); color: var(--ms-sub-2); }
.ms-feed-arrow { flex: 0 0 auto; color: #c2d0ce; font-size: 18px; line-height: 1; }
.ms-feed-empty { padding: 14px 0; text-align: center; font-size: var(--ms-fs-sub); color: var(--ms-sub-2); }

/* ===== 6. 状态胶囊（四套浅色底 + 深色字，无深色实心） ===== */
.ms-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--ms-radius-pill);
  font-size: var(--ms-fs-mini);
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
.ms-chip.teal { background: #e3f6f3; color: #0f766e; }
.ms-chip.amber { background: #fdf3e3; color: #b45309; }
.ms-chip.gray { background: #f1f5f4; color: #6b7c78; }
.ms-chip.green { background: #e8f8ef; color: #15803d; }
.ms-chip.purple { background: #f2edfd; color: #6d43c8; }
.ms-chip.red { background: #fdeaea; color: #c0392b; }

/* ===== 7. 底部宣传横幅 ===== */
.ms-banner {
  position: relative;
  overflow: hidden;
  margin: 2px 0 4px;
  padding: 14px 15px;
  min-height: 74px;
  border-radius: var(--ms-radius-card);
  background: linear-gradient(120deg, #e9f6f2 0%, #f2faf7 55%, #eaf5f1 100%);
}
.ms-banner b {
  display: block;
  font-family: 'STKaiti', 'KaiTi', '楷体', 'Songti SC', serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.6px;
  color: #1f5f58;
}
.ms-banner span {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: #5b7a74;
}
.ms-banner-art {
  position: absolute;
  right: 4px; bottom: 0;
  width: 128px; height: 78px;
  opacity: 0.92;
  pointer-events: none;
}
.ms-banner-art img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* ===== 8. 底栏外观（结构不动，只换皮） ===== */
#designer-app .wx-tabbar,
#worker-app .wx-tabbar {
  background: #fff;
  border-top: 1px solid var(--ms-line);
}
#designer-app .wx-tab,
#worker-app .wx-tab { font-size: 10px; color: #9aa8a4; }
#designer-app .wx-tab.active,
#worker-app .wx-tab.active { color: var(--ms-primary-deep); font-weight: 700; }
#designer-app .wx-tab-ico,
#worker-app .wx-tab-ico {
  width: 22px; height: 22px;
  border-radius: 0;
  background: transparent;
  opacity: 1;
}
#designer-app .wx-tab-ico svg,
#worker-app .wx-tab-ico svg {
  display: block;
  width: 22px; height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* ===== 9. 页面底色（手机端） ===== */
#designer-app, #worker-app { background: var(--ms-page); }
#designer-app .wx-home.ms-home { padding: 0 14px; background: var(--ms-page); }

/* ===== 9.1 施工端打卡卡：浅色描边替代深色实心大按钮 ===== */
#worker-app .wm-overlap > .ms-stats { margin-top: 0; }
#worker-app .ms-sign-card { padding: 12px 10px 6px; }
#worker-app .wm-sign-btn {
  width: 150px; height: 150px;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--ms-primary-deep);
  background: linear-gradient(150deg, #eaf8f4 0%, #d8f1eb 100%);
  box-shadow: 0 10px 24px rgba(0, 181, 165, 0.18), 0 0 0 10px rgba(255, 255, 255, 0.6);
}
#worker-app .wm-sign-btn.done {
  color: #5c6e6b;
  background: linear-gradient(150deg, #f2f7f6 0%, #e6efec 100%);
  box-shadow: 0 8px 20px rgba(15, 60, 55, 0.1), 0 0 0 10px rgba(255, 255, 255, 0.6);
}
#worker-app .wm-sign-btn.rejected {
  color: #b45309;
  background: linear-gradient(150deg, #fdf3e6 0%, #fbe7cd 100%);
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.14), 0 0 0 10px rgba(255, 255, 255, 0.6);
}
#worker-app .wm-sign-hint { font-size: 11.5px; color: var(--ms-sub-2); margin-top: 10px; }

/* ===== 10. 管理端：仅在手机端启用骨架（PC 一律不生效） ===== */
@media (max-width: 768px),
  (min-width: 769px) and (max-width: 900px) and (hover: none),
  (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  .ms-mobile-only { display: block; }
  .ms-pc-only { display: none; }
  /* 首页挂上新头部时，隐藏旧页头与旧问候区，避免重复 */
  #main-app:has(.page-content .ms-head) #page-header { display: none; }
  /* 首页挂新骨架后，旧的统计区/底部统计栏隐藏，避免与三列统计卡重复 */
  #main-app .page-content:has(.ms-head) > .ptf-bar,
  #main-app .page-content > .ms-land-left > .ptf-bar { display: none !important; }
  #main-app .page-content:has(.ms-head) > .hero-stat-grid,
  #main-app .page-content > .ms-land-left > .hero-stat-grid,
  #main-app .page-content:has(.ms-head) > .footer-stats,
  #main-app .page-content > .ms-land-right > .footer-stats { display: none; }
  .page-content:has(.ms-head) > .greet-section,
  .page-content > .ms-land-left > .greet-section { display: none; }
  /* 头部通栏：抵消 .page-content 的左右内边距，其余内容布局不动 */
  .page-content .ms-head { margin-left: -16px; margin-right: -16px; }
  /* 统计数字：三列等宽下长金额不省略，按视口压缩字号 */
  .ms-stats .ms-stat-value { font-size: clamp(13px, 4.2vw, 21px); letter-spacing: -0.3px; }
  .ms-stats { margin: 0 0 10px; }
  #main-app .page-content .ms-mobile-only > .ms-stats { margin-top: -14px; }
  .ms-banner { margin: 0 0 4px; }
  .ms-card { box-shadow: 0 1px 8px rgba(15, 60, 55, 0.06); }

  /* 管理端快捷操作：套上骨架类名后的外观 */
  .ms-quick-wrap { background: #fff; border-radius: var(--ms-radius-card); padding: 14px; margin-bottom: 10px; }
  .ms-quick-wrap .ms-quick-grid { gap: 6px; }
  .ms-quick-wrap .ms-quick-item { max-width: none; }
  .ms-quick-wrap .quick-action-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--ms-primary-soft); color: var(--ms-primary); border: 0; }
  .ms-quick-wrap .quick-action-btn svg { stroke: currentColor; fill: none; width: 21px; height: 21px; }
  .ms-quick-wrap .quick-action-label { font-size: var(--ms-fs-sub); color: #3d5450; }
  .ms-quick-wrap .ms-quick-edit { float: right; font-size: var(--ms-fs-sub); font-weight: 500; color: var(--ms-sub-2); padding: 2px 0 2px 8px; cursor: pointer; }

  /* 列表行统一：虚线分隔 + 单行省略 */
  .ms-quick-wrap, #designer-app .dm-card, #worker-app .wm-card { border-radius: var(--ms-radius-card); }
  #main-app .page-content:has(.ms-head) > .card { border-radius: var(--ms-radius-card); }
  #designer-app .dm-ax-row, #worker-app .wm-row { border-bottom: 1px dashed var(--ms-line-dash); }
  #designer-app .dm-ax-row:last-child, #worker-app .wm-row:last-child { border-bottom: 0; }
  .dm-ax-name, .dm-ax-sub, .wm-row-title, .wm-row-sub, .todo-item-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 管理端首页：抵消 mobile-wx 旧灰阶 !important，仅限新骨架 */
  #main-app .ms-head .ms-brand-txt b { color: var(--ms-ink) !important; }
  #main-app .ms-head .ms-brand-txt i { color: #6f8b86 !important; }
  #main-app .ms-head .ms-greet { color: var(--ms-ink) !important; }
  #main-app .ms-head .ms-greet-sub { color: #5b6f6b !important; }
  #main-app .ms-head .ms-wave { color: #0e9c8f !important; }
  #main-app .ms-head .ms-role-pill {
    width: 28px; height: 28px; padding: 0; justify-content: center;
    border: 0 !important; border-radius: 50%; background: #e6ecea;
    color: #64736f !important; font-size: 12px;
  }
  #main-app .ms-head .ms-icon-btn { border: 0 !important; background: transparent; color: #526863 !important; }
  #main-app .ms-head .ms-icon-btn svg { color: inherit !important; }
  #main-app .ms-head .ms-dot { background: #35b86b; border-color: #edf8f5 !important; }
  #main-app .ms-head .ms-exit { color: #3d5450 !important; }
  #main-app .ms-stat-label { color: var(--ms-sub) !important; }
  #main-app .ms-stat-value { color: var(--ms-ink-2) !important; overflow: visible; text-overflow: clip; max-width: none; font-variant-numeric: tabular-nums; }
  #main-app .ms-stat-value small { color: var(--ms-sub-2) !important; }
  #main-app .ms-stat-sub { color: var(--ms-sub-2) !important; }
  #main-app .ms-stat-sub.up { color: #16a34a !important; }
  #main-app .ms-stat-ico,
  #main-app .ms-stat-ico.solid { background: var(--ms-primary) !important; color: #fff !important; }
  #main-app .ms-stat-ico svg,
  #main-app .ms-feed-ico svg,
  #main-app .ms-quick-wrap .quick-action-btn svg { color: inherit !important; stroke: currentColor !important; }

  .ms-home-stats { position: relative; }
  #main-app .ms-stat-filter {
    position: absolute; right: 10px; top: 7px; z-index: 3;
    width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: transparent; color: #8a9a97 !important; cursor: pointer;
  }
  #main-app .ms-stat-filter svg { color: inherit !important; stroke: currentColor; }
  .ms-time-pop {
    position: absolute; right: 0; top: 39px; z-index: 30;
    width: min(330px, calc(100vw - 32px));
    border-radius: 12px; background: #fff; box-shadow: 0 10px 30px rgba(15,60,55,.16);
  }
  .ms-time-pop[hidden] { display: none !important; }
  .ms-time-pop .ptf-bar { margin: 0 !important; padding: 12px !important; border: 0 !important; background: #fff; border-radius: 12px; }

  #main-app .ms-quick-wrap { padding: 14px 12px; margin-bottom: 10px; }
  #main-app .ms-quick-wrap .quick-actions-title { margin-bottom: 12px; color: var(--ms-ink-2) !important; font-size: 15px; }
  #main-app .ms-quick-wrap .quick-actions-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
  #main-app .ms-quick-wrap .quick-action-item {
    min-width: 0; gap: 7px; padding: 2px 0; border: 0 !important; border-radius: 0;
    background: transparent !important; box-shadow: none !important;
  }
  #main-app .ms-quick-wrap .quick-action-item:hover { transform: none; }
  #main-app .ms-quick-wrap .quick-action-btn {
    width: 46px; height: 46px; border: 0 !important; border-radius: 50% !important;
    background: var(--ms-primary-soft) !important; color: var(--ms-primary) !important;
    box-shadow: none !important; backdrop-filter: none;
  }
  #main-app .ms-quick-wrap .quick-action-btn svg { stroke: currentColor !important; fill: none; stroke-width: 2.1; }
  #main-app .ms-quick-wrap .quick-action-item:first-child .quick-action-btn { background: var(--ms-primary-soft) !important; color: var(--ms-primary) !important; }
  #main-app .ms-quick-wrap .quick-action-label {
    color: #6b7c78 !important; font-size: 12px;
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  #main-app .page-content:has(.ms-head) > #backup-warn,
  #main-app .page-content:has(.ms-head) > #perm-req-alert,
  #main-app .page-content:has(.ms-head) > #daily-sign-bar,
  #main-app .page-content > .ms-land-left > #backup-warn,
  #main-app .page-content > .ms-land-left > #perm-req-alert,
  #main-app .page-content > .ms-land-left > #daily-sign-bar { display: none !important; }
  #main-app .content-area:has(.page-content .ms-head) { padding-top: env(safe-area-inset-top); }
  #main-app .page-content > .ms-land-right > .content-grid { width: 100%; min-width: 0; }
  #main-app .ms-home-feed-card { width: 100%; min-width: 0; overflow: hidden; padding: 14px; border-radius: 16px !important; }
  #main-app .ms-home-feed-card .card-flow,
  #main-app .ms-home-feed-card .ms-feed { width: 100%; min-width: 0; gap: 0; }
  #main-app .ms-home-feed-card .ms-feed-row { width: 100%; min-width: 0; box-sizing: border-box; }
  #main-app .ms-home-feed-card .ms-feed-row[hidden],
  #main-app .ms-home-feed-card [data-ms-todo-items][hidden] { display: none !important; }
  #main-app .ms-home-feed-card .card-header { margin-bottom: 2px; color: var(--ms-ink-2) !important; }
  #main-app .ms-home-feed-card .card-title { color: var(--ms-ink-2) !important; font-size: 15px; }
  #main-app .ms-home-feed-card #view-all-projects { border: 0 !important; background: transparent; padding: 4px 0 4px 8px; color: var(--ms-sub-2) !important; font-size: 12px; }
  #main-app .ms-home-feed-card #recent-projects-flow > .flow-row { display: none !important; }
  #main-app .ms-home-feed-card .ms-feed:empty { display: none; }
  #main-app .ms-feed-title { color: var(--ms-ink-2) !important; font-weight: 700; }
  #main-app .ms-feed-sub, #main-app .ms-feed-time { color: var(--ms-sub-2) !important; }
  #main-app .ms-feed-arrow { color: #c2d0ce !important; }
  #main-app .ms-feed-ico { color: var(--ms-primary) !important; }
  #main-app .ms-feed-ico.orange { background: #fdf1e3; color: #e08a2e !important; }
  #main-app .ms-feed-ico.purple { background: #f2edfd; color: #7c5cd6 !important; }
  #main-app .ms-feed-ico.gray { background: #edf3ef; color: #789186 !important; }
  #main-app .ms-feed-ico.red { background: #fdeeee; color: #d85757 !important; }
  #main-app .ms-chip.teal { color: #0f9185 !important; }
  #main-app .ms-chip.amber { color: #d88420 !important; }
  #main-app .ms-chip.gray { color: #789186 !important; background: #edf3ef; }
  #main-app .ms-chip.green { color: #15803d !important; }
  #main-app .ms-chip.purple { color: #6d43c8 !important; }
  #main-app .ms-chip.red { color: #c0392b !important; }
  #main-app .ms-banner b { color: #1f5f58 !important; }
  #main-app .ms-banner span { color: #5b7a74 !important; }

  /* 管理端底栏：首页 / 项目 / 考勤 / 财务 / 我的 */
  #main-app .bottom-nav { background: #fff !important; border-top: 1px solid var(--ms-line) !important; }
  #main-app .bottom-nav [data-page="tasks"],
  #main-app .bottom-nav [data-page="customer"] { display: none !important; }
  #main-app .bottom-nav.wx-tabbar .nav-item { font-size: 10px; color: #9aa8a4 !important; }
  #main-app .bottom-nav.wx-tabbar .nav-item.active { color: var(--ms-primary) !important; font-weight: 700; }
  #main-app .bottom-nav .nav-item.active svg { color: var(--ms-primary) !important; stroke: currentColor; stroke-width: 2; }

  /* 底栏图标：未选中一律线性轮廓，仅选中项主色填充（首页即实心房子） */
  #main-app .bottom-nav .nav-item svg path,
  #designer-app .wx-tabbar .wx-tab svg path,
  #worker-app .wx-tabbar .wx-tab svg path { fill: none; stroke: currentColor; }
  #main-app .bottom-nav .nav-item.active svg path,
  #designer-app .wx-tabbar .wx-tab.active svg path,
  #worker-app .wx-tabbar .wx-tab.active svg path { fill: currentColor; stroke: currentColor; }
}

/* ===== 11. ≤360px 小屏降级：只压字号与内边距，不强制单列 ===== */
@media (max-width: 360px) {
  :root {
    --ms-fs-greet: 20px;
    --ms-fs-value: 18px;
    --ms-fs-title: 14px;
    --ms-pad-card: 12px;
    --ms-ico-circle: 30px;
  }
  .ms-head { padding-left: 13px; padding-right: 13px; }
  .ms-head-art { width: 108px; height: 80px; top: 60px; }
  .ms-head-slogan { top: 140px; right: 8px; }
  .ms-head-slogan b { font-size: 13px; }
  .ms-stat { padding: 0 7px; }
  .ms-quick-ico { width: 42px; height: 42px; }
  .ms-banner-art { width: 108px; height: 66px; }
}

/* 首页栏容器仅用于横屏；竖屏与桌面透明展开，不改变原视觉结构 */
#main-app .ms-land-col,
#designer-app .ms-land-col,
#worker-app .ms-land-left { display: contents; }
/* 施工端右栏在竖屏/单列承接原 .wm-overlap 的左右留白，不另加上下间距 */
#worker-app .ms-land-right { display: block; padding: 0 9px; }

/* ===== 12. 手机横屏：紧凑、居中弹层、安全区；竖屏与桌面不命中 ===== */
@media (orientation: landscape) and (max-width: 768px),
  (orientation: landscape) and (min-width: 769px) and (max-width: 900px) and (hover: none),
  (orientation: landscape) and (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (orientation: landscape) and (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  :root {
    --ms-fs-greet: 19px;
    --ms-fs-value: 18px;
    --ms-fs-title: 14px;
    --ms-pad-card: 11px;
    --ms-gap-card: 8px;
    --ms-ico-circle: 30px;
  }
  #main-app .page-content,
  #designer-app .dm-body,
  #worker-app .wm-body { overflow-x: hidden; }
  /* 横屏搜索与操作按钮自动换行，不再靠内部横向滚动才能点到 */
  #main-app .page-content > .search-bar { flex-wrap: wrap; overflow-x: hidden; row-gap: 6px; }
  #main-app .page-content > .search-bar .search-input { flex: 1 1 180px; }
  #main-app .page-content {
    padding-top: 8px !important;
    padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    padding-left: calc(12px + env(safe-area-inset-left)) !important;
    padding-right: calc(12px + env(safe-area-inset-right)) !important;
  }
  #main-app .page-header.wx-nav {
    height: calc(40px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) calc(68px + env(safe-area-inset-right)) 0 calc(68px + env(safe-area-inset-left));
  }
  #main-app .content-area { padding-top: calc(40px + env(safe-area-inset-top)); }
  #main-app .content-area:has(.page-content .ms-head) { padding-top: 0; }
  #main-app .page-header.wx-nav .page-title { font-size: 16px; }
  #main-app .page-header.wx-nav .ph-actions { top: calc(env(safe-area-inset-top) + 3px); }

  .ms-head {
    min-height: 116px;
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 12px calc(12px + env(safe-area-inset-left));
    border-radius: 16px;
    box-sizing: border-box;
  }
  /* 设计师端横屏：头顶留出两行标语（含 Better Homes，含倾斜外扩） */
  #designer-app .ms-head { min-height: 142px; }
  #main-app .ms-head { padding-top: 8px; }
  #main-app .page-content .ms-head { margin-left: 0; margin-right: 0; }
  .ms-head-top { min-height: 32px; }
  .ms-brand-logo { width: 28px; height: 28px; flex-basis: 28px; }
  .ms-brand-txt b { font-size: 14px; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.15; letter-spacing: 0; }
  /* 双栏左栏约 335px：保留身份胶囊，隐藏重复姓名，给完整品牌名让位 */
  .ms-head .mv-name { display: none; }
  .ms-head-actions { flex-shrink: 0; gap: 4px; }
  #main-app .ms-head .ms-role-pill { width: 26px; height: 26px; }
  .ms-icon-btn { width: 30px; height: 30px; flex-basis: 30px; }
  .ms-exit { min-height: 30px; padding: 0 3px; }
  .ms-greet-row { margin-top: 6px; max-width: calc(100% - 88px); }
  .ms-greet { font-size: 19px; line-height: 1.2; }
  .ms-greet-sub {
    margin-top: 4px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
  .ms-head-art { width: 72px; height: 46px; right: 5px; top: 38px; }
  .ms-head-slogan { right: 5px; top: 82px; width: 92px; }
  .ms-head-slogan b { font-size: 11px; line-height: 1.2; }
  .ms-head-slogan i { display: none; }
  #designer-app .ms-head-slogan { top: 86px; }
  #designer-app .ms-head-slogan i { display: block; font-size: 7px; }

  .ms-card, #main-app .ms-quick-wrap, #main-app .ms-home-feed-card { padding: 10px; }
  .ms-card-hd, .ms-quick .ms-card-hd { margin-bottom: 6px; }
  .ms-stats { padding: 9px 5px; }
  .ms-stat { padding: 0 7px; gap: 2px; }
  .ms-stat-ico { margin-bottom: 2px; }
  .ms-stat-label { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
  .ms-stat-sub { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .ms-quick-grid { gap: 4px; }
  .ms-quick-item { min-height: 40px; gap: 4px; padding-top: 2px; padding-bottom: 2px; }
  .ms-quick-ico,
  #main-app .ms-quick-wrap .quick-action-btn { width: 38px; height: 38px; }
  .ms-quick-ico svg,
  #main-app .ms-quick-wrap .quick-action-btn svg { width: 18px; height: 18px; }
  #main-app .ms-quick-wrap .quick-actions-title { margin-bottom: 7px; }
  #main-app .ms-quick-wrap .quick-action-item { gap: 4px; }
  .ms-quick-label, #main-app .ms-quick-wrap .quick-action-label { font-size: 11px; }
  .ms-feed-row { min-height: 44px; padding: 7px 0; gap: 8px; }
  .ms-feed-ico { width: 32px; height: 32px; flex-basis: 32px; }
  .ms-feed-ico svg { width: 16px; height: 16px; }
  .ms-feed-title, .ms-feed-sub {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
  .ms-feed-sub { margin-top: 2px; }
  .ms-banner { min-height: 64px; padding: 9px 12px; }
  .ms-banner b { font-size: 14px; line-height: 1.3; }
  .ms-banner span { margin-top: 3px; font-size: 10px; }
  .ms-banner-art { width: 92px; height: 58px; }

  #main-app .bottom-nav.wx-tabbar,
  #designer-app .wx-tabbar,
  #worker-app .wx-tabbar {
    height: calc(48px + env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  #main-app .bottom-nav.wx-tabbar .nav-item,
  #designer-app .wx-tab,
  #worker-app .wx-tab { min-height: 46px; font-size: 10px; }
  #main-app .bottom-nav.wx-tabbar .icon-svg,
  #designer-app .wx-tab-ico,
  #worker-app .wx-tab-ico,
  #designer-app .wx-tab-ico svg,
  #worker-app .wx-tab-ico svg { width: 19px; height: 19px; }
  #designer-app .dm-body,
  #worker-app .wm-body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  #designer-app .dm-head:not(.ms-head),
  #worker-app .wm-head:not(.ms-head) {
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: 10px;
    padding-left: calc(14px + env(safe-area-inset-left));
    padding-right: calc(14px + env(safe-area-inset-right));
  }
  #designer-app .dm-head-title,
  #worker-app .wm-head-title { min-height: 34px; font-size: 18px; }
  #designer-app .dm-head-sub,
  #worker-app .wm-head-sub { margin-top: 3px; line-height: 1.35; }
  #designer-app .dm-overlap,
  #worker-app .wm-overlap { padding-top: 8px; }
  #designer-app .dm-card,
  #worker-app .wm-card { padding: 11px; margin-bottom: 8px; }
  #designer-app .dm-card-title,
  #worker-app .wm-card-title { margin-bottom: 7px; }

  /* 横屏内所有 Sheet / 弹窗居中限宽，内容区内部滚动，不裁图片和表单 */
  .modal-overlay,
  .dm-sheet-mask,
  .wm-sheet-mask,
  .mv-mask {
    align-items: center !important;
    justify-content: center !important;
    padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)) !important;
  }
  .modal-overlay .modal,
  .modal-overlay.modal-sheet .modal {
    width: min(680px, 100%) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    margin: auto !important;
    border-radius: 14px !important;
    animation: modalIn .18s ease !important;
  }
  .modal-overlay .modal.modal-view { width: min(900px, 100%) !important; height: min(75vh, 100%); }
  .modal-overlay .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .modal-overlay .modal-header { padding-top: 10px !important; padding-bottom: 10px !important; }
  .modal-overlay .modal-header::before { display: none; }
  .modal-overlay .modal-footer { padding-top: 8px !important; padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
  .dm-sheet,
  .wm-sheet,
  .mv-sheet {
    width: min(640px, 100%);
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto;
    border-radius: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: modalIn .18s ease;
  }
  .dm-np-addrsheet .dm-sheet { height: min(86vh, 100%); }
  .dm-sheet img, .wm-sheet img, .modal img, .dm-card img, .wm-card img { max-width: 100%; height: auto; }
  .dm-photo img { height: 100%; }
  .dm-photo-grid { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
  .ss-dropdown { width: min(560px, calc(100vw - 32px)) !important; max-width: calc(100vw - 32px) !important; }
  #mp-layer {
    inset: 0 auto 0 50%;
    width: min(780px, 100%);
    transform: translateX(-50%);
    box-shadow: 0 0 0 100vmax rgba(15, 45, 42, .35);
  }
  #mp-layer .mp-head { height: calc(42px + env(safe-area-inset-top)); }
  #mp-layer .mp-foot { padding-top: 7px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* ===== 13. 宽度 ≥640 且高度 ≥360：双栏；低高度/窄屏继续原单列 ===== */
@media (orientation: landscape) and (min-width: 640px) and (min-height: 360px) and (max-width: 768px),
  (orientation: landscape) and (min-width: 769px) and (min-height: 360px) and (max-width: 900px) and (hover: none),
  (orientation: landscape) and (min-width: 769px) and (min-height: 360px) and (max-width: 900px) and (pointer: coarse),
  (orientation: landscape) and (min-width: 769px) and (min-height: 360px) and (max-width: 900px) and (pointer: none) {
  #main-app .page-content:has(> .ms-land-left > .ms-head),
  #designer-app .dm-body:has(> .ms-land-left > .ms-head),
  #worker-app .wm-body:has(> .ms-land-left > .ms-head) {
    --ms-land-left: calc(42% - 6px);
    --ms-land-right: calc(58% - 6px);
  }
  #designer-app .dm-body:has(> .ms-land-left > .ms-head),
  #worker-app .wm-body:has(> .ms-land-left > .ms-head) {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }
  /* 下拉提示是临时浮层，不能作为第三个 flex 项多占一道栏间距 */
  #designer-app .dm-body:has(> .ms-land-left > .ms-head) > .dm-pull {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
  }
  /* 激活时只预留顶部高度，不新增第三个 flex 项，也不盖住头部 */
  #designer-app .dm-body:has(> .ms-land-left > .ms-head):has(> .dm-pull.on) { padding-top: 50px; }

  /* 管理端普通首页与主管首页：两个独立栏容器，原卡片及事件节点不变 */
  #main-app .page-content:has(> .ms-land-left > .ms-head) {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }
  #main-app .page-content > .ms-land-col {
    display: block;
    min-width: 0;
    box-sizing: border-box;
  }
  #main-app .page-content > .ms-land-left { flex: 0 0 var(--ms-land-left); }
  #main-app .page-content > .ms-land-right { flex: 0 0 var(--ms-land-right); }
  #main-app .ms-land-left > .ms-head { width: 100%; margin: 0 0 8px; }
  #main-app .ms-land-left > .ms-home-stats { width: 100%; margin: 0 0 8px; }
  #main-app .ms-land-left > .ms-quick-wrap,
  #main-app .ms-land-left > .ms-mobile-only:has(> .ms-quick) { width: 100%; margin: 0; }
  #main-app .ms-land-left .ms-mobile-only > .ms-stats { margin-top: 0; }
  #main-app .ms-land-right > .content-grid,
  #main-app .ms-land-right > .sup-grid,
  #main-app .ms-land-right > .ms-mobile-only:has(> .ms-banner) { width: 100%; min-width: 0; box-sizing: border-box; }
  #main-app .ms-land-right > .content-grid { display: block !important; }
  #main-app .ms-land-right > .content-grid > .ms-home-feed-card { margin: 0; }
  #main-app .ms-land-right > .ms-mobile-only:has(> .ms-banner) { margin-top: 8px; }
  #main-app .ms-land-right > .sup-grid { display: block; }
  #main-app .sup-grid > .sup-queue-card { margin-bottom: 8px; }
  #main-app .sup-grid > .sup-side { display: block; }
  #main-app .sup-grid > .sup-side > .card { margin-bottom: 8px; }

  /* 管理端内页原有的内容网格，在足够宽时恢复双列 */
  #main-app .page-content:not(:has(.ms-head)) > .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  /* 设计师端 / 施工端首页：独立栏容器，避免浮动覆盖与右栏下沉 */
  #designer-app .dm-body:has(> .ms-land-left > .ms-head),
  #worker-app .wm-body:has(> .ms-land-left > .ms-head) {
    padding-top: 8px;
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  #designer-app .dm-body > .ms-land-col,
  #worker-app .wm-body > .ms-land-col {
    display: block;
    min-width: 0;
    box-sizing: border-box;
  }
  #designer-app .dm-body > .ms-land-left,
  #worker-app .wm-body > .ms-land-left { flex: 0 0 var(--ms-land-left); }
  #designer-app .dm-body > .ms-land-right,
  #worker-app .wm-body > .ms-land-right { flex: 0 0 var(--ms-land-right); }
  #designer-app .ms-land-left > .ms-head,
  #worker-app .ms-land-left > .ms-head { width: 100%; margin: 0 0 8px; }
  #designer-app .ms-land-col > .wx-home.ms-home { width: 100%; padding: 0; background: transparent; }
  #designer-app .ms-land-left .ms-stats,
  #worker-app .ms-land-left .ms-stats { margin-top: 0; }
  #worker-app .ms-land-left > .wm-overlap { margin-top: 0 !important; padding: 0; }
  #worker-app .wm-body > .ms-land-right { padding: 0; }

  /* 三端内页：多卡片自动双列；表单、照片、对比与表格卡保持通栏，单卡不硬压半栏 */
  #designer-app .dm-body > .dm-overlap,
  #worker-app .wm-body:not(:has(> .ms-land-left > .ms-head)) > .wm-overlap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  #designer-app .dm-overlap > *,
  #worker-app .wm-body:not(:has(> .ms-land-left > .ms-head)) > .wm-overlap > * { width: 100%; min-width: 0; }
  #designer-app .dm-overlap > .dm-card,
  #worker-app .wm-body:not(:has(> .ms-land-left > .ms-head)) > .wm-overlap > .wm-card {
    width: calc(50% - 5px);
    margin: 0;
  }
  #designer-app .dm-overlap > .dm-card:only-child,
  #worker-app .wm-body:not(:has(> .ms-land-left > .ms-head)) > .wm-overlap > .wm-card:only-child,
  #designer-app .dm-overlap > .dm-card:has(form, .dm-photo-grid, .dm-cmp, table),
  #worker-app .wm-body:not(:has(> .ms-land-left > .ms-head)) > .wm-overlap > .wm-card:has(form, table) { width: 100%; }
}

/* ===== 13. 五端竖屏头部：同一张水彩房屋 + 两行手写标语，完整不裁切 ===== */
@media (orientation: portrait) {
  /* 五端统一：插画 140×100（right 8 / top 52）与标语 15px/8px 走基础样式，不再按端压小 */
  #main-app .ms-head,
  #designer-app .ms-head,
  #worker-app .ms-head { min-height: 226px; }
  #designer-app .ms-greet-sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; }
}

/* ===== 11. 项目页手机端：白卡列表 + 筛选胶囊行（PC 表格与 PC 筛选不动） ===== */
#project-ms-list { display: none; }
@media (max-width: 768px),
  (min-width: 769px) and (max-width: 900px) and (hover: none),
  (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  .pj-pc-only { display: none !important; }
  #project-ms-list { display: block; padding: 2px 2px 0; }
  .pj-ms-card { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(15,60,55,.06); cursor: pointer; }
  .pj-ms-card:active { background: #f4faf8; }
  .pj-ms-card.pinned { box-shadow: 0 1px 3px rgba(15,60,55,.06), inset 2px 0 0 var(--primary, #00B5A5); }
  .pj-ms-head { display: flex; align-items: center; gap: 8px; }
  .pj-ms-check { width: 16px; height: 16px; flex-shrink: 0; margin: 0; accent-color: var(--primary, #00B5A5); }
  .pj-ms-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: #17302c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pj-ms-pin { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: #b6c4c0; }
  .pj-ms-pin.on { color: #e8a13c; }
  .pj-ms-stage { flex-shrink: 0; font-size: 11px; line-height: 1.2; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
  .pj-ms-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: #5c6e6b; white-space: nowrap; overflow: hidden; }
  .pj-ms-line svg { flex-shrink: 0; color: #8aa39d; }
  .pj-ms-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pj-ms-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(15,60,55,.12); font-size: 12px; color: #5c6e6b; }
  .pj-ms-foot svg { flex-shrink: 0; color: #9fb3ad; }
  .pj-ms-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pj-search-bar { flex-wrap: wrap !important; overflow-x: visible !important; row-gap: 8px; }
  .pj-search-bar > .search-input:first-child { flex: 1 1 100%; }
  .pj-search-bar #project-type-filter { flex: 0 0 auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pj-search-bar .type-filter-btn { background: #fff; border-color: rgba(15,60,55,.12); color: #5c6e6b; min-height: 32px; }
  .pj-search-bar .type-filter-btn.active { background: rgba(0,181,165,.14); border-color: transparent; color: #0f9185; font-weight: 600; }
  .pj-search-bar .search-select { border-radius: 999px; background: #fff; border: 1px solid rgba(15,60,55,.12); color: #5c6e6b; }
  .pj-search-bar #project-time-custom { flex: 1 1 100%; }
}

/* ===== 14. 项目详情手机端：信息白卡 + 浅色操作 + 横滚标签（PC 不命中） ===== */
@media (max-width: 768px),
  (min-width: 769px) and (max-width: 900px) and (hover: none),
  (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  #main-app .content-area:has(.page-content > .pd-hero) { background: var(--ms-page); }

  /* 头部信息卡：字段与占位文案不变，仅收进白卡 */
  #main-app .page-content > .pd-hero {
    padding: 15px 16px 14px !important;
    margin: 2px 0 10px;
    background: #fff;
    border: 1px solid var(--ms-line);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(15, 60, 55, 0.05);
    box-sizing: border-box;
  }
  #main-app .pd-hero-title {
    margin: 0;
    color: var(--ms-ink) !important;
    font-size: 20px !important;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }
  #main-app .pd-hero-meta { gap: 6px; margin-top: 9px; }
  #main-app .pd-hero-customer,
  #main-app .pd-hero-meta .badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 2px 9px;
    border: 1px solid rgba(0, 181, 165, 0.12) !important;
    border-radius: 999px !important;
    background: var(--ms-primary-soft) !important;
    color: var(--ms-primary-deep) !important;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
  }
  #main-app .pd-hero-customer { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #main-app .pd-hero-addr {
    align-items: center;
    gap: 4px 9px;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px dashed var(--ms-line-dash);
    font-size: 11px;
  }
  #main-app .pd-hero-addr-t {
    flex: 1 1 150px;
    min-width: 0;
    color: #5b6f6b !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #main-app .pd-hero-geo { flex: 1 1 100%; font-size: 10px; color: #8a9a97 !important; }
  #main-app .pd-hero-map { min-height: 30px; display: inline-flex; align-items: center; color: #009e90 !important; white-space: nowrap; }

  /* 现有五档项目状态：步骤点与连线，不画无数据支撑的百分比 */
  #main-app .pd-stage-strip { position: relative; display: flex !important; margin-top: 12px; }
  #main-app .pd-stage-step { position: relative; flex: 1 1 0; min-width: 0; text-align: center; }
  #main-app .pd-stage-step::before {
    content: '';
    position: absolute;
    left: -50%; top: 9px;
    width: 100%;
    border-top: 2px solid #dcebe7;
  }
  #main-app .pd-stage-step:first-child::before { display: none; }
  #main-app .pd-stage-step.done::before { border-color: var(--ms-primary); }
  #main-app .pd-stage-dot {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #edf3f1;
    color: #9fb3ad !important;
  }
  #main-app .pd-stage-step.done .pd-stage-dot { background: var(--ms-primary); color: #fff !important; }
  #main-app .pd-stage-dot svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.2; }
  #main-app .pd-stage-name {
    display: block;
    margin-top: 5px;
    color: #9aaaA6 !important;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
  }
  #main-app .pd-stage-step.done .pd-stage-name { color: #52716a !important; }
  #main-app .pd-stage-step.current .pd-stage-name { color: #009e90 !important; font-weight: 700; }

  /* 顶部操作：浅色紧凑胶囊，保留原按钮 id 与全部事件 */
  #main-app .pd-actions { gap: 6px !important; margin-bottom: 10px !important; }
  #main-app .pd-actions > button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 9px !important;
    border: 1px solid rgba(15, 118, 110, 0.16) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #3d5450 !important;
    box-shadow: none !important;
    font-size: 11.5px !important;
    font-weight: 500;
    text-decoration: none;
  }
  #main-app .pd-actions > #btn-edit-project,
  #main-app .pd-actions > #btn-space-layout { background: var(--ms-primary-soft) !important; color: #0f766e !important; }
  #main-app .pd-actions > #btn-worker-mode.on { background: #fff6e8 !important; color: #b4690e !important; border-color: #f1d5aa !important; }
  #main-app .pd-actions > button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
  #main-app .pd-readonly { border-radius: 12px !important; background: #eef8f5 !important; color: #0f766e !important; }

  /* 详情标签：白卡内横滚，选中青绿加粗 */
  #main-app #detail-tabs {
    gap: 0;
    margin-bottom: 12px;
    padding: 0 5px;
    border: 1px solid var(--ms-line) !important;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 60, 55, 0.04);
    scrollbar-width: none;
  }
  #main-app #detail-tabs::-webkit-scrollbar { display: none; }
  #main-app #detail-tabs .tab-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 0 11px !important;
    border: 0 !important;
    color: #6b7c78 !important;
    font-size: 12.5px !important;
    font-weight: 500;
  }
  #main-app #detail-tabs .tab-item > svg { display: none; }
  #main-app #detail-tabs .tab-item.active { color: #009e90 !important; font-weight: 700; }
  #main-app #detail-tabs .tab-item.active::after {
    content: '';
    position: absolute;
    left: 50%; bottom: 4px;
    width: 20px; height: 3px;
    border-radius: 2px;
    background: #00b5a5;
    transform: translateX(-50%);
  }

  /* 各标签页统一白底圆角卡与虚线分隔 */
  #main-app #tab-content .card {
    padding: 14px !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--ms-line) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 2px 9px rgba(15, 60, 55, 0.045) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #main-app #tab-content .card > .card-header {
    gap: 7px;
    margin-bottom: 11px !important;
    padding: 0 0 10px !important;
    border-bottom: 1px dashed var(--ms-line-dash) !important;
    background: transparent !important;
  }
  #main-app #tab-content .card-title {
    min-width: 0;
    color: #17302c !important;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #main-app #tab-content .badge { border-radius: 999px !important; }
  #main-app #tab-content .pd-kv-row { padding: 5px 0; border-bottom: 1px dashed var(--ms-line-dash); line-height: 1.5; }
  #main-app #tab-content .pd-kv-row:last-child { border-bottom: 0; }
  #main-app #tab-content .pd-kv-label { flex-basis: 76px; }
  #main-app #tab-content .pd-kv-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 列表仍沿用原点击展开逻辑；只统一分隔、省略与卡片观感 */
  #main-app #tab-content .data-table.mobile-list tbody tr {
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--ms-line-dash) !important;
    border-radius: 0;
  }
  #main-app #tab-content .data-table.mobile-list tbody tr:last-child { border-bottom: 0 !important; }
  #main-app #tab-content .data-table.mobile-list tbody tr[data-mob-row="1"]:not(.mob-expanded) { height: 52px; min-height: 52px; }
  #main-app #tab-content .data-table.mobile-list tbody tr.mob-expanded { background: #fbfdfc; }
  #main-app #tab-content .data-table.mobile-list tbody td { font-size: 12px; }
  #main-app #tab-content .data-table.mobile-list tbody td[data-label]::before { font-size: 11px; }
  #main-app #tab-content .data-table.mobile-list tbody td:not(:last-child) > span,
  #main-app #tab-content .data-table.mobile-list tbody td:not(:last-child) > div,
  #main-app #tab-content .data-table.mobile-list tbody td:not(:last-child) > a {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 项目内容：汇总操作与新增入口改为浅青，不再使用深色悬浮大块 */
  #main-app #tab-content .btn {
    border-radius: 999px !important;
    box-shadow: none !important;
  }
  #main-app #tab-content .btn-primary,
  #main-app #tab-content [data-add-subitem-tag] {
    border: 1px solid rgba(0, 181, 165, 0.14) !important;
    background: var(--ms-primary-soft) !important;
    color: #0f9185 !important;
  }
  #main-app #tab-content > .card[style*="sticky"] > div > div:last-child { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: 4px; }
  #main-app #tab-content > .card[style*="sticky"] .pd-toolbar-btn { height: 34px !important; min-height: 34px !important; }
  #main-app #btn-add-content {
    position: static !important;
    width: auto !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    border: 1px solid rgba(0, 181, 165, 0.14) !important;
    border-radius: 999px !important;
    background: var(--ms-primary-soft) !important;
    color: #0f9185 !important;
    box-shadow: none !important;
    font-size: 12px !important;
    line-height: 1 !important;
  }
  #main-app #btn-add-content::after { display: none; }
  #main-app #content-groups .group-head-right { width: 100%; flex-wrap: wrap; gap: 6px; margin-left: 0; }
  #main-app #content-groups .group-head-right > span { max-width: 100%; margin-left: 0 !important; overflow: hidden; text-overflow: ellipsis; }
  #main-app #content-groups .card-title > span:first-child { min-width: 0; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis; }
  #main-app #content-groups .group-subtotal { color: #009e90 !important; }
  #main-app #tab-content .content-item {
    margin-bottom: 10px;
    border: 1px solid var(--ms-line) !important;
    border-radius: 12px;
    background: #fff;
  }
  #main-app #tab-content .content-item-header { padding: 12px !important; flex-wrap: wrap; }
  #main-app #tab-content .content-item:has(> .content-item-body:not([style*="display: none"])) > .content-item-header { border-bottom: 1px dashed var(--ms-line-dash) !important; }
  #main-app #tab-content .content-item-body { padding: 0 12px !important; background: #fbfdfc; }
  #main-app #tab-content .content-item-specs .spec-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 文档留证与工程节点沿用原入口和状态，仅统一单行省略及圆角 */
  #main-app #tab-content .doc-folder-card { border-radius: 999px !important; }
  #main-app #tab-content .site-photo-loc,
  #main-app #tab-content .site-photo-by { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app #tab-content .site-photo-note { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app #tab-content .progress-child { border-radius: 12px !important; }
}

@media (max-width: 360px) {
  #main-app .page-content > .pd-hero { padding: 13px 12px 12px !important; }
  #main-app .pd-hero-title { font-size: 18px !important; }
  #main-app .pd-stage-name { font-size: 9px; }
  #main-app .pd-actions > button { padding: 0 8px !important; font-size: 11px !important; }
  #main-app #detail-tabs .tab-item { padding: 0 10px !important; font-size: 12px !important; }
  #main-app #tab-content .card { padding: 12px !important; }
}

/* ===== 15. 财务中心手机端：三统计卡 + 四本账白卡行（PC 不命中） ===== */
.fin-ms-stats, .fin-ms-cards { display: none; }
@media (max-width: 768px),
  (min-width: 769px) and (max-width: 900px) and (hover: none),
  (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  #main-app .content-area:has(.fin-ms-stats) { background: var(--ms-page); }
  #main-app .finance-scope-note { margin: 2px 2px 9px !important; font-size: 10px !important; line-height: 1.5; }

  /* 三张统计卡永远保留位置；无权限时由 JS 只填入“-” */
  #main-app .fin-ms-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 2px 0 12px;
    padding: 13px 7px;
    border: 1px solid var(--ms-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 60, 55, 0.05);
  }
  #main-app .fin-ms-stat {
    min-width: 0;
    padding: 0 9px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    border-right: 1px dashed var(--ms-line-dash);
  }
  #main-app .fin-ms-stat:last-child { border-right: 0; }
  #main-app .fin-ms-stat[data-fin-ms-stat] { cursor: pointer; }
  #main-app .fin-ms-stat-ico {
    width: 30px; height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    border-radius: 9px;
    background: var(--ms-primary-soft);
    color: var(--ms-primary) !important;
  }
  #main-app .fin-ms-stat-ico svg { width: 16px; height: 16px; color: inherit !important; stroke: currentColor; fill: none; }
  #main-app .fin-ms-stat.green .fin-ms-stat-ico { background: #e9f7f3; color: #0f9185 !important; }
  #main-app .fin-ms-stat.amber .fin-ms-stat-ico { background: #fff5e5; color: #d89224 !important; }
  #main-app .fin-ms-stat.red .fin-ms-stat-ico { background: #fff0ee; color: #d85757 !important; }
  #main-app .fin-ms-stat-label { max-width: 100%; color: #6b7c78 !important; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app .fin-ms-stat-value {
    max-width: 100%;
    color: #17302c !important;
    font-size: clamp(13px, 4vw, 20px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.35px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  #main-app .fin-ms-stat.green .fin-ms-stat-value { color: #0f766e !important; }
  #main-app .fin-ms-stat.amber .fin-ms-stat-value { color: #b45309 !important; }
  #main-app .fin-ms-stat.red .fin-ms-stat-value { color: #c0392b !important; }

  /* 四本账沿用原按钮和事件，只换成可横滚浅青分段 */
  #main-app .finance-tabs {
    flex-wrap: nowrap !important;
    gap: 3px !important;
    margin-bottom: 12px !important;
    padding: 4px;
    overflow-x: auto;
    border: 0 !important;
    border-radius: 13px;
    background: #e6f3f0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #main-app .finance-tabs::-webkit-scrollbar { display: none; }
  #main-app .finance-tabs .finance-tab {
    flex: 1 0 auto;
    min-height: 38px;
    padding: 0 14px;
    border: 0 !important;
    border-radius: 10px;
    background: transparent;
    color: #5b6f6b !important;
    font-size: 12px;
    white-space: nowrap;
  }
  #main-app .finance-tabs .finance-tab > svg { display: none; }
  #main-app .finance-tabs .finance-tab.active { background: #fff; color: #009e90 !important; font-weight: 700; box-shadow: 0 1px 5px rgba(15, 60, 55, 0.08); }

  /* 搜索、筛选、导出、登记均保留原控件与可见性 */
  #main-app #finance-tab-panel > .search-bar { flex-wrap: wrap; gap: 7px; overflow-x: visible; margin-bottom: 10px; }
  #main-app #finance-tab-panel > .search-bar > .search-input:first-child { flex: 1 1 100%; }
  #main-app #finance-tab-panel > .search-bar .search-select { flex: 1 1 140px; min-width: 0; border: 1px solid var(--ms-line); border-radius: 999px; background: #fff; }
  #main-app #finance-tab-panel > .search-bar .btn { flex: 0 0 auto; min-height: 40px; border-radius: 999px; box-shadow: none; }
  #main-app #finance-tab-panel > .search-bar #btn-new-payment,
  #main-app #finance-tab-panel > .search-bar #btn-add-expense { flex: 1 1 100%; }
  #main-app #finance-tab-panel > .card {
    margin-bottom: 12px;
    border: 1px solid var(--ms-line) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 2px 9px rgba(15, 60, 55, 0.045) !important;
  }
  #main-app #finance-tab-panel .fin-pc-table,
  #main-app #finance-tab-panel .table-container:has(> .fin-pc-table) { display: none !important; }
  #main-app #finance-tab-panel .fin-ms-cards { display: block; padding: 0 13px; }
  #main-app #finance-tab-panel .fin-group { border-bottom: 0; }
  #main-app #finance-tab-panel .fin-group + .fin-group { margin-top: 9px; border-top: 1px dashed var(--ms-line-dash); }
  #main-app #finance-tab-panel .fin-group-header { min-height: 48px; gap: 7px; padding: 11px 13px; border-bottom: 1px dashed var(--ms-line-dash); background: #fff; }
  #main-app #finance-tab-panel .fin-group-title { min-width: 0; color: #17302c !important; font-size: 13px; }
  #main-app #finance-tab-panel .fin-group-title svg { width: 16px; height: 16px; color: #009e90 !important; stroke: currentColor; }
  #main-app #finance-tab-panel .fin-group-meta { gap: 7px; color: #8a9a97 !important; font-size: 10px; }
  #main-app #page-content[data-fin-money="0"] .fin-group-meta span[style] { display: none; }

  /* 左图标 / 主标题与副行 / 右状态与金额 */
  #main-app .fin-ms-card { padding: 13px 0; border-bottom: 1px dashed var(--ms-line-dash); }
  #main-app .fin-ms-card:last-child { border-bottom: 0; }
  #main-app .fin-ms-card[data-fin-payment],
  #main-app .fin-ms-card[data-fin-cost] { cursor: pointer; }
  #main-app .fin-ms-card-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
  #main-app .fin-ms-ico {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--ms-primary-soft);
    color: #009e90 !important;
  }
  #main-app .fin-ms-ico.green { background: #e9f7ef; color: #16a34a !important; }
  #main-app .fin-ms-ico.amber { background: #fff4e3; color: #d97706 !important; }
  #main-app .fin-ms-ico.red { background: #fff0ee; color: #dc2626 !important; }
  #main-app .fin-ms-ico.purple { background: #f2edfd; color: #7c3aed !important; }
  #main-app .fin-ms-ico svg { width: 19px; height: 19px; color: inherit !important; stroke: currentColor; fill: none; }
  #main-app .fin-ms-main { flex: 1 1 auto; min-width: 0; }
  #main-app .fin-ms-title { color: #17302c !important; font-size: 14px; font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app .fin-ms-sub { margin-top: 4px; color: #8a9a97 !important; font-size: 11px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app .fin-ms-side { flex: 0 0 auto; max-width: 43%; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
  #main-app .fin-ms-side .ms-chip { height: 19px; padding: 0 7px; font-size: 10px; }
  #main-app .fin-ms-amount { color: #17302c !important; font-size: 14px; font-weight: 800; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
  #main-app .fin-ms-amount.green { color: #16a34a !important; }
  #main-app .fin-ms-amount.teal { color: #009e90 !important; }
  #main-app .fin-ms-amount.amber { color: #d97706 !important; }
  #main-app .fin-ms-amount.red { color: #dc2626 !important; }
  #main-app .fin-ms-amount.purple { color: #7c3aed !important; }
  #main-app .fin-ms-amount.gray { color: #9ca3af !important; }
  #main-app .fin-ms-actions { display: flex; gap: 5px; margin-top: 8px; padding-bottom: 1px; overflow-x: auto; scrollbar-width: none; }
  #main-app .fin-ms-actions::-webkit-scrollbar { display: none; }
  #main-app .fin-ms-actions .btn {
    flex: 0 0 auto;
    min-height: 30px;
    height: 30px;
    padding: 0 9px !important;
    border: 1px solid rgba(0, 181, 165, 0.12) !important;
    border-radius: 999px !important;
    background: #f2f9f7 !important;
    color: #52716a !important;
    box-shadow: none !important;
    font-size: 10.5px;
  }
  #main-app .fin-ms-actions .btn.danger { color: #c0392b !important; background: #fff6f5 !important; }
  #main-app .fin-ms-actions .doclink-badge { flex: 0 0 auto; }

  /* 待收期次：沿用原展开状态与 PaymentPlan 数据，只换成紧凑卡 */
  #main-app .fin-ms-periods { margin: 10px 0 0 48px; padding: 9px 10px; border-radius: 10px; background: #f6faf9; }
  #main-app .fin-ms-periods-title { margin-bottom: 5px; color: #6b7c78 !important; font-size: 10px; line-height: 1.5; }
  #main-app .fin-ms-period { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--ms-line-dash); }
  #main-app .fin-ms-period:last-child { border-bottom: 0; }
  #main-app .fin-ms-period > div:first-child { min-width: 0; }
  #main-app .fin-ms-period b { display: block; color: #3d5450 !important; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app .fin-ms-period span { display: block; margin-top: 3px; color: #8a9a97 !important; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main-app .fin-ms-period-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  #main-app .fin-ms-period-side strong { color: #3d5450 !important; font-size: 11px; white-space: nowrap; }
}

@media (max-width: 360px) {
  #main-app .fin-ms-stats { padding: 11px 4px; }
  #main-app .fin-ms-stat { padding: 0 6px; }
  #main-app .fin-ms-stat-label { font-size: 10px; }
  #main-app .fin-ms-stat-value { font-size: clamp(12px, 3.8vw, 15px); }
  #main-app #finance-tab-panel .fin-ms-cards { padding: 0 11px; }
  #main-app .fin-ms-ico { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
  #main-app .fin-ms-title { font-size: 13px; }
  #main-app .fin-ms-amount { font-size: 12.5px; }
  #main-app .fin-ms-periods { margin-left: 0; }
}

/* ===== 16. 设计师 / 施工端二级页：白卡动态行（PC 与旧宽屏不命中） ===== */
@media (max-width: 768px),
  (min-width: 769px) and (max-width: 900px) and (hover: none),
  (min-width: 769px) and (max-width: 900px) and (pointer: coarse),
  (min-width: 769px) and (max-width: 900px) and (pointer: none) {
  #designer-app .dm-overlap > .dm-card,
  #designer-app .dm-overlap > .wx-block,
  #worker-app .wm-overlap > .wm-card {
    border: 1px solid var(--ms-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 60, 55, 0.05);
  }
  #designer-app .dm-overlap > .wx-block { margin-bottom: 12px; overflow: hidden; }
  #designer-app .wx-block-title { padding: 13px 14px 8px; color: #17302c; font-size: 13px; font-weight: 700; }

  #designer-app .dm-tk-row,
  #designer-app .dm-row,
  #designer-app .dm-step,
  #designer-app .wx-row,
  #designer-app .wx-block .wx-row,
  #worker-app .wm-row {
    box-sizing: border-box;
    height: auto;
    min-height: 56px;
    min-width: 0;
    padding: 10px 0;
    gap: 10px;
    border-bottom: 1px dashed var(--ms-line-dash);
    background: transparent;
  }
  #designer-app .wx-block .wx-row { padding-right: 14px; padding-left: 14px; }
  #designer-app .dm-tk-row:last-child,
  #designer-app .dm-row:last-child,
  #designer-app .dm-step:last-child,
  #designer-app .wx-row:last-child,
  #designer-app .wx-block .wx-row:last-child,
  #worker-app .wm-row:last-child { border-bottom: 0; }
  #designer-app .dm-tk-main,
  #designer-app .dm-row-main,
  #designer-app .dm-step-main,
  #designer-app .wx-main,
  #worker-app .wm-row-body { flex: 1 1 auto; min-width: 0; }

  #designer-app .dm-tk-title,
  #designer-app .dm-row-title,
  #designer-app .dm-step-name,
  #designer-app .wx-name,
  #worker-app .wm-row-title {
    color: #17302c;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
  }
  #designer-app .dm-tk-meta,
  #designer-app .dm-row-sub,
  #designer-app .dm-step-desc,
  #designer-app .wx-sub,
  #worker-app .wm-row-sub {
    display: block;
    margin-top: 3px;
    color: #8a9a97;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
  }

  #designer-app .wx-avatar,
  #designer-app .dm-step-ico,
  #worker-app .wm-row-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    background: #e7f5f2;
    color: #0f9185;
    font-size: 13px;
  }
  #designer-app .wx-avatar svg,
  #designer-app .dm-step-ico svg,
  #worker-app .wm-row-avatar svg {
    width: 18px;
    height: 18px;
    color: inherit !important;
    stroke: currentColor !important;
    fill: none;
    stroke-width: 1.9;
  }
  #designer-app .dm-step.done .dm-step-ico { background: #e8f8ef; color: #15803d; }
  #worker-app .wm-row-avatar.orange { background: #fdf1e3; color: #e08a2e; }
  #worker-app .wm-row-avatar.gray { background: #f1f5f4; color: #8a9a97; }
  #designer-app .dm-arrow,
  #worker-app .wm-row-arrow { flex: 0 0 auto; color: #c2d0ce; font-size: 18px; line-height: 1; }

  #designer-app .wx-right { flex: 0 0 auto; max-width: 42%; margin-left: auto; }
  #designer-app .wx-next,
  #designer-app .wx-time,
  #designer-app .dm-tk-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 130px;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f4;
    color: #6b7c78;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #designer-app .dm-tag,
  #worker-app .wm-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 3px;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    line-height: 1.2;
    white-space: nowrap;
  }
  #designer-app .dm-tk-act { flex: 0 0 auto; }
  #designer-app .dm-tk-btn,
  #designer-app .dm-tk-btn.primary {
    min-height: 30px;
    height: 30px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: #e3f6f3;
    color: #0f766e;
    font-size: 11px;
  }
  #designer-app .dm-step .dm-btn {
    min-width: 64px !important;
    min-height: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
  }
  #designer-app .dm-rc-head { margin-bottom: 10px; }
  #designer-app .dm-rc-head .dm-tag { max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
  #designer-app .dm-card[data-ho-open] > .dm-row { margin-bottom: 6px; }
  #worker-app .wm-row-right { flex: 0 0 auto; max-width: 42%; }
  #worker-app .wm-row-amount { white-space: nowrap; }
}

@media (max-width: 360px) {
  #designer-app .dm-card,
  #worker-app .wm-card { padding: 12px; }
  #designer-app .dm-tk-row,
  #designer-app .dm-row,
  #designer-app .dm-step,
  #designer-app .wx-row,
  #worker-app .wm-row { gap: 8px; padding-top: 9px; padding-bottom: 9px; }
  #designer-app .wx-avatar,
  #designer-app .dm-step-ico,
  #worker-app .wm-row-avatar { width: 34px; height: 34px; flex-basis: 34px; }
  #designer-app .dm-tk-title,
  #designer-app .dm-row-title,
  #designer-app .dm-step-name,
  #designer-app .wx-name,
  #worker-app .wm-row-title { font-size: 13px; }
  #designer-app .dm-tk-meta,
  #designer-app .dm-row-sub,
  #designer-app .dm-step-desc,
  #designer-app .wx-sub,
  #worker-app .wm-row-sub { font-size: 10px; }
  #designer-app .wx-next,
  #designer-app .wx-time { max-width: 96px; }
}

