/* JSG Project Flow — 设计 token 与全局样式（方案 B「Field Green」骨架 + 方案 C 的 KPI 条/数据表）
   规则：页面模板只用这里的 class 与 token，不再往 base.html 塞内联 <style>。 */

:root {
  /* palette */
  --green-deep: #15421f;   /* 侧栏 / 品牌底 */
  --green: #1e7a33;        /* 主操作 / 强调 */
  --green-soft: #e2f1e3;
  --bg: #eef2ec;
  --surface: #ffffff;
  --ink: #1d2a20;
  --muted: #5f7263;
  --line: #d3ddd0;
  /* 状态语义色（底/字），与打印单据的「状态章」呼应 */
  --st-warn-bg: #fdf0d2;  --st-warn-fg: #92600a;   /* quoted */
  --st-hot-bg: #fde3d2;   --st-hot-fg: #b03e12;    /* awaiting review */
  --st-ok-bg: #dcf2df;    --st-ok-fg: #15702a;     /* confirmed / deposit */
  --st-dim-bg: #e8ece7;   --st-dim-fg: #5f7263;    /* draft / closed */
  --danger: #b42318;
  /* 旧模板兼容别名（order_form 等局部样式仍引用） */
  --border: var(--line);
  --text: var(--ink);
  --field: #d9d9d9;
  /* layout */
  --side-w: 200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Figtree, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

/* ---------- 应用壳：侧栏（>=768px）/ 底部标签栏（<768px） ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex-shrink: 0;
  background: var(--green-deep); color: #bcd4c1;
  display: flex; flex-direction: column;
  padding: 16px 0 12px;
  position: sticky; top: 0; height: 100vh;
}
/* 品牌区（M4.7 P5.2）：Logo 是 705×216 的横向组合标，里面含一句手写体 slogan——
   尺寸得按「slogan 还认得出」来定，不是随便给个高度。侧栏 200px 减去两边留白约
   164px 可用，按 3.26:1 算高约 50px，正好是可读下限。白片不是装饰是必需的：
   这个 PNG 是 RGB 无 alpha，深绿字直接贴深绿侧栏会看不见。 */
.side .brand { display: block; text-decoration: none; padding: 0 18px 20px; line-height: 1.2; }
.side .brand-logo { display: block; background: #fff; border-radius: 10px; padding: 9px 12px; }
.side .brand-logo img { display: block; width: 100%; height: auto; }
.side .brand small {
  display: block; text-align: center; margin-top: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; color: #cfe0d3;
}
.side .cta {
  display: block; margin: 0 14px 18px; text-align: center; text-decoration: none;
  background: var(--green); color: #fff; font-weight: 700; font-size: 13.5px;
  padding: 10px 0; border-radius: 8px; min-height: 44px; line-height: 24px;
}
.side .cta:hover { opacity: 0.92; }
.side .navgroup-label { color: #6f9578; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 10px 18px 4px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  color: #bcd4c1; text-decoration: none; font-size: 14px;
  padding: 10px 18px; margin-right: 12px; border-radius: 0 22px 22px 0;
  min-height: 44px; display: flex; align-items: center;
}
.side nav a:hover { color: #fff; }
.side nav a.on { background: var(--green); color: #fff; font-weight: 600; }
.side .spacer { flex: 1; }
.side .who { border-top: 1px solid #235c2e; padding: 12px 18px 0; font-size: 12px; color: #8fb598; }
.side .who a { color: #bcd4c1; }
.side .who .build-footer { margin-top: 6px; font-size: 11px; opacity: .75; }
.side .who .build-footer a.on { text-decoration: underline; }

.build-badge { font-size: 12px; font-weight: 400; color: var(--muted); vertical-align: middle; margin-left: 8px; }
.updates-date { font-size: 14px; margin: 24px 0 8px; }
.updates-date:first-of-type { margin-top: 8px; }
.updates-list { margin: 0 0 4px; padding-left: 20px; }
.updates-list li { margin-bottom: 6px; line-height: 1.5; }

main { flex: 1; min-width: 0; padding: 24px 28px 40px; max-width: 1100px; }

.tabbar { display: none; }

@media (max-width: 767px) {
  .side { display: none; }
  main { padding: 16px 14px 76px; }  /* 底部留出标签栏高度 */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; text-align: center; text-decoration: none; color: var(--muted);
    font-size: 11px; padding: 8px 0 10px; min-height: 44px;
  }
  .tabbar a.on { color: var(--green); font-weight: 700; }
  .tabbar a i { display: block; font-style: normal; font-size: 18px; line-height: 1.2; }
  .tabbar a.plus { flex: 0 0 56px; }
  .tabbar a.plus i {
    width: 36px; height: 36px; margin: -16px auto 2px; background: var(--green); color: #fff;
    border-radius: 50%; font-size: 19px; line-height: 36px; box-shadow: 0 3px 10px rgba(21,66,31,0.35);
  }
  .more-panel {
    position: absolute; bottom: 100%; right: 10px; margin-bottom: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.16); min-width: 168px; overflow: hidden;
  }
  .more-panel a {
    display: block; padding: 13px 16px; font-size: 13px; color: var(--ink);
    text-decoration: none; border-bottom: 1px solid var(--line); min-height: 44px;
  }
  .more-panel a:last-child { border-bottom: none; }
}

/* ---------- 通用元素 ---------- */
h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 700; }
a { color: var(--green); }
.muted { color: var(--muted); font-size: 0.87em; }
.error { color: var(--danger); }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }

input, select, button, textarea {
  font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; min-height: 44px;
  background: var(--surface); color: var(--ink);
}
button { background: var(--green); color: #fff; border: none; cursor: pointer; font-weight: 600; }
button:hover { opacity: 0.92; }
button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
/* 不可逆操作专用。做成描边而非实心红：整页只有它一颗红按钮，实心会比「Save」还抢眼 */
button.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
button:disabled { background: var(--bg); color: var(--muted); border: 1px solid var(--line); cursor: not-allowed; opacity: 1; }
/* 冻结的订单（Q2）：输入框禁用后要看得出来是禁用，不能白底白面像还能填 */
:is(input, select, textarea):disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
:is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- 数据表（方案 C 器官：Price Book 等管理页保持表格密度） ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); background: var(--surface); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* ---------- KPI 摘要条（方案 C 器官） ----------
   grid 而不是 flex（Q4）：Dashboard 有 6 块，1024px 下 flex:1 会让折行的最后
   一块被拉成整行宽，像另一种组件；grid 折行后每块同宽 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi span { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kpi.hot b { color: var(--st-hot-fg); }
a.kpi { display: block; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--green); }
a.kpi.on { border-color: var(--green); border-width: 2px; padding: 9px 15px; }

/* ---------- 状态胶囊 ---------- */
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.pill.st-DRAFT, .pill.st-CLOSED { background: var(--st-dim-bg); color: var(--st-dim-fg); }
.pill.st-QUOTED { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.pill.st-PENDING_REVIEW { background: var(--st-hot-bg); color: var(--st-hot-fg); }
.pill.st-CONFIRMED, .pill.st-DEPOSIT_PAID, .pill.st-SCHEDULED { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.pill.st-LOST { background: var(--st-dim-bg); color: var(--danger); }

/* ---------- 工单卡片行（列表页） ---------- */
.job-list { display: flex; flex-direction: column; gap: 8px; }
.job-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; text-decoration: none; color: inherit; min-height: 56px;
}
.job-row:hover { border-color: var(--green); }
.job-row .mid { flex: 1; min-width: 0; }
.job-row .mid b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .mid span { font-size: 12.5px; color: var(--muted); }
.job-row .amt { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.job-row .when { font-size: 12px; color: var(--muted); min-width: 78px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .job-row { flex-wrap: wrap; }
  /* 单号+客户名独占首行（Q4）：不然胶囊和金额把名字挤成「QU…」，只剩电话可认 */
  .job-row .mid { flex: 1 1 100%; }
  .job-row .when { display: none; }
  .job-row .amt { min-width: 0; margin-left: auto; }
}
/* Jobs 列表未排期行的内联表单——紧贴在该行 .job-row 下面，不是嵌进链接里
   （BUG-1/OPEN-57 排期入口二）*/
.inline-schedule {
  display: flex; gap: 8px; align-items: center;
  margin: -4px 0 4px 16px; padding: 8px 12px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: 8px;
}
.inline-schedule button { padding: 6px 12px; font-size: 13px; }

.pager { margin-top: 16px; display: flex; gap: 16px; }

/* ---------- 长卷页（Order 详情，2026-08-28 重设计，D18）---------- */

.order-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.order-head h1 { margin: 0; }

.progress { display: flex; align-items: center; gap: 4px; margin: 10px 0 18px; flex-wrap: wrap; }
.progress .chip {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 3px 10px;
  border-radius: 999px; background: var(--st-dim-bg); color: var(--st-dim-fg);
}
.progress .chip.done { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.progress .chip.now { background: var(--green); color: #fff; }
.progress .arrow { color: var(--line); font-size: 12px; }
@media (max-width: 640px) {
  /* 窄屏只留「当前 → 下一步」两颗，中间那根箭头靠相邻选择器精确挑出来 */
  .progress .chip:not(.now):not(.is-next) { display: none; }
  .progress .arrow { display: none; }
  .progress .chip.now + .arrow { display: inline; }
}

.reject-banner {
  background: var(--st-hot-bg); color: var(--st-hot-fg); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px;
}
.reject-banner b { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }

.section { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.customer-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.customer-summary .who b { font-size: 15px; display: block; }
.customer-summary .who .contact { font-size: 13px; color: var(--muted); }
.customer-summary .who .contact a { color: var(--green); text-decoration: none; }
.customer-summary .who .contact a:hover { text-decoration: underline; }

.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: 0.1em; margin: 20px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.seg-buttons { display: inline-flex; gap: 8px; margin-top: 4px; }
.seg-buttons button {
  background: var(--surface); color: var(--muted); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 8px 18px; font-size: 13.5px; font-weight: 600; min-height: 40px;
}
.seg-buttons button.on { background: var(--green); color: #fff; border-color: var(--green); }

.dup-note { background: var(--st-warn-bg); border-radius: 10px; padding: 14px 16px; margin-top: 16px; }
.dup-note .job-row { background: var(--surface); }

/* 现场条件（F8）：一次录入喂两份单据 */
.site-conditions { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 16px; }
.site-conditions .seg-buttons { flex-wrap: wrap; }
.site-conditions .seg-buttons button { padding: 7px 14px; font-size: 13px; min-height: 38px; }

.quote-line + .quote-line { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.quote-line-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.quote-line-head h3 { margin: 0; font-size: 15px; text-transform: capitalize; }
.quote-line-head .field { display: flex; flex-direction: column; gap: 3px; }
.quote-line-head .field label { font-size: 11px; color: var(--muted); }
.quote-line-head .field input { width: 110px; }
.quote-line-head .spacer { flex: 1; }

.item-rows { display: flex; flex-direction: column; }
.item-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: none; }
.item-row .name { flex: 1; font-size: 13.5px; min-width: 0; }
.item-row .name .manual-tag { font-size: 10px; color: var(--st-warn-fg); background: var(--st-warn-bg); border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.item-row input[type=number] { width: 72px; padding: 6px 8px; min-height: 36px; }
.item-row .amt { min-width: 76px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13.5px; }
/* 改价（OPEN-70）：金额本身是入口，改过的显示 edited 徽标 */
.item-row .amt-edit {
  background: none; border: 1px dashed transparent; color: var(--ink);
  padding: 2px 6px; min-height: auto; font-weight: 600; font-size: 13.5px; cursor: pointer;
  font-variant-numeric: tabular-nums; text-align: right; min-width: 76px; border-radius: 5px;
}
.item-row .amt-edit:hover { border-color: var(--line); background: var(--bg); }
.item-row .amt-edit.overridden { color: var(--st-warn-fg); }
.item-row .name .override-tag {
  font-size: 10px; color: var(--st-warn-fg); background: var(--st-warn-bg);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}
.override-edit {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 2px 0 10px;
}
.override-edit .oe-row { display: flex; gap: 12px; flex-wrap: wrap; }
.override-edit .oe-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.override-edit .oe-row label.grow { flex: 1; min-width: 200px; }
.override-edit .oe-row input { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.override-edit .oe-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.override-edit .oe-actions .spacer { flex: 1; }
.override-edit .oe-actions button { min-height: 38px; padding: 6px 14px; font-size: 13px; }

.item-row .remove { background: none; border: none; color: var(--danger); font-size: 18px; line-height: 1; padding: 4px 6px; min-height: auto; cursor: pointer; }

/* 重复计价提示（OPEN-65/72）：比 .error 弱一档——只提示不阻断，别做成红色报错 */
.bundled-warn {
  background: var(--st-warn-bg); color: var(--st-warn-fg); border-radius: 6px;
  padding: 7px 11px; font-size: 12.5px; margin: 0 0 8px;
}

.add-item-wrap { position: relative; margin-top: 8px; }
.add-item-btn {
  background: var(--surface); color: var(--green); border: 1.5px dashed var(--green);
  border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 700;
}
.picker {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(340px, 90vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18); padding: 10px; max-height: 360px; display: flex; flex-direction: column;
}
.picker input[type=text] { width: 100%; margin-bottom: 8px; }
.picker .list { overflow-y: auto; }
.picker .cat { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 8px 0 3px; }
.picker .cat:first-child { margin-top: 0; }
.picker .opt {
  display: flex; justify-content: space-between; gap: 8px; padding: 8px 6px; border-radius: 6px;
  font-size: 13px; cursor: pointer; min-height: 36px; align-items: center;
}
.picker .opt:hover { background: var(--bg); }
.picker .opt.selected { color: var(--green); font-weight: 600; }
.picker .opt .unit { color: var(--muted); font-size: 11.5px; }
.picker .empty { color: var(--muted); font-size: 13px; padding: 10px 6px; }

.totals { margin-top: 4px; }
.totals .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; }
.totals .row.grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-weight: 700; font-size: 15px; }
.totals .row .amt { font-variant-numeric: tabular-nums; }
.confirm-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.confirm-row label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 32px; }
.pricing-note { font-size: 12px; color: var(--st-warn-fg); background: var(--st-warn-bg); border-radius: 6px; padding: 6px 10px; margin-top: 8px; }

.actionbar {
  position: sticky; bottom: 12px; z-index: 5; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; margin-top: 20px; padding: 12px 18px; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.actionbar .hint { color: var(--muted); font-size: 12.5px; }
/* Q5：确认金额勾选挪进动作栏，和它解锁的 Submit 并排——阻碍和出路同屏可见 */
.actionbar .confirm-inline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 32px; cursor: pointer; }
.actionbar .confirm-inline input { min-height: auto; }
.actionbar .spacer { flex: 1; }
.actionbar textarea { width: 100%; margin-bottom: 8px; }
/* 「⋯」低频动作菜单（2026-08-29 方案A）：Mark as lost / Revise 原来是动作栏
   下方的静态灰链接，而动作栏是 sticky（窄屏 fixed）——实测桌面端落在首屏下方
   2400px 处，窄屏被固定动作栏直接盖住、点上去命中的是「确认金额」勾选框。
   收进栏内解决可达性，放在主按钮对侧（最左）保住「至多一个主按钮」。 */
.more-actions { position: relative; display: inline-flex; }
.more-actions .icon-more {
  width: 40px; min-height: 40px; padding: 0; font-size: 18px; line-height: 1;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.more-actions-panel {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 6px; z-index: 20;
  min-width: 200px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}
.more-actions-panel a {
  display: flex; align-items: center; min-height: 44px; padding: 8px 12px;
  font-size: 13px; color: var(--ink); text-decoration: none; border-radius: 6px;
}
.more-actions-panel a:hover { background: var(--bg); }
.more-actions-panel a.danger { color: var(--danger); }
@media (max-width: 767px) {
  .actionbar { position: fixed; left: 14px; right: 14px; bottom: 70px; margin-top: 0; }
}

.doc-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.doc-row:last-child { border-bottom: none; }
.doc-row .muted { font-size: 11.5px; }
/* 预览面板（P5.9）：就地展开，不是页签 */
.doc-preview { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 4px 0 10px; }
.doc-preview iframe { display: block; width: 100%; height: 520px; border: 0; background: var(--bg); }
.doc-preview p { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: 12px; }

/* ---------- 价目表 CSV 导入预览（P6.4） ---------- */
.import-errors {
  background: var(--st-hot-bg); color: var(--st-hot-fg); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 14px; font-size: 13.5px;
}
.import-errors ul { margin: 6px 0 0; padding-left: 20px; }
.price-up { color: var(--st-hot-fg); }
.price-down { color: var(--st-ok-fg); }
.btn-cancel {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
}

@media (max-width: 767px) {
  /* 底部固定的 actionbar + tabbar 叠在一起，滚动到底要留够空间不挡住最后一段内容 */
  .order-page { padding-bottom: 130px; }
}

/* 草图折叠态预览（用户 2026-08-29 反馈修订）：已画过的业务行不再自动弹开
   空白画布，改成显示上一张草图 + Edit 入口 */
.sketch-preview { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
/* D35 从 420px 收到 240px：预览只是"这行画过什么"的提示，看细节点 Edit 或相册区 */
.sketch-preview img { max-width: 240px; width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }

/* ---------- Site 段瘦身（D35，用户 2026-08-29 反馈：内容太长） ---------- */
/* 每条业务行的草图/照片收进一张带头部的可折叠子卡片 */
.line-media-card { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.line-media-head {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--bg); color: var(--ink); border: none; border-radius: 0; padding: 10px 14px;
}
.line-media-title { font-size: 15px; font-weight: 700; text-transform: capitalize; }
.line-media-head .line-media-summary { margin-left: auto; }
.line-media-head .chev, .attachments-head .chev {
  font-style: normal; color: var(--muted); transition: transform 0.15s;
}
.line-media-head .chev.open, .attachments-head .chev.open { transform: rotate(180deg); }
.line-media-body { padding: 12px 14px; }
/* 裸文件框换成的小按钮（label 套隐藏 input） */
.upload-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.upload-btn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600;
}
.upload-btn input[type="file"] { display: none; }
/* 缩略图横向滑动条：固定 80px 高一行，照片再多不换行 */
.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; margin-top: 8px; }
.thumb-strip .thumb { flex: 0 0 auto; text-align: center; text-decoration: none; }
.thumb-strip img { height: 80px; width: auto; border-radius: 4px; border: 1px solid var(--line); display: block; }
.thumb-strip .muted { font-size: 11px; }
/* 订单级附件折成一行：标题带计数管展开，上传按钮常驻 */
.attachments-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.attachments-head {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--ink); padding: 6px 0; min-height: 40px;
}
.attachments-head .line-media-title { text-transform: none; }

/* ---------- Canvas 画板（P2.1，组件可复用——OPEN-46 签字预留） ---------- */
.sketchpad { border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fbfcfa; }
.sketchpad canvas {
  display: block; width: 100%; touch-action: none;  /* 阻止画的时候整页跟着滚 */
  background:
    linear-gradient(#e8ede6 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, #e8ede6 1px, transparent 1px) 0 0 / 24px 100%, #fbfcfa;
}
.sketchpad .tools {
  display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap;
}
.sketchpad .tools button { min-height: 40px; padding: 6px 14px; font-size: 13px; }
.sketchpad .tools .sp { flex: 1; }

/* 画笔工具行图标化（OPEN-64 方案A，2026-08-29） */
.sketchpad .tools .icon-btn { width: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.sketchpad .tools .icon-btn svg { width: 20px; height: 20px; display: block; }
.sketchpad .tools .icon-btn-text { font-weight: 700; font-size: 17px; font-family: Georgia, "Times New Roman", serif; }
.shape-picker { position: relative; display: inline-flex; }
.shape-picker .shape-trigger { width: 52px; gap: 2px; }
.shape-picker .chev { font-size: 9px; font-style: normal; opacity: .65; line-height: 1; }
.shape-menu {
  position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 5;
  display: flex; gap: 4px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
}

/* ---------- Workflow 流转图（Q6）：状态×角色参考页，整页一张 SVG，全员可读 ---------- */
svg.flow { display: block; width: 100%; max-width: 880px; height: auto; margin: 0 auto; }
.flow text { font-family: inherit; fill: var(--ink); }
.flow .en { font-size: 13px; font-weight: 700; }
.flow .mut { font-size: 11px; fill: var(--muted); }
.flow .act { font-size: 12px; font-weight: 700; }
.flow .doc { font-size: 11px; fill: var(--st-ok-fg); font-weight: 600; }
.flow .hot { font-size: 12px; font-weight: 700; fill: var(--st-hot-fg); }
.flow .hotbg { fill: var(--st-hot-bg); }
.flow .box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.flow .box-term { fill: var(--st-dim-bg); stroke: var(--line); stroke-width: 1.5; }
.flow .main { stroke: var(--muted); stroke-width: 2; fill: none; }
.flow .side { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-dasharray: 5 4; opacity: 0.75; }
.flow .freeze { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.55; }
.flow .arw { fill: var(--muted); }
.flow .cbs { fill: var(--st-ok-bg); }  .flow .cts { fill: var(--st-ok-fg); font-size: 10px; font-weight: 700; }
.flow .cbp { fill: var(--st-warn-bg); } .flow .ctp { fill: var(--st-warn-fg); font-size: 10px; font-weight: 700; }
.flow .cba { fill: var(--green-deep); } .flow .cta { fill: #dfeee2; font-size: 10px; font-weight: 700; }
/* Workflow 页图例用的 admin 深绿签（Sales/PM 复用既有 st-* 胶囊色） */
.pill.role-admin { background: var(--green-deep); color: #dfeee2; }

/* ---------- 表单字段组（P4.1：修复回归——重写长卷页时把这三个 class 的定义漏搬了，
   order_form.html 里还有 16 处在用，之前渲染出来标签挤在输入框左边、字段排不成列）---------- */
.field-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.field-row > div { flex: 1; min-width: 200px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
@media (max-width: 480px) { .field-row { flex-direction: column; gap: 12px; } }

/* ---------- Reports（P3.4/P3.5：固定报表 + 参数 + CSV，仿 Tradify，不是仪表盘） ---------- */
.reports-shell { display: flex; gap: 20px; align-items: flex-start; }
.reports-nav { display: flex; flex-direction: column; gap: 2px; width: 180px; flex-shrink: 0; }
.reports-nav a {
  padding: 10px 14px; border-radius: 8px; text-decoration: none; color: var(--ink);
  font-size: 13.5px; min-height: 44px; display: flex; align-items: center;
}
.reports-nav a.on { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.reports-body { flex: 1; min-width: 0; }
.quick-ranges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.quick-ranges a {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; text-decoration: none; min-height: 36px; display: flex; align-items: center;
}
.quick-ranges a.on { background: var(--green); color: #fff; border-color: var(--green); }
.quick-ranges a b { font-variant-numeric: tabular-nums; margin-left: 5px; opacity: 0.75; }

/* 漏斗（P5.5）：居中收窄给直觉，级间转化率给准确——光有梯形不传达「掉了多少」 */
/* 420px 在 iPad Pro 横屏(1366px)/14 寸笔记本(约1500px视口)下会留出 500-600px
   空白且左对齐堆在右侧，像没填满（用户 2026-08-29 反馈）。加宽到 600px 并居中，
   两侧留白对称，读起来是设计出来的呼吸感而不是内容被截断 */
.funnel { margin: 14px auto 0; max-width: 600px; }
.funnel-lost { max-width: 600px; margin-left: auto; margin-right: auto; }
.fstage-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.fstage-label b { color: var(--ink); font-variant-numeric: tabular-nums; }
.fstage {
  margin: 0 auto; background: var(--green); color: #fff; text-align: center;
  font-size: 13px; font-weight: 700; padding: 8px 0; border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.fdrop { text-align: center; font-size: 11.5px; color: var(--muted); padding: 5px 0; }
.fdrop b { color: var(--green); }
.low-sample {
  background: var(--st-warn-bg); color: var(--st-warn-fg); border-radius: 8px;
  padding: 9px 13px; font-size: 12.5px; margin: 0 0 14px;
}
tr.row-total td { font-weight: 700; border-top: 1px solid var(--line); background: var(--bg); }
@media (max-width: 700px) {
  .reports-shell { flex-direction: column; }
  .reports-nav { flex-direction: row; width: 100%; overflow-x: auto; }
}
