:root {
  --brand: #0f6f5f;
  --brand-dark: #0a5348;
  --brand-soft: rgba(15, 111, 95, 0.10);
  --brand-line: rgba(15, 111, 95, 0.22);
  --bg: #f4f7f6;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --text: #1a2e29;
  --text-2: #4b5a56;
  --muted: #6b7a76;
  --line: rgba(15, 111, 95, 0.10);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.10);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(10, 83, 72, 0.08);
  --nav-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* ★手机稳定性：禁止横向拖动与回弹（左右滑不再晃）。
   只在 html 上 hidden——body 加 hidden 会破坏顶栏的 sticky；
   支持 clip 的新内核用 clip，效果相同且不产生滚动容器。 */
html {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@supports (overflow-x: clip) {
  body { overflow-x: clip; }
}
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;      /* 长地址 / 长货号换行，不撑宽页面 */
  touch-action: manipulation;     /* 去掉双击放大，点按更跟手 */
}
button, input, select, textarea { font: inherit; color: inherit; }
/* iOS 原生按钮有默认立体样式，统一去掉，各端观感一致 */
button { -webkit-appearance: none; appearance: none; }
/* 按钮类元素：禁长按系统菜单 / 禁选中，点按更像原生 App */
.btn, .chip, .quick, .icon-btn, .nav-item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
a { color: var(--brand); text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- boot ---------- */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(165deg, #e7f4f1 0%, #f4f7f6 60%, #bfe0d9 100%);
  color: #0f6f5f; z-index: 90;
}
.boot-logo {
  width: 68px; height: 68px; border-radius: 22px;
  background: rgba(15, 111, 95, 0.10);
  border: 1px solid rgba(15, 111, 95, 0.25);
  box-shadow: 0 8px 32px rgba(15, 111, 95, 0.14);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600; letter-spacing: 2px;
}
.boot-text { font-size: 14px; opacity: .75; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(15, 111, 95, .18); border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.page {
  flex: 1;
  padding: 14px 14px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  max-width: 720px; width: 100%; margin: 0 auto;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .5px; }
.topbar .sub { font-size: 12px; opacity: .75; margin-top: 2px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn {
  background: rgba(15, 111, 95, .08); border: 1px solid var(--brand-line);
  color: var(--brand); border-radius: 10px; padding: 6px 10px; font-size: 13px; cursor: pointer;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  display: flex;
}
.nav-item {
  flex: 1; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; padding: 0;
  transition: color .15s ease;
}
.nav-item:active { opacity: .55; }
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item.active {
  color: var(--brand);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  width: 48px; height: 32px;
  background: var(--brand-soft);
  border-radius: 16px;
  opacity: 1;
  z-index: -1;
}
.nav-item.active svg { stroke-width: 2.2; }

/* ---------- card ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
  border: 1px solid rgba(15, 111, 95, 0.06);
}
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-size: 14px; font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card-title .tag { font-size: 11px; font-weight: 400; color: var(--muted); }
.section-label { font-size: 12px; color: var(--muted); margin: 20px 4px 8px; letter-spacing: .5px; text-transform: uppercase; }

/* ---------- hero / dashboard ---------- */
.welcome-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.welcome-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; flex: 0 0 auto;
}
.welcome-text { flex: 1; min-width: 0; }
.welcome-greet { font-size: 16px; font-weight: 600; color: var(--text); }
.welcome-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.hero-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(15, 111, 95, 0.06);
  margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 0;
  justify-content: flex-start;
  min-height: 228px;
}
.hero-card.me-hero {
  display: flex;
  flex-direction: column;
  min-height: 228px;
}
.hero-card.has-trend { cursor: pointer; }
.hero-card.has-trend:active { transform: scale(.995); }
.hero-left { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.hero-right { min-width: 0; }
.hero-head { display: flex; align-items: center; justify-content: space-between; height: 24px; margin-bottom: 10px; flex: 0 0 auto; }
.hero-title { font-size: 15px; font-weight: 600; color: var(--text); }
.hero-badge {
  font-size: 11px; color: var(--brand); font-weight: 500;
  background: var(--brand-soft); padding: 3px 9px; border-radius: 12px;
}
.hero-value {
  font-size: 34px; font-weight: 700; margin-top: 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -.8px; color: var(--text);
  height: 46px; line-height: 46px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 0 0 auto;
}
.hero-value small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.hero-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--ok); margin-top: 8px; font-weight: 500;
  background: var(--ok-soft); padding: 4px 10px; border-radius: 20px;
  height: 26px; flex: 0 0 auto;
}
.hero-trend.down { color: var(--danger); background: var(--danger-soft); }
.hero-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 16px; }
.metric-pill {
  flex: 1; min-width: 0; background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 12px; border: 1px solid var(--line);
}
.metric-pill .mp-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.metric-pill .mp-value {
  font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 欠款类指标（如客户页「待收总额」）红色强调，与全局欠款红色语义一致 */
.metric-pill .mp-value.danger { color: var(--danger); }

.todo-chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.todo-chips::-webkit-scrollbar { display: none; }
.todo-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  min-height: 44px; padding: 7px 15px; font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.todo-chip:active { transform: scale(.96); background: var(--brand-soft); }
.todo-chip .tc-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: 0 0 auto;
}
.todo-chip .tc-dot.warn { background: var(--warn); }
.todo-chip .tc-dot.danger { background: var(--danger); }
.todo-chip .tc-count {
  min-width: 18px; height: 18px; border-radius: 9px; background: var(--brand-soft);
  color: var(--brand); font-size: 11px; font-weight: 600; text-align: center; line-height: 18px;
  padding: 0 5px;
}
/* 待办数字跟随紧急程度：红=欠款/异常，橙=次紧急 */
.todo-chip .tc-count.danger { background: var(--danger-soft); color: var(--danger); }
.todo-chip .tc-count.warn { background: var(--warn-soft); color: #b45309; }

.order-cta { display: flex; gap: 10px; margin-bottom: 12px; }
.order-cta-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 6px; background: var(--brand); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.order-cta-btn:active { opacity: .9; transform: scale(.985); }
.order-cta-icon { font-size: 24px; line-height: 1; }
.order-cta-label { font-size: 15px; font-weight: 600; }

.dashboard-grid { display: block; }
.dashboard-main, .dashboard-side { display: block; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 4px 8px;
}
.section-head .section-label { margin: 0; }
.section-head .section-more {
  font-size: 12px; color: var(--brand); cursor: pointer; font-weight: 500;
}

.row-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.row-mini:last-child { border-bottom: 0; padding-bottom: 0; }
.row-mini:first-child { padding-top: 0; }
.row-mini .rm-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto;
}
.row-mini .rm-dot.ok { background: var(--ok); }
.row-mini .rm-dot.warn { background: var(--warn); }
.row-mini .rm-dot.danger { background: var(--danger); }
.row-mini .rm-main { flex: 1; min-width: 0; }
.row-mini .rm-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-mini .rm-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-mini .rm-tail { text-align: right; font-size: 13px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.row-mini .rm-tail .rm-tail-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.row-mini .rm-tail .rm-tail-sub.is-warn { color: var(--danger); font-weight: 600; }

/* ---------- kpi ---------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  border: 1px solid rgba(15, 111, 95, 0.06); box-shadow: var(--shadow);
  position: relative; overflow: hidden; min-width: 0;
}
.kpi::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-line);
}
.kpi.is-ok::before { background: var(--ok); }
.kpi.is-warn::before { background: var(--warn); }
.kpi .k-label { font-size: 12px; color: var(--muted); }
.kpi .k-value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .k-foot { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi.is-ok .k-value { color: var(--ok); }
.kpi.is-warn .k-value { color: var(--warn); }
.kpi.is-warn { background: linear-gradient(180deg, var(--card) 0%, rgba(217, 119, 6, 0.06) 100%); }

/* ---------- quick grid ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* 工作台快捷入口：开单已单独做主按钮，剩 8 个入口，手机 2 列更舒展、宽屏 4 列 */
.dashboard-main .quick-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) {
  .dashboard-main .quick-grid { grid-template-columns: repeat(4, 1fr); }
}
.quick {
  border: 1px solid var(--line); background: var(--bg-elevated); border-radius: var(--radius-sm);
  padding: 14px 6px; text-align: center; cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: transform .08s ease, background .15s ease;
}
.quick:active { background: var(--brand-soft); transform: scale(.97); }
.quick .qi {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0 auto 7px;
  background: var(--brand-soft);
  border-radius: 13px; font-size: 24px; line-height: 1;
}

/* ---------- list rows ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; background: var(--card);
}
.row:last-child { border-bottom: 0; }
.row:active { background: rgba(15, 111, 95, 0.04); }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { font-size: 14px; font-weight: 500; color: var(--text); }
.row .r-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .r-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; }
.row .r-phone { color: var(--brand); font-weight: 600; font-size: 13px; }
.row .r-addr { color: var(--text-2); font-size: 12px; }
.row .r-tail { font-size: 12px; color: var(--muted); text-align: right; }
.chev { color: var(--muted); font-size: 15px; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .ei { font-size: 28px; display: block; margin-bottom: 8px; opacity: .5; }

/* ---------- 商业化空状态（新手引导） ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text); }
.empty-state .es-icon {
  width: 80px; height: 80px; margin: 0 auto 18px;
  color: var(--brand); display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); border-radius: 24px;
}
.empty-state .es-icon svg { width: 100%; height: 100%; padding: 18px; }
.empty-state .es-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.empty-state .es-desc { font-size: 13px; color: var(--muted); margin: 0 auto 20px; max-width: 280px; line-height: 1.7; }
.empty-state .es-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.empty-state .es-actions .btn { padding: 8px 18px; font-size: 14px; width: auto; flex-shrink: 0; }
.empty-state .es-hint {
  display: inline-block; margin-top: 16px; font-size: 12.5px; color: var(--brand);
  text-decoration: none; cursor: pointer;
}
.empty-state .es-hint:active { opacity: .7; }

/* 列表分页「加载更多」（客户多的大店一屏一屏往下翻） */
.load-more { padding: 12px 16px 16px; }
.load-more .btn { width: 100%; }

/* ---------- 骨架屏 ----------
   切页时先按这一页的形状把灰条摆好，数据一到原地换成真内容。
   纯静态、不加动画：老内核（微信内置浏览器）也零负担，绝不会是新的卡顿源。 */
.sk { background: rgba(15, 111, 95, 0.10); border-radius: 6px; display: block; }
.sk-l { height: 12px; }
.sk-l.sm { height: 10px; }
/* 列表行占位：对齐 .row 的尺寸，换真内容时不会跳 */
.sk-row { padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.sk-row:last-child { border-bottom: 0; }
.sk-row .sk-l { width: 40%; }
.sk-row .sk-l + .sk-l { width: 66%; height: 10px; margin-top: 9px; }
/* KPI 占位 */
.sk-kpi {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  border: 1px solid rgba(15, 111, 95, 0.06); box-shadow: var(--shadow);
}
.sk-kpi .sk-l { width: 54%; }
.sk-kpi .sk-l.v { width: 70%; height: 22px; margin-top: 10px; }
.sk-kpi .sk-l.f { width: 42%; height: 10px; margin-top: 9px; }
/* 卡片里的若干条灰线 */
.sk-card {
  background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  border: 1px solid rgba(15, 111, 95, 0.06); box-shadow: var(--shadow);
}
.sk-card .sk-l { width: 38%; }
.sk-card .sk-l + .sk-l { width: 58%; margin-top: 13px; }
/* 条形图占位（报表 12 个月） */
.sk-bars { display: flex; align-items: flex-end; gap: 7px; height: 96px; padding: 0 2px; }
.sk-bars i { flex: 1; background: rgba(15, 111, 95, 0.10); border-radius: 4px 4px 0 0; }
/* 菜单行占位（「我的」等纯菜单页） */
.sk-menu { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.sk-menu:last-child { border-bottom: 0; }
.sk-menu .sk-l { width: 34%; height: 13px; }

/* ---------- form ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
/* 表单弹窗的普通字段：宽屏两列，少滚动（full 项 / 更多区不受影响，仍通栏） */
.form-grid { display: grid; grid-template-columns: 1fr; }
/* 勾选行（登录页「记住账号密码」等） */
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: -2px 0 14px; cursor: pointer; user-select: none; }
.check-row input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 111, 95, .12); }
.input::placeholder { color: var(--muted); }
/* 只读（自动算出来的字段，比如「未付款」） */
.input.ro, .input[readonly] { background: rgba(15, 111, 95, 0.05); color: var(--text-2); }
.row-inline { display: flex; gap: 8px; }
.row-inline .input { flex: 1; }
/* 联想输入的外层包（.row-inline 里要能拉伸，否则输入框比同排其他输入短一截） */
.row-inline .combo-wrap { flex: 1 1 auto; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { background: var(--brand-dark); transform: scale(.985); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--brand-line); }
.btn.plain { background: var(--bg-elevated); color: var(--text-2); border-color: var(--line); }
.btn.danger { background: rgba(220, 38, 38, 0.10); color: var(--danger); border-color: rgba(220, 38, 38, 0.20); }
.btn.sm { width: auto; padding: 8px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; }
/* 按压反馈：轻微缩一下，操作感更「稳」 */
.quick:active { transform: scale(.97); }
.chip:active { transform: scale(.96); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 460px; margin: 0 auto; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 12px;
  background: linear-gradient(160deg, #128573, #0a5348); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600;
}
.auth-head h1 { font-size: 20px; margin: 0 0 4px; color: var(--text); }
.auth-head p { margin: 0; font-size: 13px; color: var(--muted); }
.tabs { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 16px; border: 1px solid var(--line); }
.tabs button {
  flex: 1; border: 0; background: none; padding: 9px 0; border-radius: 10px;
  font-size: 14px; color: var(--text-2); cursor: pointer;
}
.tabs button.on { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: 0 2px 8px rgba(10, 83, 72, .10); }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.btn.sm { white-space: nowrap; }
.auth-note { font-size: 12px; color: var(--text-2); background: var(--bg-elevated); border-radius: 10px; padding: 10px 12px; margin-top: 14px; line-height: 1.6; border: 1px solid var(--line); }

/* 桌面端登录页：左侧品牌区 + 右侧表单（手机端隐藏品牌区，保持原样） */
.auth-side { display: none; }
@media (min-width: 768px) {
  .auth-wrap {
    max-width: none; min-height: 100vh;
    display: flex; flex-direction: row; align-items: stretch;
    padding: 0; margin: 0; justify-content: flex-start;
  }
  .auth-side {
    display: flex; align-items: center; justify-content: center;
    flex: 1 1 56%;
    background: linear-gradient(160deg, #128573, #0a5348);
    color: #fff; padding: 48px;
  }
  .auth-side-inner { max-width: 430px; }
  .auth-side-logo {
    width: 64px; height: 64px; border-radius: 20px;
    background: rgba(255, 255, 255, 0.16); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 600;
  }
  .auth-side h2 { font-size: 27px; font-weight: 700; color: #fff; margin: 22px 0 8px; letter-spacing: 1px; }
  .auth-side-sub { font-size: 15px; color: rgba(255, 255, 255, 0.72); margin: 0; }
  .auth-side-points { margin: 36px 0 0; padding: 0; list-style: none; display: grid; gap: 16px; }
  .auth-side-points li { color: rgba(255, 255, 255, 0.92); font-size: 15px; padding-left: 28px; position: relative; }
  .auth-side-points li::before {
    content: '✓'; position: absolute; left: 0; top: 0;
    color: #7ee2c8; font-weight: 700;
  }
  .auth-main {
    flex: 1 1 44%; max-width: 560px; margin: 0 auto;
    display: flex; flex-direction: column; justify-content: center;
    padding: 32px 24px;
  }
  .auth-main .auth-head { margin-bottom: 8px; }
}

/* ---------- toast / modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 26px);
  transform: translate(-50%, 12px);
  background: rgba(26, 46, 41, .96); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 13px;
  max-width: 84vw; text-align: center; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(10, 83, 72, 0.18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(127, 29, 29, .96); border-color: rgba(220, 38, 38, 0.20); }
.toast.ok { background: rgba(6, 78, 59, .96); border-color: rgba(22, 163, 74, 0.20); }

/* ★滚动容器：老内核加惯性滚动；滑到头不再把底下的页面带着晃（滚动穿透） */
.modal, .pick-list, .combo-list, .draft-list, .bill-imgs {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-root { position: fixed; inset: 0; z-index: 70; }
.modal-layer { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(10, 30, 26, .55); }
.modal {
  position: relative; background: var(--bg-elevated); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto; animation: up .22s ease;
  border: 1px solid rgba(15, 111, 95, 0.08);
  border-bottom: 0;
  transition: transform .18s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.modal-head.no-title { margin-bottom: 0; justify-content: flex-end; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--text); flex: 1; min-width: 0; }
.modal-x { flex: 0 0 auto; width: 44px; height: 44px; margin-right: -10px; border: none; background: transparent; color: var(--muted); font-size: 24px; line-height: 44px; cursor: pointer; text-align: center; padding: 0; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.modal-x:active { background: rgba(15, 111, 95, 0.10); }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- misc ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; background: var(--brand-soft); color: var(--brand); }
.badge.gray { background: rgba(15, 111, 95, 0.06); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: #b45309; }
.stat-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; color: var(--text-2); }
.stat-line:last-child { border-bottom: 0; }
/* 数据概览卡：两列排布，压缩高度，让侧栏更紧凑 */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.overview-grid .stat-line { min-width: 0; }
.stat-line b { font-variant-numeric: tabular-nums; color: var(--text); }
/* 标签永不折行；长值单行省略（悬停/长按看全） */
.stat-line > span { white-space: nowrap; flex: 0 0 auto; }
.stat-line .one-line { min-width: 0; margin-left: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.placeholder { text-align: center; padding: 34px 16px; color: var(--muted); }
.placeholder .pi { font-size: 34px; display: block; margin-bottom: 10px; opacity: .55; }
.placeholder h3 { color: var(--text); font-size: 15px; margin: 0 0 6px; }
.placeholder p { font-size: 13px; margin: 0 auto; max-width: 320px; line-height: 1.7; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-elevated); border-radius: 20px;
  padding: 5px 11px; font-size: 12.5px; color: var(--text-2); cursor: pointer;
  transition: transform .08s ease;
}
.chip:disabled { opacity: .4; cursor: not-allowed; }
/* 筛选行的标签 chip 与右侧按钮（btn.sm）等高对齐，避免「按钮高度不一」 */
.toolbar-sub .chip { padding: 8px 11px; }

/* 下单详情：大分段 tab（窗帘/辅材/安装下单） */
.seg-tab { flex: 1 1 0; min-width: 0; padding: 12px 6px; text-align: center; border: 1px solid var(--line); background: var(--bg-elevated); border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 下单详情：精简头部 + 折叠单据详情 */
.order-head-card { padding: 14px 16px; }
.order-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-head-left { flex: 1; min-width: 0; }
.order-head-right { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; max-width: 46%; }
.order-head-card .dh-title { white-space: nowrap; }
.order-head-meta { font-size: 13px; color: var(--text-2); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-head-meta .is-warn { color: var(--warn); font-weight: 600; }
.order-head-meta .is-ok { color: var(--ok); font-weight: 600; }
.order-fold { margin-top: 12px; border-top: 1px solid var(--line); }
.order-fold summary { font-size: 13px; color: var(--brand); cursor: pointer; padding: 10px 0; list-style: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.order-fold summary::-webkit-details-marker { display: none; }
.order-fold summary::after { content: ' ▾'; font-size: 11px; }
.order-fold[open] summary::after { content: ' ▴'; }
.fold-body { padding: 2px 0 6px; }
.chip.off { color: var(--muted); text-decoration: line-through; background: rgba(15, 111, 95, 0.04); }
.chip.add { border-style: dashed; color: var(--brand); }

/* ---------- M2 客户 / 开单 ---------- */
.toolbar { margin-bottom: 10px; }
.toolbar-sub { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-sub .btn.sm { width: auto; }
.btn-pair { margin-left: auto; display: flex; gap: 8px; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.badge.red { background: var(--danger-soft); color: #991b1b; }
.badge.ok { background: var(--ok-soft); color: #166534; }
.badge.blue { background: rgba(15, 111, 95, 0.10); color: var(--brand); }
/* 进行中：蓝色，与「已完成」的绿色一眼区分（蓝=进行中、绿=完成、灰=取消、红=欠款） */
.badge.progress { background: rgba(37, 99, 235, 0.10); color: #1d4ed8; }

.r-title .badge { margin-left: 6px; vertical-align: 1px; }
.r-tail .badge { margin-top: 4px; }
.r-tail .mono { font-variant-numeric: tabular-nums; }
.mono.strong { font-weight: 600; }
.r-sub + .r-sub { margin-top: 3px; }

.stat-line.is-ok b { color: var(--ok); }
.stat-line.is-warn b { color: var(--warn); }
.stat-line.is-warn { background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.06)); }
/* 详情里为空的字段：整行可点，直接补录 */
.stat-line.fill-row { cursor: pointer; margin: 0 -8px; padding: 9px 8px; border-radius: 8px; }
.stat-line.fill-row:active { background: var(--bg-elevated); }
.stat-line.fill-row .fill-hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.dh-title { font-size: 17px; font-weight: 600; color: var(--text); }
.dh-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.form-err:not(:empty) {
  margin-top: 10px; background: var(--danger-soft); color: #991b1b;
  border-radius: 10px; padding: 9px 12px; font-size: 13px; line-height: 1.6;
}

.pick-list { max-height: 52vh; overflow-y: auto; margin-top: 10px; border-top: 1px solid var(--line); }
.pick-item {
  padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; color: var(--text);
}
.pick-item:last-child { border-bottom: 0; }
.pick-item.on { color: var(--brand); font-weight: 600; }
.pick-item.add { color: var(--brand); border-bottom-style: dashed; }
.pick-item .pick-main { min-width: 0; }
.pick-item .pick-title { font-size: 14px; }
.pick-item .pick-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 客户输入联想（文档流内，不用浮层，避免被弹窗裁掉） ---------- */
.combo-list {
  margin-top: 6px; border: 1px solid var(--brand-line); border-radius: var(--radius-sm);
  background: var(--bg-elevated); max-height: 30vh; overflow-y: auto;
}
.combo-item { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.combo-item:last-child { border-bottom: 0; }
.combo-item:active { background: var(--brand-soft); }
.combo-item .pick-title { font-size: 14px; font-weight: 500; color: var(--text); }
.combo-item .pick-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 更多选项折叠 ---------- */
.more-box { margin: 2px 0 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.more-box > summary {
  list-style: none; cursor: pointer; font-size: 12.5px; color: var(--brand);
  display: flex; align-items: center; gap: 6px; padding: 2px 0 4px;
}
.more-box > summary::-webkit-details-marker { display: none; }
.more-box > summary::after { content: '展开'; margin-left: auto; font-size: 11px; color: var(--muted); }
.more-box[open] > summary::after { content: '收起'; }
.more-box[open] > summary { margin-bottom: 10px; }

/* 单据详情里的一键收款 */
.quick-pay { margin: 12px 0 4px; }

/* ---------- 客户扫码看进度：客户侧免登录页 ---------- */
.track-wrap { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.track-top {
  background: linear-gradient(160deg, #128573, #0a5348); color: #fff;
  padding: calc(20px + env(safe-area-inset-top)) 18px 22px;
}
.track-top-inner { max-width: 520px; margin: 0 auto; }
.track-shop, .track-title { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.track-sub { font-size: 12.5px; opacity: .75; margin-top: 3px; }
.track-body { padding: 14px 14px calc(34px + env(safe-area-inset-bottom)); }
.track-loading { padding: 90px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.track-status { border-left: 4px solid var(--brand); padding: 2px 0 2px 12px; margin-bottom: 18px; }
.track-status .ts-label { font-size: 12px; color: var(--muted); }
.track-status .ts-value { font-size: 26px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.5px; color: var(--text); }
.track-status .ts-note { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.track-status.is-done { border-left-color: var(--ok); }
.track-status.is-done .ts-value { color: var(--ok); }
.track-status.is-run .ts-value { color: var(--brand); }

.track-hero { margin-bottom: 14px; }
.track-hero.is-run { border-left: 4px solid var(--brand); }
.track-hero.is-done { border-left: 4px solid var(--ok); }
.track-hero.is-warn { border-left: 4px solid var(--warn); }
.track-hero.is-ok { border-left: 4px solid var(--ok); }

.steps { padding-top: 14px; border-top: 1px dashed var(--line); }
.step { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: -2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: rgba(15, 111, 95, 0.10); color: var(--muted);
}
.step.done .step-dot { background: var(--brand); color: #fff; }
.step-main { min-width: 0; padding-top: 1px; }
.step-title { font-size: 14.5px; font-weight: 500; color: var(--text); }
.step:not(.done) .step-title { color: var(--muted); }
.step-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.track-empty { padding: 96px 24px; text-align: center; color: var(--muted); }
.track-empty .ei { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
.track-empty h3 { color: var(--text); font-size: 16px; margin: 0 0 8px; }
.track-empty p { font-size: 13.5px; margin: 0 auto; max-width: 300px; line-height: 1.8; }

/* 分享弹窗里的二维码 */
.share-qr { text-align: center; padding: 6px 0 2px; }
.share-img { width: 230px; height: 230px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.share-no { font-size: 13px; color: var(--text-2); margin-top: 8px; letter-spacing: .5px; }

/* 列表加载中：压暗过渡，不再反复闪骨架 */
.card.flush { transition: opacity .15s ease; }
.card.flush.loading { opacity: .45; }

/* 「一键生成」预览窗：一行一条建议，可勾选、可改数字 */
.draft-list { max-height: 50vh; overflow: auto; margin: 2px -4px 0; }
.draft-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 6px; border-bottom: 1px solid var(--line);
}
.draft-row:last-child { border-bottom: 0; }
.draft-row.off { opacity: .42; }
.draft-pick { flex: 0 0 auto; padding-top: 4px; }
.draft-cb { width: 18px; height: 18px; accent-color: var(--brand); }
.draft-cells { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; min-width: 0; }
.draft-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.draft-label { font-size: 11px; color: var(--muted); }
.draft-cell .input { padding: 6px 8px; font-size: 13px; }

/* 明细行右侧：到货 / 删除 两个小按钮 */
.row .r-acts {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px;
}
.row .r-acts .btn.sm { width: auto; margin: 0; }
/* 明细行操作按钮：胶囊形 + 柔和配色 + 轻投影，精致不抢眼 */
.row .r-acts .btn.sm {
  border-radius: 999px; padding: 3px 12px; font-size: 11.5px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 60, 42, 0.06); letter-spacing: 0.5px;
}
.row .r-acts .btn.danger { background: #fff1f0; color: #c0392b; border-color: #f5c6c2; }
.row .r-acts .btn.danger:active { background: #ffe4e1; }
.row .r-acts .btn.ghost { background: var(--card); }
.btn.arrived-on {
  background: var(--ok-soft); color: #166534;
  border-color: transparent; font-weight: 600;
}
/* 已下单未到货：琥珀色，和「已到货」的绿色区分开 */
.btn.ordered-on {
  background: var(--warn-soft); color: #b45309;
  border-color: transparent; font-weight: 600;
}

/* 到货进度条 */
.arrive-bar { margin-bottom: 10px; }
.arrive-bar .detail-head { margin-bottom: 0; align-items: center; }

/* 窗帘明细行：带标签的字段网格（左列定宽 190，右列紧随其后——货号值末尾≈工艺行末尾；
   长值在各自列内换行，永不重叠。工艺和状态独立通栏行） */
.dv-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 5px 24px; font-size: 12.5px; }
.dv-cell { display: flex; min-width: 0; }
.dv-cell span { color: var(--muted); flex: 0 0 3em; }
.dv-cell b { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.dv-line { display: flex; margin-top: 5px; font-size: 12.5px; }
.dv-line span { color: var(--muted); flex: 0 0 3em; }
.dv-line b { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
/* 手机：单列竖排，字段值再长也不折行错位 */
@media (max-width: 640px) {
  .dv-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dv-line { font-size: 11.5px; }
}
/* ---------- 明细按厂家分组的组头（截屏整段发给对应工厂） ---------- */
.fg-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 7px;
  padding: 8px 16px 7px; background: var(--brand-soft);
}
/* 厂家名弹性占满（过长省略号）→ 操作按钮固定靠右，不随名字长度漂移；单号信息整行换到第二行 */
.fg-name { font-size: 13.5px; font-weight: 600; color: var(--brand); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-no { order: 9; flex: 1 1 100%; margin-left: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; line-height: 1.55; }
.fg-copy {
  flex: 0 0 auto; border: 1px solid var(--brand); color: var(--brand);
  background: var(--card); border-radius: 6px; padding: 2px 9px; font-size: 12px; cursor: pointer;
}
/* 一键下单：同厂家未到货行全标下单 + 出订货图片自动复制 */
.fg-order {
  flex: 0 0 auto; border: 1px solid var(--brand); color: #fff;
  background: var(--brand); border-radius: 6px; padding: 2px 9px; font-size: 12px; cursor: pointer;
}
/* 组级状态开关：未到货（可点 = 这一家全部到货）/ 已到货（静态） */
.fg-state {
  flex: 0 0 auto; border: 1px solid var(--line); color: var(--text-2);
  background: var(--card); border-radius: 6px; padding: 2px 9px; font-size: 12px; cursor: pointer;
}
.fg-state.arrived { border-color: var(--brand); color: var(--brand); cursor: default; }
/* 安装单整单信息行：电话地址一行带过 + 安装完成按钮 */
.fg-info {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.fg-contact { font-size: 12.5px; color: var(--text-2); min-width: 0; flex: 1; }
.fg-acts { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.fg-info .btn { flex: 0 0 auto; width: auto; margin: 0; }

/* 售后记录行 */
.sales-line {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.sales-line:last-child { border-bottom: 0; }
.sales-note { flex: 1; min-width: 0; color: var(--text-2); }
.sales-line .r-sub { flex: 0 0 auto; }
.sales-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.sales-acts .btn { width: auto; margin: 0; }

/* 厂家档案：一行一家，带已积累货号数 */
.fac-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.fac-row:last-child { border-bottom: 0; }
.fac-row .fac-main { flex: 1; min-width: 0; }
.fac-row .fac-name { font-size: 14.5px; color: var(--text); }
.fac-row .fac-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fac-row .fac-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.fac-row .fac-acts .btn.sm { width: auto; margin: 0; }

/* 一次加多个房间：一行一个房间 + 宽 / 高 / 下料米数 */
.pair-list { margin: 2px 0 0; }
.pair-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pair-row:last-child { border-bottom: 0; }
.pair-head { display: flex; align-items: center; gap: 8px; }
.pair-head .row-inline { flex: 1 1 auto; min-width: 0; }
.pair-head .row-inline .input { min-width: 0; }
.pair-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.pair-nums .input { min-width: 0; }
/* 成品尺寸块：每行头上标注对应房间名（随房间输入实时更新） */
.pair-size-tag { font-size: 12.5px; color: var(--muted); line-height: 1.2; }
/* 房间 + 类型并排一行：左右两列各占一半，和下方 form-grid 两列两端对齐（gap 与 grid 的 14px 一致） */
.room-cat-row { display: flex; gap: 14px; align-items: flex-start; }
.room-cat-row .rc-room { flex: 0 0 calc(50% - 7px); min-width: 0; }
.room-cat-row .rc-cat { flex: 0 0 calc(50% - 7px); }
.room-cat-row .rc-add { width: 100%; margin: 8px 0 0; padding: 7px 6px; font-size: 12.5px; line-height: 1.35; white-space: normal; }
/* 工艺点选 chips：拉通整列、两端对齐，高度与输入栏一致（仅窗帘下单更多区用 chip-fill） */
.chip-fill { flex-wrap: nowrap; }
.chip-fill .chip { flex: 1 1 0; text-align: center; padding: 12.5px 4px; font-size: 13px; border-radius: 10px; }

/* ---------- 返单 / 成本 ---------- */
.bill-imgs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.bill-thumb {
  width: 74px; height: 74px; object-fit: cover; flex: 0 0 auto;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-elevated);
}
.bill-full { width: 100%; max-height: 68vh; object-fit: contain; border-radius: var(--radius-sm); }
/* 回单登记拖拽/粘贴框 */
.bill-drop {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--bg-elevated);
  min-height: 130px; display: flex; align-items: center; justify-content: center;
  padding: 14px; margin: 10px 0 4px; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.bill-drop.on { border-color: var(--brand); background: rgba(15, 111, 95, 0.06); }
.bill-drop-big { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }
.bill-drop-empty .hint { margin: 2px 0; }
.bill-drop-thumbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; }
.bill-drop-thumb {
  position: relative; width: 104px; height: 104px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); overflow: hidden; background: var(--bg-elevated);
}
.bill-drop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.bill-drop-x {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; line-height: 20px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; cursor: pointer; padding: 0;
}
.bill-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 开单核对页头部字段容器：手机竖屏两列，横屏（wide）下自动多列 */
.bill-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bill-head .field { margin-bottom: 0; }
.bill-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.bill-grid2 .field { margin-bottom: 0; }
/* 回单比对 · 逐行逐字段对照清单 */
.bill-cmp-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px;
  background: var(--bg-elevated);
}
.bill-cmp-row.matched { border-color: #2f9e6e; }
.bill-cmp-head { font-weight: 600; margin-bottom: 6px; color: var(--text-1); }
.bill-cmp-cell { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.bill-cmp-label { flex: 0 0 56px; color: var(--text-2); }
.bill-cmp-ok { color: #2f9e6e; }
.bill-cmp-diff { color: #d64545; word-break: break-all; }
.bill-cmp-note { color: var(--text-3); }

.bill-grid3 .field { margin-bottom: 0; }
.btn.dim { opacity: 0.55; }
.bill-cell { min-width: 0; }
.bill-cell label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 4px; }
.bill-cell .input { padding: 7px 8px; font-size: 13.5px; min-width: 0; width: 100%; }
.bill-h { margin: 16px 0 8px; font-size: 13.5px; color: var(--brand); }
.bill-rows { display: grid; grid-template-columns: 1fr; gap: 0 12px; align-items: start; }
.bill-room-block { min-width: 0; }

/* 桌面端（≥768px，与左侧导航侧边栏同断点）：开单核对 / 下单表单 / 单据详情的 .wide 弹窗
   显示在内容区卡片位置（导航栏右侧、页头下方、四周留 .page 同款边距、最大宽 1240 居中）
   ——像列表页那张卡片，不铺满到屏幕边缘；平板与电脑一致，手机（<768px）保持原版式 */
@media (min-width: 768px) {
  .modal-root.wide-root .modal-layer {
    position: absolute; left: 260px; top: 0; right: 0; bottom: 0;
    align-items: stretch; justify-content: center;
    padding: 76px 28px 24px;      /* 顶部让出页头，左右与 .page 一致 */
    overflow-y: auto;
  }
  /* mask 用 inset:0 自动跟随 layer（layer 已从导航栏右侧开始），不要再偏移 */
  .modal-root.wide-root .modal.wide {
    max-width: 1240px; width: 100%; flex: 1 1 auto; height: auto; max-height: none;
    border-radius: 16px;
    border: 1px solid rgba(15, 111, 95, 0.08);
    padding: 20px 28px calc(28px + env(safe-area-inset-bottom));
    animation: none;   /* 卡片位置不做上滑动画 */
    box-shadow: 0 10px 30px rgba(10, 30, 26, .10);
  }
  /* 下单表单字段连续，auto-fit 按屏宽自适应（核对页宽屏走 .bill-tables 表格，不再渲染卡片字段） */
  .modal.wide .form-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 16px; }
  /* 开单核对页头部：横屏下短字段自动多列，输入框不再拉长 */
  .modal.wide .bill-head { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); column-gap: 16px; }
  .modal.wide .bill-row { padding: 10px 14px; }
  .modal.wide .bill-grid2 .row-inline .input { flex: 1 1 auto; min-width: 0; }
}
/* ≥1280px：导航栏 280px、.page 边距 32px，同步跟随 */
@media (min-width: 1280px) {
  .modal-root.wide-root .modal-layer { left: 280px; padding: 80px 32px 28px; }
}
/* 核对页电脑端表格化（2026-10-25）：≥900px 由 JS 渲染 .bill-tables（每房间一组：组头 + 窗帘明细表 + 辅材表）；
   手机与中屏仍走 .bill-rows 卡片式，样式互不影响 */
.bill-tables { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.bill-table-block { min-width: 0; }
.bill-table { margin: 0 0 4px; }
.bill-table .it-table-wrap { max-height: none; }
/* fixed 布局：表格永远铺满容器宽度、按列均分收窄，不出横向滚动条（用户 2026-10-25 定） */
.bill-table .it-table { table-layout: fixed; width: 100%; }
.bill-table .it-table th { white-space: normal; padding: 6px 5px; font-size: 12px; }
.bill-table .it-table.fab th:first-child { width: 5%; }     /* 序号 */
.bill-table .it-table.fab th:nth-child(2) { width: 9%; }     /* 类型 */
.bill-table .it-table.fab th:nth-child(3) { width: 15%; }    /* 窗帘厂家 */
.bill-table .it-table.fab th:nth-child(4) { width: 15%; }    /* 主材型号 */
.bill-table .it-table.fab th:nth-child(5) { width: 7%; }     /* 用料 */
.bill-table .it-table.fab th:nth-child(6) { width: 7%; }     /* 成品宽 */
.bill-table .it-table.fab th:nth-child(7) { width: 7%; }     /* 成品高 */
.bill-table .it-table.fab th:nth-child(8) { width: 9%; }     /* 开向 */
.bill-table .it-table.fab th:nth-child(9) { width: 16%; }    /* 工艺 */
.bill-table .it-table.fab th:last-child { width: 6%; }       /* 删 */
/* 辅材表列宽：安装位置/厂家/型号/安装方式宽，备注最宽 */
.bill-table .it-table.foot th:nth-child(1) { width: 10%; }
.bill-table .it-table.foot th:nth-child(2) { width: 13%; }
.bill-table .it-table.foot th:nth-child(3) { width: 11%; }
.bill-table .it-table.foot th:nth-child(4) { width: 13%; }
.bill-table .it-table.foot th:nth-child(5) { width: 12%; }
.bill-table .it-table.foot th:nth-child(6) { width: 13%; }
.bill-table .it-table.foot th:nth-child(7) { width: 22%; }
.bill-table .it-table.foot th:last-child { width: 6%; }
/* 按钮行：下移与组头/表格留距，垂直居中（用户 2026-10-25 定） */
.bill-table-btns { margin: 12px 0 14px; align-items: center; }
.bill-table .it-table td { padding: 5px 5px; vertical-align: middle; text-align: left; }
.bill-table .it-table td .input { width: 100%; min-width: 0; padding: 6px 5px; font-size: 12.5px; height: 34px; }
.bill-table .it-table td .row-inline { display: flex; gap: 4px; align-items: center; }
.bill-table .it-table td .row-inline .input { flex: 1 1 auto; min-width: 0; width: auto; }
.bill-table .it-table td .row-inline .btn.plain.sm { flex: 0 0 auto; }
.bill-table .it-table td .chip { padding: 3px 8px; font-size: 12px; }
.bill-table .it-table tbody tr { cursor: default; }
/* 工艺列纵向排：浓缩文本在上、「更多」按钮在下，窄列放得下 */
.bill-table .craft-col { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.bill-table .craft-col .btn { align-self: flex-start; }
.bill-craft-summary { font-size: 11.5px; color: var(--text-2); }
/* 分装时布/纱与各自辅材配对：侧标题条（布块 / 纱块） */
.bill-side-head {
  margin: 6px 0 6px; padding: 4px 10px; display: inline-block;
  font-size: 12.5px; font-weight: 600; color: var(--brand);
  background: rgba(15, 118, 110, 0.07); border-radius: 6px;
}
.bill-expand td { background: rgba(15, 118, 110, 0.04); }
.bill-expand .bill-cell { min-width: 150px; }
/* 宽屏（电脑横屏/平板上）：明细按房间双列铺开，减少上下滚动 */
@media (min-width: 768px) {
  .bill-rows { grid-template-columns: 1fr 1fr; }
}
.bill-room {
  margin: 10px 0 0; padding: 6px 10px;
  font-size: 13px; font-weight: 600; color: var(--brand);
  background: rgba(15, 118, 110, 0.07); border-radius: var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
/* 组头房间名输入框：融进组头条，点进去就能填/改房间 */
.bill-room-in {
  flex: 1; min-width: 0; border: none; background: transparent; padding: 2px 4px;
  font-size: 13px; font-weight: 600; color: var(--brand); height: auto;
}
.bill-room-in::placeholder { color: rgba(15, 118, 110, 0.55); font-weight: 500; }
.bill-room-in:focus { outline: none; box-shadow: 0 1px 0 var(--brand); border-radius: 0; }
.bill-room-ctrl {
  border: 1px dashed var(--line); border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 8px 10px 2px; margin-bottom: 8px;
  background: rgba(15, 118, 110, 0.03);
}
.bill-room-foot {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px 2px; margin-top: 2px; margin-bottom: 8px;
  background: rgba(15, 118, 110, 0.03);
}
/* 辅料栏标题栏：左标题 + 右「删」 */
.bill-foot-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bill-foot-title { font-size: 13px; font-weight: 600; color: var(--muted); }
/* 核对页行内「更多」工艺折叠区 */
.bill-more { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.bill-more > .btn { margin-bottom: 8px; }
/* 核对页：输入栏 / 选择 chips / 按钮高度统一（对齐窗帘厂家输入栏） */
.bill-row .input, .bill-room-foot .input { height: 36px; padding-top: 0; padding-bottom: 0; }
.bill-row .chip, .bill-room-foot .chip {
  height: 36px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.bill-row .btn.plain.sm, .bill-room-foot .btn.plain.sm {
  height: 36px; padding-top: 0; padding-bottom: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 日期输入统一左对齐（部分内核日期文字会居中） */
.bill-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px; margin-bottom: 8px;
}
.bill-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bill-row-no { font-size: 12px; color: var(--muted); }
.bill-row .bill-grid2 { margin-bottom: 8px; }
.bill-line {
  display: grid; grid-template-columns: 1fr 1.3fr .8fr .8fr .9fr; gap: 6px;
  padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px;
}
.bill-line.head { color: var(--muted); font-size: 11.5px; border-bottom: 1px solid var(--line); }
.bill-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bill-line span:nth-child(3), .bill-line span:nth-child(4), .bill-line span:nth-child(5) { text-align: right; }
.bill-issue {
  background: var(--warn-soft); color: #92400e; border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12.5px; margin: 8px 0; line-height: 1.65;
}
.bill-issue.info { background: rgba(15, 111, 95, 0.08); color: var(--brand); }
.bill-issue.warn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.bill-sum { margin-top: 10px; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bill-owner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.bill-owner-label { color: var(--text-2); }
.bill-owner .row-inline { margin-left: auto; }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }
.bill-total {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 10px;
}
.bill-total-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); padding: 3px 0; }
.bill-total-line b { font-variant-numeric: tabular-nums; color: var(--text); }
.bill-total-line.big { font-size: 15px; color: var(--text); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; }
.bill-total-line.big b { color: var(--brand); font-size: 17px; }

/* 单据详情里的成本块 */
.cost-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-top: 12px;
}
.cost-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cost-head h4 { margin: 0; font-size: 14px; color: var(--text); }
.cost-line { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.cost-line:last-child { border-bottom: 0; }
.cost-line .mono { font-variant-numeric: tabular-nums; }
.cost-line .cost-fac { flex: 1; min-width: 0; }
.cost-line .cost-acts { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; flex-shrink: 0; }
.cost-line .cost-acts .btn { padding: 1px 9px; font-size: 12px; line-height: 1.6; }
.cost-line.profit b { color: var(--brand); }
.cost-line.loss b { color: var(--danger); }
/* 成本卡：汇总行（主材返单/安装费/成本合计）加粗顶格、上方实线分隔；明细子项缩进淡化 */
.cost-line.cost-sum { border-top: 1px solid var(--line); border-bottom: 0; padding-top: 8px; margin-top: 2px; font-weight: 600; color: var(--text); }
.cost-line.cost-sum .mono { font-weight: 600; color: var(--text); }
.cost-line.cost-sub { padding-left: 16px; color: var(--text-2); }
.cost-line.cost-sub .mono { color: var(--text-2); }
.cost-sub-hint { padding-left: 16px; margin: 4px 0 6px; }
/* 漏厂家返单提醒：黄条，放在成本卡片顶部 */
.cost-miss {
  margin: 2px 0 6px; padding: 8px 10px;
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 8px;
  font-size: 12.5px; color: var(--warn); line-height: 1.5;
}

/* ---------- 桌面端：左侧导航（≥900px） ----------
   手机优先：窄屏仍走底部导航。宽屏把 .nav 从底部挪到左侧做常驻侧边栏。 */
.nav-brand { display: none; }

@media (min-width: 768px) {
  .app-shell { margin-left: 260px; }
  /* 宽屏弹窗居中显示（手机保持底部抽屉） */
  .modal-layer { align-items: center; padding: 40px 16px; box-sizing: border-box; }
  .modal { border-radius: 20px; border-bottom: 1px solid rgba(15, 111, 95, 0.08); max-height: 82vh; }

  .form-grid { grid-template-columns: 1fr 1fr; column-gap: 14px; }

  .nav {
    position: fixed; left: 0; top: 0; right: auto; bottom: 0;
    width: 260px; height: auto;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    padding-left: calc(18px + env(safe-area-inset-left));
    border-top: 0; border-right: 1px solid var(--line);
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 4px; overflow-y: auto; scrollbar-width: thin;
    background: var(--bg-elevated);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav::-webkit-scrollbar { width: 6px; }

  .nav-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 10px 22px; margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }
  .nav-logo {
    width: 44px; height: 44px; border-radius: 14px; flex: 0 0 auto;
    background: linear-gradient(160deg, #128573, #0a5348); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 600;
  }
  .nav-brand-text { flex: 1; min-width: 0; }
  .nav-brand-name { font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .nav-item {
    flex: 0 0 auto; width: 100%;
    flex-direction: row; justify-content: flex-start; align-items: center;
    gap: 12px; padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14.5px; color: var(--text-2);
    position: relative;
  }
  .nav-item:active { opacity: 1; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item:hover { background: rgba(15, 111, 95, 0.08); color: var(--brand); }
  .nav-item.active {
    color: #fff; background: var(--brand); font-weight: 600;
  }
  .nav-item.active::before { display: none; }
  .nav-item.active svg { stroke-width: 1.8; }

  .topbar { padding-left: 0; padding-right: 0; }
  .topbar-inner { padding-left: 28px; padding-right: 28px; max-width: 1240px; }

  .page {
    max-width: 1240px;
    padding: 24px 28px calc(40px + env(safe-area-inset-bottom));
  }
  .page > .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .page > .kpi-grid .kpi { padding: 16px; }
  .page > .kpi-grid .kpi .k-value { font-size: 20px; }
  .page > .quick-grid { grid-template-columns: repeat(6, 1fr); gap: 14px; }
  .page > .card { padding: 18px; }
  .page > .card.flush { padding: 0; }
  .toast { bottom: calc(34px + env(safe-area-inset-bottom)); }

  .dashboard-grid {
    display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start;
  }
  .dashboard-main { min-width: 0; }
  .dashboard-side { min-width: 0; }
  .dashboard-side .hero-card,
  .dashboard-side .card { margin-bottom: 14px; }
  .hero-value { font-size: 38px; }
  .metric-pill { padding: 12px 14px; }
  .metric-pill .mp-value { font-size: 18px; }
}
/* Pad 横竖屏/小笔记本（768~1279）三卡并排变窄，金额字号收回，避免被省略号截断 */
@media (min-width: 768px) and (max-width: 1279px) {
  .metric-pill .mp-value { font-size: 14px; }
}

/* 更宽屏：≥1280px 充分利用大屏 */
@media (min-width: 1280px) {
  .app-shell { margin-left: 280px; }
  .nav { width: 280px; padding-left: calc(22px + env(safe-area-inset-left)); padding-right: 22px; }
  .page { padding: 28px 32px calc(40px + env(safe-area-inset-bottom)); }
  .page > .card { padding: 20px; }
  .page > .card.flush { padding: 0; }
}

/* ---------- 报表页 ---------- */
/* 分组柱状图：柱子多时横向滚动，SVG 用 viewBox 缩放 */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-chart { display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 2px 8px; font-size: 12px; color: var(--muted); }
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .dot, .stack-legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-readout { font-size: 12px; color: var(--text-2); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); line-height: 1.7; }

/* 月度明细行 */
.month-row { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.month-row:last-child { border-bottom: 0; }
.month-row.current { background: rgba(15, 111, 95, 0.04); }
.month-head { display: flex; align-items: baseline; gap: 8px; }
.month-name { font-size: 13px; color: var(--muted); flex: 1; font-variant-numeric: tabular-nums; }
.month-row.current .month-name { color: var(--brand); font-weight: 700; }
.month-amt { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.month-paid { font-size: 12px; color: var(--muted); }
.month-bar { height: 5px; border-radius: 3px; background: rgba(15, 111, 95, 0.10); margin-top: 6px; overflow: hidden; }
.month-fill { height: 100%; border-radius: 3px; transition: width .25s ease; }
.month-foot { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* 横向堆叠条（账龄 / 成本结构） */
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: rgba(15, 111, 95, 0.08); }
.stack .stack-seg { height: 100%; display: block; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.stack-legend .it { display: inline-flex; align-items: center; gap: 5px; }
/* 导出按钮排 */
.export-row { display: flex; flex-wrap: wrap; gap: 8px; }
.export-row .btn { width: auto; margin: 0; }

/* ---------- 工作台：营业趋势图 ---------- */
.chart-head { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.hero-chart {
  height: 130px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--line); overflow: hidden;
}
.trend-chart { height: 160px; }
.trend-chart.compact { height: 100%; }
.trend-svg {
  width: auto; height: 100%; max-width: 100%;
  display: block; border-radius: 8px;
}

@media (min-width: 768px) {
  /* 非趋势卡（开单/客户/下单等页面）：768 起统一 padding 与 pill 单行，避免指标丸换行挤乱 */
  .hero-card:not(.has-trend) { flex-direction: column; padding: 20px 18px; }
  .hero-card:not(.has-trend) .hero-pills { flex-wrap: nowrap; }
}
@media (min-width: 1024px) {
  /* 桌面端统一 Hero 卡片高度，切页时第一个栏不上下跳（基准已在基础类设置） */
  /* 只有带趋势图的工作台卡片才左右分栏；其他页面保持上下堆叠，避免指标丸被挤窄 */
  .hero-card.has-trend { flex-direction: row; align-items: stretch; gap: 18px; padding: 20px 18px; }
  .hero-left { display: flex; flex-direction: column; justify-content: space-between; }
  .hero-right { width: 46%; max-width: 340px; flex-shrink: 0; }
  .hero-chart { height: 100%; min-height: 140px; max-height: 188px; }
  .trend-chart { height: 180px; }
}
@media (min-width: 1280px) {
  .hero-right { width: 44%; max-width: 380px; }
  .hero-chart { min-height: 155px; }
  .trend-chart { height: 200px; }
}

/* ---------- 「我的」新版：Hero 门店卡 + 分组菜单 ---------- */
.hero-card.me-hero {
  padding: 16px;
  overflow: hidden;
}
.me-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.me-avatar {
  width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
}
.me-name-block { flex: 1; min-width: 0; }
.me-name { font-size: 16px; font-weight: 600; }
.me-role {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 500; vertical-align: 2px;
}
.me-hero .hero-pills { margin-top: 12px; padding-top: 0; }
.me-actions {
  display: flex; gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}
.me-actions .btn { flex: 1; }

/* 分组菜单 */
.menu-group { overflow: hidden; }
.menu-group-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 14px 16px 10px;
  background: rgba(15, 111, 95, 0.03);
  border-bottom: 1px solid var(--line);
}
.menu-group .row { background: transparent; }
.menu-group .row:first-of-type { border-top: none; }

@media (min-width: 768px) {
  .me-head { padding-bottom: 14px; margin-bottom: 14px; }
  .me-hero .hero-value { font-size: 36px; }
}

.row .r-ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.row .r-badge {
  display: inline-block; margin-left: 8px; vertical-align: 1px;
  font-size: 11px; color: var(--brand); background: var(--brand-soft);
  padding: 2px 8px; border-radius: 99px; white-space: nowrap; font-weight: 400;
}
.row.danger .r-title { color: var(--danger); }
.row.danger .r-ico { background: rgba(220, 38, 38, 0.10); color: var(--danger); }

.cascade > .row .chev { transition: transform .25s ease; }
.cascade.open > .row .chev { transform: rotate(90deg); }
.cascade .sub { max-height: 0; overflow: hidden; transition: max-height .3s ease; background: #fafcfb; }
.cascade.open .sub { max-height: 540px; }
.cascade .sub .row { padding-left: 34px; background: #fafcfb; }
.cascade .sub .r-ico { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
.cascade .sub .r-title { font-size: 14px; color: var(--text-2); }

/* ---- 窗帘下单：每房间一块（房间+尺寸+开向+工艺，2026-10-18 方案B）---- */
.pair-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; }
.pair-block-head { display: flex; align-items: center; gap: 8px; }
.pair-block-head .row-inline { flex: 1 1 auto; min-width: 0; }
.pair-block-head .row-inline .input { min-width: 0; }
.pair-block .pair-nums { margin-top: 8px; }
.pair-block .form-grid { margin-top: 4px; }
.pair-block details.more-box { margin: 6px 0 0; }

/* ---- 手机端：厂家分组头两行化（用户 2026-10-18：画圈处不美观）----
   第一行：厂家名 + 三个操作按钮等宽均分（好点）；第二行：单号/套数/间数整行展示不挤成三行 */
@media (max-width: 640px) {
  .fg-head { padding: 10px 12px; }
  .fg-name { font-size: 14px; }
  .fg-copy, .fg-order, .fg-state {
    text-align: center; white-space: nowrap;
    padding: 7px 10px; font-size: 12.5px; min-width: 0;
  }
}

/* 详情头/列表长文本防溢出：电话/地址/客户名过长时不挤破左右布局（审查 2026-10-18） */
.detail-head > div:first-child { min-width: 0; }
.dh-title, .dh-sub, .r-sub { overflow-wrap: anywhere; }

/* ---- 手机端弹窗顶部对齐（2026-10-18 防晃关键）----
   原来 bottom-sheet 底部锚定：每次点输入框键盘弹起→视口缩小→弹窗整体重排上移，收起又落下 = 老晃。
   顶对齐后键盘 resize 只影响底部（被滚动容器裁掉），顶部内容位置不动。开单表单/回单比对等所有弹窗受益。
   断点 640→767：大屏手机/小平板（640~767px）原来落进「既不贴顶也不居中」的真空带，退成底部抽屉，
   用户反馈「弹窗不在最上边」（2026-10-27）。统一到 767px，≥768px 才切桌面居中。 */
@media (max-width: 767px) {
  .modal-layer { align-items: flex-start; padding-top: max(2vh, env(safe-area-inset-top)); }
  .modal { max-height: 94vh; border-radius: 16px; border-bottom: 1px solid rgba(15, 111, 95, 0.08); }
}

/* ---- 手机端弹窗横向溢出根治（2026-10-18：手指左右滑界面跟着动）----
   元凶：input[type=date] 在移动端有不可压缩的最小宽（约200px），把网格列/弹窗撑到比屏幕宽，
   弹窗居中溢出两侧（标题左裁、输入框右伸），横向滚动带动整页晃。 */
.modal { min-width: 0; overflow-x: hidden; }
.modal-layer { overflow: hidden; }
.field { min-width: 0; }
input[type="date"] { min-width: 0; width: 100%; }
/* iOS（含微信内置 WKWebView）的日期输入框有内在样式，会无视 width 按内容自然宽度渲染——
   「2026年10月18日」直接伸出容器被裁（用户 2026-10-18 实测）。appearance:none + 内部值 min-width:0 是标准修法。 */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 43px;
}
input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }

/* ---- 手机端工作台 Hero 卡防挤压（2026-10-18：指标值被竖裁 11px、与趋势图 0 间距）----
   根因：桌面统一的 min-height:228px 在手机上压缩 flex 子项。手机端高度交给内容，间距给足。 */
@media (max-width: 640px) {
  .hero-card, .hero-card.me-hero { min-height: 0; }
  .hero-left { flex: 0 0 auto; }
  .hero-card.has-trend { gap: 14px; }
  .hero-pills { padding-top: 2px; padding-bottom: 2px; gap: 8px; }
  .metric-pill { flex: 1 1 0; flex-shrink: 0; padding: 10px 10px; }
  .metric-pill .mp-value { font-size: 15px; line-height: 1.4; }
}

/* ---- 桌面/iPad：趋势图卡与左侧指标底部对齐（用户 2026-10-18）----
   原来 hero-chart 有 188px 高度上限，左侧内容更高时图表撑不满右侧、底部留白错位。
   改为 chart 填满右侧高度（卡片高度由左侧内容决定，不会失控）。 */
@media (min-width: 1024px) {
  .hero-card.has-trend .hero-right { display: flex; flex-direction: column; }
  .hero-card.has-trend .hero-chart { flex: 1 1 auto; height: auto; max-height: none; min-height: 140px; }
}

/* ---- 修：iPad 上业绩曲线空白（2026-10-18）----
   根因：hero-chart 改弹性高度后，trend-chart/svg 的 height:100% 百分比链在 iOS WKWebView
   解析失效（flex 子项高度作百分比基准在 iOS 不可靠）→ svg 高度算成 0 → 曲线消失。
   方案：chart 定位锚点 + trend-chart 绝对定位填满（不依赖百分比解析），两端通吃。 */
@media (min-width: 1024px) {
  .hero-card.has-trend .hero-chart { position: relative; }
  .hero-card.has-trend .hero-chart .trend-chart {
    position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px;
    height: auto !important;
  }
  .hero-card.has-trend .hero-chart .trend-svg { height: 100% !important; }
}

/* ---- 安装单明细表格（与辅材/窗帘订货卡片同风格：表头浅绿、细边、尺寸/尾款红字） ---- */
.it-table-wrap { padding: 10px 12px; overflow-x: auto; }
.it-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
/* 窗帘明细表：固定列宽布局 —— 多个厂家组的表格列竖向对齐（状态列等不随内容漂移） */
.it-table.fab { table-layout: fixed; min-width: 640px; }
.it-table th { background: #eef6f1; color: #0f6b4a; font-weight: 600; padding: 7px 6px; border: 1px solid #d8e5dd; text-align: center; white-space: nowrap; }
.it-table td { padding: 7px 6px; border: 1px solid #d8e5dd; text-align: center; vertical-align: middle; }
.it-table td.it-red { color: #d03a2b; font-weight: 600; white-space: nowrap; }
.it-table tbody tr { cursor: pointer; }
.it-table tbody tr:nth-child(even) { background: rgba(15, 118, 110, 0.03); }

/* 开单核对页：iOS 的日期输入默认居中，统一左对齐 */

/* 下单详情：返回列表悬浮固定（左下角，避开底部导航），滑到哪都能直接返回 */
.float-back {
  position: fixed; left: 14px; bottom: 78px; z-index: 60;
  background: var(--card); border: 1.5px solid var(--brand); border-radius: 22px;
  padding: 9px 16px; box-shadow: 0 4px 14px rgba(15, 111, 95, 0.22);
  color: var(--brand); font-weight: 600;
}

/* 拍照开单核对页：识别没勾到的字段（开向/辅材类型）红框醒目提醒，避免静默出错单 */
.input.need-fill {
  border-color: #d03a2b !important;
  box-shadow: 0 0 0 1px rgba(208, 58, 43, 0.18) inset;
}
.input.need-fill::placeholder { color: #d03a2b; opacity: 0.85; }

/* ---- 手机端明细表格防溢出（2026-10-18：成品尺寸红字压线、删按钮顶出屏幕）----
   fixed 布局按百分比锁列宽，「3.36×2.48」这类 nowrap 红字比列宽宽时会溢出单元格压线。
   手机改自然列宽（列宽随内容），表格整体在 .it-table-wrap 里横向滑动查看。 */
@media (max-width: 640px) {
  .it-table, .it-table.fab { table-layout: auto; }
  .it-table.fab { min-width: 620px; }
  .it-table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .it-table th, .it-table td { word-break: keep-all; }
}

/* ---------- 添加到主屏幕引导弹窗 ---------- */
.a2h-body { padding: 2px 2px 6px; }
.a2h-tip {
  font-size: 12.5px; color: var(--brand); background: var(--brand-soft);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-weight: 600;
}
.a2h-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.a2h-step:last-child { margin-bottom: 2px; }
.a2h-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.a2h-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.45; }
.a2h-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 1px; }
