:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e6e8eb;
  --text: #1f2329;
  --text-sub: #8a919f;
  --primary: #2b5cff;
  --primary-hover: #1f4ae0;
  --brand: #7c5cff;
  --design: #00a6a6;
  --construction: #ff8a2a;
  --danger: #e5484d;
  --warn: #f5a623;
  --ok: #22a06b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
  --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 布局：左侧菜单 + 内容 ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #171d2c;
  color: #d7dce6;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 60;
  transform: translateX(calc(16px - var(--sidebar-w)));
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 2px 0 12px rgba(0, 0, 0, .12);
}
.sidebar:hover { transform: translateX(0); }
.sidebar:not(:hover)::after {
  content: '☰';
  position: absolute; right: 3px; top: 50%;
  transform: translateY(-50%);
  color: #6c8cff; font-size: 15px; line-height: 1;
}
/* 固定模式：始终显示 */
.sidebar.fixed { transform: translateX(0); }
.sidebar.fixed::after { content: none; }
body.fixed-sidebar .main-content { margin-left: var(--sidebar-w); max-width: calc(100vw - var(--sidebar-w)); }
.sidebar .logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 24px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .logo-mark {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b5cff, #7c5cff);
  color: #fff; font-weight: 700; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar .logo-text { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.35; }

.side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  border: none; background: transparent; cursor: pointer; text-align: left;
  padding: 11px 14px; border-radius: 9px; font-size: 14px; color: #aeb6c4;
  transition: all .15s; display: flex; align-items: center; gap: 10px;
}
.nav-item::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(43, 92, 255, .22); color: #fff; font-weight: 600; }
.nav-item.active::before { background: #6c8cff; opacity: 1; }

.sidebar-foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .user-name { color: #fff; font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.sidebar-foot .user-role { color: #8a93a5; font-size: 12px; margin-bottom: 10px; }
.btn-logout { width: 100%; background: rgba(255,255,255,.08); color: #d7dce6; border-color: transparent; }
.btn-logout:hover { background: rgba(255,255,255,.16); color: #fff; }

.main-content { flex: 1; margin-left: 16px; padding: 24px 32px 60px; max-width: calc(100vw - 16px); }

/* ===== 页签 ===== */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; }
.sub { color: var(--text-sub); font-size: 13px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== 按钮 ===== */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 14px; transition: all .15s;
}
.btn:hover { background: #f5f6f8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #c3cdf2; border-color: #c3cdf2; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-danger { color: var(--danger); border-color: #f0c4c6; }
.btn-danger:hover { background: #fdeeee; }
.btn-ok { color: var(--ok); border-color: #b7e3cd; }

/* ===== 经营概览（签单金额） ===== */
.finance-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.finance-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
  transition: transform .25s ease, box-shadow .25s ease;
}
.finance-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(20,30,60,.12); }
.finance-card .f-num { font-size: 22px; font-weight: 700; color: var(--text); }
.finance-card .f-label { color: var(--text-sub); font-size: 12px; margin-top: 4px; }
.finance-card.hl { background: linear-gradient(135deg, #2b5cff, #7c5cff); border-top: none; }
.finance-card.hl .f-num { color: #fff; font-size: 26px; }
.finance-card.hl .f-label { color: rgba(255,255,255,.85); }

/* ===== 部门卡片 ===== */
.dept-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.dept-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-top: 3px solid var(--brand); transition: transform .25s ease, box-shadow .25s ease; }
.dept-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(20,30,60,.12); }
.dept-card.design { border-top-color: var(--design); }
.dept-card.construction { border-top-color: var(--construction); }
.dept-card.mention { border-top-color: var(--primary); }
.dept-head { font-weight: 700; font-size: 15px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.dept-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dept-card.brand .dept-head { color: var(--brand); }
.dept-card.design .dept-head { color: var(--design); }
.dept-card.construction .dept-head { color: var(--construction); }
.dept-card.mention .dept-head { color: var(--primary); }
.ov-mentions-list { max-height: 180px; overflow-y: auto; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { flex: 1 1 92px; text-align: center; background: #f8f9fb; border-radius: 10px; padding: 14px 8px; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-num.warn { color: var(--danger); }
.stat-label { color: var(--text-sub); font-size: 12px; margin-top: 2px; }
.stat-sub { color: var(--text-sub); font-size: 11px; margin-top: 2px; }
/* 总览统计 hover 弹层 */
.stat[data-stat-type] { cursor: pointer; transition: background .15s; }
.stat[data-stat-type]:hover { background: #eef3ff; }
.stat-popover { position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 10px 14px; max-width: 320px; max-height: 300px; overflow-y: auto; z-index: 1100; font-size: 12px; }
.stat-popover-title { font-weight: 600; margin-bottom: 6px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.stat-popover-item { padding: 5px 0; border-bottom: 1px solid #f0f1f5; color: var(--text); cursor: pointer; }
.stat-popover-item:last-child { border-bottom: none; }
.stat-popover-item:hover { color: var(--primary); }
.stat-popover-loading { color: var(--text-sub); padding: 12px 0; text-align: center; }

.section-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: box-shadow .25s ease; }
.section-card:hover { box-shadow: 0 8px 24px rgba(20,30,60,.09); }
.section-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }

/* ===== 重大问题 ===== */
.major-issues { background: #fff5f5; border: 1px solid #f5c6c7; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.major-title { color: var(--danger); font-weight: 700; margin-bottom: 8px; }
.major-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #f0d0d1; flex-wrap: wrap; }
.major-item:last-child { border-bottom: none; }
.major-tag { background: var(--danger); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 12px; }

/* ===== 表格 ===== */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 800px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #fafbfc; color: var(--text-sub); font-weight: 600; font-size: 13px; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) { background: #fafbfc; }
.table tbody tr:hover { background: #eef2ff; }
.action-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.toolbar-search { flex: 1 1 220px; max-width: 340px; }

/* ===== 状态标签 ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-跟进中 { background: #e6f7ef; color: #1a9e63; }
.badge-已进店 { background: #e6f7f7; color: var(--design); }
.badge-邀约进店 { background: #00a046; color: #fff; }
.badge-已缴定金 { background: #e60012; color: #fff; }
.badge-已废单 { background: #1f2329; color: #fff; }
.badge-已竣工 { background: #e60012; color: #fff; }
.badge-濒临微死 { background: #9aa0a6; color: #fff; }
.badge-资源单 { background: #ed7d31; color: #fff; }
.badge-已延期 { background: #fdeeee; color: var(--danger); }
.badge-未解决 { background: #fdeeee; color: var(--danger); }
.badge-已解决 { background: #eefaf3; color: var(--ok); }
.badge-重大问题 { background: #fdeeee; color: var(--danger); }
.badge-一般问题 { background: #fff3e0; color: var(--construction); }
.badge-无问题 { background: #eefaf3; color: var(--ok); }
/* 设计部/工程部项目头部的状态标签：按类别列对齐 */
.wo-item-head .badge, .cp-head .badge { min-width: 88px; text-align: center; }

/* ===== 表单 ===== */
.input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; color: var(--text); background: #fff; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 92, 255, .1); }
.select { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-sub); }
.form-grid label.full { grid-column: 1 / -1; }
.req { color: var(--danger); font-style: normal; }

/* 也室计算器：只读结果 */
.calc-result { background: var(--bg); color: var(--text); font-weight: 600; cursor: default; }
.calc-result:focus { border-color: var(--border); box-shadow: none; }

/* 也室计算器：黄道吉日（月历） */
.almanac-filter { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.almanac-filter label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-sub); }
.almanac-filter .sub { align-self: center; margin-bottom: 4px; }
.almanac-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.almanac-weekdays span { text-align: center; font-size: 13px; color: var(--text-sub); font-weight: 600; padding: 4px 0; }
.almanac-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.almanac-cell { min-height: 76px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; position: relative; }
.almanac-cell.blank { background: transparent; border-color: transparent; }
.almanac-day { font-size: 15px; font-weight: 700; color: var(--text); }
.almanac-cn { font-size: 11px; color: var(--text-sub); }
.almanac-tag { font-size: 10px; line-height: 1; padding: 2px 6px; border-radius: 6px; margin-top: 2px; align-self: flex-start; }
.almanac-cell.is-lucky { background: #fff4e5; border-color: var(--construction); cursor: pointer; }
.almanac-cell.is-lucky:hover { box-shadow: 0 2px 8px rgba(255, 138, 42, .18); }
.almanac-cell.is-lucky .almanac-day { color: var(--construction); }
.almanac-cell.is-lucky .almanac-tag { background: var(--construction); color: #fff; }
.almanac-cell.is-blocked { background: #f0f1f3; border-color: var(--border); opacity: .6; cursor: not-allowed; }
.almanac-cell.is-blocked .almanac-tag { background: var(--text-sub); color: #fff; }
.almanac-cell.is-selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.almanac-detail { margin-top: 16px; }
.almanac-detail-card { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--construction); border-radius: 12px; padding: 14px 16px; }
.almanac-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.almanac-lunar { font-weight: 700; font-size: 16px; color: var(--primary); }
.almanac-date { color: var(--text); font-weight: 600; }
.almanac-ganzhi { color: var(--brand); font-weight: 600; }
.almanac-line { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.almanac-chong { color: var(--danger); font-weight: 600; }
.almanac-dian { color: var(--ok); font-weight: 600; }
.almanac-reason { color: var(--text); }

/* ===== 合同管理 ===== */
.contract-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contract-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-sub); }
.contract-section-title { font-weight: 700; font-size: 14px; color: var(--text); margin: 4px 0 12px; padding-left: 10px; border-left: 3px solid #2b5cff; }
.contract-section-title + .contract-grid { margin-bottom: 18px; }

/* ===== 组合价款分期组（4 列卡片） ===== */
.phase-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 18px; }
.phase-block { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fafbfe; }
.phase-title { font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.phase-block label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.phase-block label:last-child { margin-bottom: 0; }
.phase-block input { font-size: 13px; padding: 4px 8px; }
@media (max-width: 960px) { .phase-row { grid-template-columns: repeat(2, 1fr); } }

/* ===== 总经办财务情况 ===== */
.finance-phase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.finance-phase-block { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fafbfe; }
.finance-phase-title { font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px dashed var(--border); }
.finance-phase-note { margin-top: 8px; padding: 8px 10px; background: #fff7e0; border-radius: 6px; font-size: 12px; color: #8a6d00; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 960px) { .finance-phase-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== 客资小区名列宽 + 附件 grid 对齐 ===== */
.table td[data-col="community"] strong { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.table td[data-col="community"] { max-width: 180px; }
.lib-files, .lead-attachments { align-items: start; }
tr.lead-converted td { background: #e8f7ec !important; }

/* ===== 工地管理（单列） ===== */
.construction-grid { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: start; }

/* ===== 资料库卡片平铺 ===== */
.library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 960px) { .library-grid { grid-template-columns: 1fr; } }
.lib-subpanel.hidden { display: none; }
.lib-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fafbfe; }
.lib-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.lib-card-body { padding-top: 8px; line-height: 1.8; font-size: 13px; }

/* ===== 参考图库（拖拽上传 + 平铺） ===== */
.ref-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; background: #fafbfe; transition: border-color .15s, background .15s; margin-bottom: 18px; }
.ref-drop:hover, .ref-drop.dragover { border-color: #2b5cff; background: #f0f4ff; }
.ref-drop-inner { color: var(--text-sub); }
.ref-grid { columns: 12; column-gap: 4px; }
.ref-card { break-inside: avoid; position: relative; margin-bottom: 4px; }
.ref-card img { width: 100%; height: auto; display: block; cursor: pointer; border-radius: 4px; }
.ref-card .ref-del { position: absolute; top: 4px; right: 4px; border-radius: 999px; padding: 0 6px; line-height: 18px; font-size: 13px; opacity: 0; transition: opacity .15s; }
.ref-card:hover .ref-del { opacity: 1; }
@media (max-width: 1600px) { .ref-grid { columns: 10; } }
@media (max-width: 1200px) { .ref-grid { columns: 8; } }
@media (max-width: 900px) { .ref-grid { columns: 6; } }
@media (max-width: 600px) { .ref-grid { columns: 4; } }

/* ===== 合同财务管理 ===== */
.cf-auto { color: #9aa3b2 !important; }
.cf-adjust-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fafbfe; }

/* 合同财务看板：左两列固定，右边平铺 */
.cf-board-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
.cf-board { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.cf-board th, .cf-board td { white-space: nowrap; box-sizing: border-box; }
.cf-board .cf-sticky { position: sticky; background: #fff; z-index: 1; }
.cf-board th.cf-sticky { background: #fafbfc; z-index: 2; }
.cf-board .cf-sticky-0 { left: 0; width: 56px; min-width: 56px; max-width: 56px; text-align: center; }
.cf-board .cf-seq { color: var(--text-sub); font-variant-numeric: tabular-nums; }
.cf-board .cf-sticky-1 { left: 56px; width: 160px; min-width: 160px; max-width: 160px; }
.cf-board .cf-sticky-2 { left: 216px; width: 96px; min-width: 96px; max-width: 96px; box-shadow: 1px 0 0 var(--border); }

/* 收款列颜色分组 */
.cf-grp-design { background: #e8f0ff !important; }
.cf-grp-p1 { background: #e8f7ec !important; }
.cf-grp-p2 { background: #fff3e0 !important; }
.cf-grp-p3 { background: #f0ebff !important; }
.cf-grp-p4 { background: #fdecec !important; }
.cf-board th.cf-grp { color: var(--text); font-weight: 700; }

/* 图片预览弹窗操作栏 */
.image-preview-actions { display: flex; align-items: center; gap: 10px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }

/* 备忘录图片 */
.memo-editor.dragover { outline: 2px dashed #2b5cff; outline-offset: 4px; }
.memo-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.memo-img { position: relative; display: inline-block; }
.memo-img img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.memo-img .btn-xs { position: absolute; top: -6px; right: -6px; border-radius: 999px; padding: 0 5px; line-height: 16px; font-size: 12px; }
.memo-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.memo-imgs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }

/* ===== 主材部 ===== */
.mat-subpanel.hidden { display: none; }
.mat-group { margin-bottom: 20px; }
.mat-group-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 10px; padding-left: 10px; border-left: 3px solid #2b5cff; }
.mat-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mat-image-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.mat-image-card img { width: 100%; height: 130px; object-fit: cover; display: block; cursor: pointer; }
.mat-image-name { padding: 6px 8px; font-size: 12px; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 主材封面卡（查询区，每个主材一张封面） */
.mat-cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.mat-cover-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.mat-cover-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.1); transform: translateY(-2px); }
.mat-cover-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.mat-cover-empty { width: 100%; height: 140px; display: flex; align-items: center; justify-content: center; color: #b6bcc8; background: #f5f6f8; font-size: 13px; }
.mat-cover-info { padding: 8px 10px; }
.mat-cover-name { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-cover-price { font-size: 12px; color: #e0533f; margin-top: 2px; }
/* 主材详情：左图右文 */
.mat-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.mat-detail-gallery { min-width: 0; }
.mat-detail-main { width: 100%; height: 320px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; background: #f5f6f8; }
.mat-detail-main.empty { display: flex; align-items: center; justify-content: center; color: #b6bcc8; font-size: 14px; }
.mat-detail-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mat-detail-thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.mat-detail-thumbs img.active { border-color: #2b5cff; }
@media (max-width: 720px) { .mat-detail-layout { grid-template-columns: 1fr; } }
/* 主材录入图片区（可排序） */
.mat-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mat-img { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.mat-img img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.mat-img.dragging { opacity: 0.45; }
.mat-cover-tag { position: absolute; top: 4px; left: 4px; background: #2b5cff; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; z-index: 1; }
.mat-img-ops { display: flex; gap: 4px; }
.mat-img-ops .btn-xs { padding: 0 6px; line-height: 16px; font-size: 12px; border-radius: 4px; }
#mat-panel-entry .section-card.dragover { outline: 2px dashed #2b5cff; outline-offset: 4px; }
.cf-adjust-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cf-adjust-thumb { position: relative; display: inline-block; }
.cf-adjust-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.cf-adjust-thumb .btn-xs, .cf-adjust-file .btn-xs { position: absolute; top: -6px; right: -6px; border-radius: 999px; padding: 0 5px; line-height: 16px; font-size: 12px; }
.cf-adjust-file { position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
.cf-adjust-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 25, 40, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.2); display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-head h2 { font-size: 17px; }
.modal-close { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--text-sub); line-height: 1; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ===== 设计部 ===== */
.designer-group { margin-bottom: 28px; }
.designer-group-head { font-weight: 700; font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.designer-group-head .count { color: var(--text-sub); font-weight: 400; font-size: 13px; }
/* 资料库分组：更紧凑的行距 */
.lib-designer-group { margin-bottom: 14px; }
.lib-designer-group .designer-group-head { font-size: 15px; margin-bottom: 8px; }
.workorder-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.wo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.wo-title { font-weight: 700; font-size: 15px; }
.wo-meta { color: var(--text-sub); font-size: 12px; }
.stage { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fbfcfd; }
.stage-title { font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-num { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.stage-done .stage-num { background: var(--ok); }
.stage-tag { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: #e7f7ec; color: #1f7a3a; }
.stage-fold-toggle { margin-left: auto; font-size: 12px; color: var(--primary); cursor: pointer; user-select: none; font-weight: 500; }
.stage-fold-toggle:hover { color: var(--primary-hover); }
.step-list { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); flex-wrap: wrap; }
.step[draggable="true"]:hover { background: #f5f7fb; }
.step-ignored { opacity: .55; background: #fafafa; }
.step .step-name { flex: 1; min-width: 140px; }
.step .step-days { color: var(--text-sub); font-size: 12px; width: 70px; }
.step .step-date { color: var(--primary); font-size: 13px; font-weight: 600; min-width: 100px; }
.milestone { background: #eef2ff; border-color: #d5defa; }
.milestone .step-name { color: var(--primary); font-weight: 600; }
.date-inline { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* ===== 交付文件 ===== */
.deliver-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.deliver-item { border: 1px dashed var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.deliver-item .d-name { font-weight: 600; margin-bottom: 8px; }
.deliver-item.uploaded { border-style: solid; border-color: #b7e3cd; background: #f6fdf9; }
.deliver-item .d-file { color: var(--ok); font-size: 12px; margin-top: 6px; }
.deliver-item .d-file .fname {
  display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.deliver-item .d-file a { color: var(--primary); }

/* ===== 工程部 ===== */
.construction-project { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 0; }
.construction-project.con-active { border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(43,92,255,.12); }
.cp-head { display: flex; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; position: sticky; top: 0; background: var(--card); z-index: 20; padding: 4px 0; }
/* 工地行对齐：标题/户号固定宽度，各行（含待审核等缺省标签行）严格对齐 */
.cp-head .wo-item-title { width: 200px; min-width: 200px; max-width: 200px; flex-shrink: 0; }
.cp-head .wo-item-unit { width: 100px; min-width: 100px; flex-shrink: 0; }
.con-day-placeholder { visibility: hidden; }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.process-table { min-width: 1080px; }
/* 工期表格：容器内滚动，表头行锁定 */
.process-table-wrap { max-height: calc(100vh - 240px); overflow: auto; }
.process-table-wrap .table th { position: sticky; top: 0; z-index: 5; }
/* 施工天数 / 也室施工天数 标签 */
.con-day-tag { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef1ff; color: #2b5cff; white-space: nowrap; min-width: 84px; }
.con-day-tag.con-day-yeshi { background: #fff4e0; color: #c77700; }
.con-day-tag.con-day-yeshi:hover { background: #ffe7bf; }
.con-day-tag.con-day-overdue { background: #fdeeee; color: var(--danger); }
.con-day-tag:hover { background: #dde6ff; }
/* 房屋密码标签（房号后） */
.door-pwd { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #f2f5ff; color: #2b5cff; white-space: nowrap; }
.door-pwd.has-pwd { background: #fff7e6; color: #b7791f; font-weight: 600; }
.door-pwd[data-act] { cursor: pointer; }
.door-pwd[data-act]:hover { filter: brightness(0.96); text-decoration: underline; }
/* 工程部项目内部子菜单（工期管理 / 工地巡检） */
.con-sub-tabs { display: flex; gap: 6px; margin: 12px 0; border-bottom: 1px solid var(--border); }
.con-sub-tab {
  padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-sub); background: none; border: none; border-bottom: 2px solid transparent;
}
.con-sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.con-sub-panel.hidden { display: none; }
/* 巡检上传按钮行 */
.insp-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* ===== 开工前验房 ===== */
.precheck-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.pc-item-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 8px; }
.pc-label { font-weight: 600; font-size: 14px; }
.pc-desc { font-size: 12px; color: var(--text-sub); }
.pc-item-body { display: flex; flex-direction: column; gap: 8px; }
.precheck-yn { display: flex; gap: 16px; }
.pc-radio { display: flex; align-items: center; gap: 5px; font-size: 14px; cursor: pointer; }
.precheck-text { display: flex; align-items: center; gap: 8px; }
.pc-photos { display: flex; flex-direction: column; gap: 8px; }
.pc-photo-wrap { position: relative; display: inline-block; }
.pc-photo-wrap .thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; }
.pc-photo-edit, .pc-photo-del { position: absolute; border: none; border-radius: 50%; cursor: pointer; width: 20px; height: 20px; line-height: 18px; font-size: 11px; text-align: center; }
.pc-photo-edit { left: 2px; bottom: 2px; background: rgba(43,92,255,.85); color: #fff; }
.pc-photo-del { right: 2px; top: 2px; background: rgba(0,0,0,.55); color: #fff; }
.pc-confirmed-bar { background: #eefaf3; color: var(--ok); border: 1px solid #cdeedd; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 8px; }
/* 图片编辑工具栏 */
.pe-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pe-toolbar .btn.active { background: #eaf1ff; color: var(--primary); border-color: var(--primary); }
.pe-canvas-wrap { background: #f5f6f8; border-radius: 8px; padding: 8px; }
/* 正在进行的施工流程：黄色背景高亮 */
tr.proc-active td { background: #fff3cd !important; border-color: #ffe08a; }
tr.proc-active td:first-child { border-left: 3px solid #f0b429; }
.badge-active { background: #f0b429; color: #5c4400; }
.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
.thumb-stack { display: flex; gap: 6px; flex-wrap: wrap; }
/* 施工流程备注单元格 */
.proc-remark-cell { min-width: 180px; }
.proc-remark-cell .proc-remark-text { font-size: 12px; padding: 4px 6px; resize: vertical; min-height: 40px; }
.proc-remark-imgs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.proc-remark-imgs .thumb { width: 40px; height: 40px; }
.inspection-list { margin-top: 16px; }
.inspection-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfcfd; }
.inspection-item .i-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }

/* ===== 其他 ===== */
.hidden { display: none !important; }
.hint { color: var(--text-sub); font-size: 12px; margin-top: 8px; }
.empty { text-align: center; color: var(--text-sub); padding: 40px 0; }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 20px; border-radius: 10px;
  z-index: 1200; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ===== 上传进度弹层 ===== */
.upload-progress-card {
  background: #fff; border-radius: 16px; padding: 26px 30px;
  min-width: 300px; box-shadow: 0 20px 60px rgba(0,0,0,.2); text-align: center;
}
.up-title { font-size: 15px; font-weight: 600; margin-bottom: 18px; }
.up-bar { height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.up-bar-inner { height: 100%; width: 0%; background: linear-gradient(90deg, #2b5cff, #7c5cff); transition: width .15s ease; border-radius: 999px; }
.up-percent { margin-top: 14px; font-size: 22px; font-weight: 700; color: var(--primary); }
.up-tip { margin-top: 6px; font-size: 12px; color: var(--text-sub); }

/* ===== 登录页（背景图 + 玻璃质感登录框） ===== */
.login-wrap {
  position: fixed; inset: 0; z-index: 1000;
  background: url('/assets/login-bg.jpg') center center / cover no-repeat fixed;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.28); /* 暗化遮罩，让登录框更突出 */
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 20px;
  padding: 40px 36px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  text-align: center;
  color: #fff;
}
.login-title { font-size: 19px; margin-bottom: 4px; color: #fff; font-weight: 600; }
.login-sub { color: rgba(255, 255, 255, 0.75); font-size: 13px; margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .input {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}
.login-form .input::placeholder { color: rgba(255, 255, 255, 0.7); }
.login-form .input:focus {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.7);
  outline: none;
}
.login-btn { padding: 10px; font-size: 15px; }
.login-error { color: #ff7b72; font-size: 13px; text-align: center; margin-top: -2px; }
.login-error.hidden { display: none; }
.login-hint { margin-top: 18px; color: rgba(255, 255, 255, 0.65); font-size: 12px; }

/* ===== 宽弹窗 / 预览 ===== */
.modal-wide { max-width: 960px; }
.pdf-body { padding: 12px 16px 16px; }
/* 图片预览层：始终盖在普通弹窗之上（避免被详情卡遮挡） */
#modalImage { z-index: 300; }
.image-modal { background: transparent; box-shadow: none; max-width: 90vw; max-height: 90vh; display: flex; align-items: center; justify-content: center; }
.image-modal img { max-width: 90vw; max-height: 86vh; border-radius: 8px; }
.img-close { position: absolute; top: 12px; right: 20px; color: #fff; font-size: 32px; background: rgba(0,0,0,.4); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.img-close:hover { color: #fff; }
.img-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 40px; background: rgba(0,0,0,.35); border: none; width: 46px; height: 60px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; z-index: 2; }
.img-nav:hover { background: rgba(0,0,0,.55); }
.img-nav-prev { left: 10px; }
.img-nav-next { right: 10px; }

/* ===== 用户管理 ===== */
.user-add { display: flex; gap: 8px; flex-wrap: wrap; }
.user-add .input { flex: 1; min-width: 110px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .app-layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; flex-direction: row; align-items: center; padding: 8px 12px; }
  .sidebar .logo { border: none; padding: 8px; }
  .sidebar .logo-text { display: none; }
  .side-nav { flex-direction: row; padding: 0; overflow-x: auto; }
  .sidebar-foot { border: none; padding: 0; margin-left: auto; }
  .main-content { margin-left: 0; max-width: 100%; padding: 16px; }
  .dept-grid, .finance-cards { grid-template-columns: 1fr; }
  .stat-row { flex-wrap: wrap; }
  .form-grid, .contract-grid { grid-template-columns: 1fr; }
  .deliver-grid { grid-template-columns: 1fr; }
}

/* ===== 设计部步骤实际完成时间 ===== */
.step-actual { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.step-delayed { background: #fff5f5; border-color: #f0c4c6; }
.step-resolve { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; padding-left: 4px; font-size: 12px; color: var(--text-sub); }
.step .step-date { min-width: 170px; }

/* ===== 饼状图 ===== */
.pie-wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.pie-chart {
  width: 160px; height: 160px; border-radius: 50%; position: relative; flex-shrink: 0;
}
.pie-hole {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 88px; height: 88px; border-radius: 50%; background: #fff;
}
.pie-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-item .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-total { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--text); }
/* 签单来源饼图：图例点击展开明细 */
.legend-toggle { cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.legend-toggle:hover { background: #f2f5ff; }
.legend-toggle .caret { margin-left: auto; color: var(--text-sub); font-size: 12px; }
.legend-detail { margin: 2px 0 8px 20px; max-height: 260px; overflow-y: auto; border-left: 2px solid var(--border); padding-left: 10px; }
.legend-detail-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed #f0f1f5; }
.legend-detail-row:last-child { border-bottom: none; }
.legend-detail-row .dname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

/* ===== 流程负责人标签 ===== */
.owner-tag {
  display: inline-block; background: #eef2ff; color: var(--primary); font-size: 11px;
  padding: 0 8px; border-radius: 999px; margin-left: 6px; font-weight: 600;
}

/* ===== 资料库 ===== */
.library-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.lib-group-title { font-weight: 600; font-size: 13px; color: var(--text-sub); margin: 12px 0 8px; }
.lib-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lib-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; flex-wrap: wrap; }
.lib-file-image { display: flex; flex-direction: column; align-items: center; padding: 8px; gap: 8px; }
.lib-file-image .thumb { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; }
.lib-ico {
  width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff;
}
.lib-ico-pdf { background: #e5484d; }
.lib-ico-image { background: #22a06b; }
.lib-ico-cad { background: #2b5cff; }
.lib-ico-word { background: #2b6cb0; }
.lib-ico-excel { background: #1a7f4b; }
.lib-file-info { flex: 1; min-width: 160px; }
.lib-file-info .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 460px; }

/* ===== 客户详情附件：左侧缩略图导航 + 右侧大图预览 ===== */
.attach-gallery { display: flex; gap: 14px; margin-bottom: 8px; }
.attach-nav {
  width: 116px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 360px; overflow-y: auto;
  padding-right: 10px;
  border-right: 1px solid var(--border);
}
.attach-nav-item {
  position: relative; cursor: pointer;
  border: 2px solid transparent; border-radius: 8px;
  overflow: hidden; transition: border-color .15s;
}
.attach-nav-item img { width: 100%; height: 72px; object-fit: cover; display: block; }
.attach-nav-item.active { border-color: var(--primary); }
.attach-nav-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; line-height: 16px;
  border: none; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; cursor: pointer; display: none;
}
.attach-nav-item:hover .attach-nav-del { display: block; }
.attach-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f5f6f8; border-radius: 10px;
  min-height: 280px; overflow: hidden;
}
.attach-main img { max-width: 100%; max-height: 420px; object-fit: contain; }
@media (max-width: 640px) {
  .attach-gallery { flex-direction: column; }
  .attach-nav { width: 100%; flex-direction: row; max-height: none; overflow-x: auto; padding-right: 0; padding-bottom: 8px; border-right: none; border-bottom: 1px solid var(--border); }
  .attach-nav-item { flex-shrink: 0; width: 84px; }
  .attach-nav-item img { height: 60px; }
  .attach-main { min-height: 200px; }
}

/* ===== 设计风格输入 ===== */
.style-input-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.style-label { font-size: 13px; color: var(--text-sub); font-weight: 600; }

/* ===== 系统 Logo 图片 ===== */
.logo-img { object-fit: cover; }
.sidebar .logo-img { width: 40px; height: 40px; border-radius: 11px; }
.login-logo .logo-img { width: 52px; height: 52px; border-radius: 14px; }
.sidebar .logo-text-mark { background: linear-gradient(135deg,#2b5cff,#7c5cff); color:#fff; }
.login-logo .logo-text-mark { background: linear-gradient(135deg,#2b5cff,#7c5cff); color:#fff; }

/* ===== 品牌部子标签 ===== */
.sub-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.sub-tab {
  border: none; background: transparent; cursor: pointer; padding: 9px 18px;
  font-size: 14px; color: var(--text-sub); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.brand-subpanel { animation: fade .2s ease; }

/* 品牌部统计卡片（从总览迁移过来） */
.brand-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 18px;
}
.brand-stat {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}
.brand-stat .stat-num { font-size: 24px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.brand-stat .stat-label { font-size: 13px; color: var(--text-sub); margin-top: 6px; }
.brand-stat .stat-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
/* 第二行（第 4-6 张：定金 / 设计合同 / 施工合同）用紫色区分 */
.brand-stat:nth-child(n+4) { border-top-color: #7c5cff; background: #faf9ff; }
.brand-stat:nth-child(n+4) .stat-num { color: #7c5cff; }
/* 统计卡片：悬浮显示当月明细 */
.brand-stat { position: relative; }
.brand-stat-pop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 10px 12px; max-height: 280px; overflow-y: auto;
}
.brand-stat:hover .brand-stat-pop { display: block; }
.brand-stat-pop .pop-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.brand-stat-pop .pop-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed #f0f1f5; }
.brand-stat-pop .pop-row:last-child { border-bottom: none; }
.brand-stat-pop .pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.brand-stat-pop .pop-date { color: var(--text-sub); flex-shrink: 0; }
.brand-stat-pop .pop-empty { font-size: 12px; color: var(--text-sub); }

/* ===== 设计工单折叠列表 ===== */
.wo-item { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.wo-item-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer;
  transition: background .15s; user-select: none;
}
.wo-item-head:hover { background: #f5f7fb; }
.wo-caret { color: var(--text-sub); font-size: 12px; width: 14px; flex-shrink: 0; transition: transform .15s; }
.wo-item-title { font-weight: 600; font-size: 15px; min-width: 180px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-item-unit { color: var(--text-sub); font-size: 13px; min-width: 64px; }
.wo-item-current { font-size: 12px; color: var(--primary); background: #eaf1ff; border-radius: 999px; padding: 2px 10px; white-space: nowrap; min-width: 150px; text-align: center; }
.wo-item-body { padding: 16px; border-top: 1px solid var(--border); background: #fbfcfd; }
.wo-item-body .stage { background: #fff; }
.wo-item-meta { color: var(--text-sub); font-size: 12px; margin-bottom: 12px; }

/* ===== 品牌部月份分组 ===== */
.month-group-row td {
  background: #f0f4ff; padding: 8px 14px; border-top: 1px solid var(--border);
}
.month-group-title { font-weight: 700; font-size: 14px; color: var(--primary); }
.month-group-count { margin-left: 10px; font-size: 12px; color: var(--text-sub); }

/* ===== 品牌部：小号筛选按钮 / 多选 / 批量操作 ===== */
.select-sm { padding: 4px 8px; font-size: 12px; height: 30px; }
.head-actions .btn-sm { padding: 4px 10px; font-size: 12px; }
.batch-tools { display: inline-flex; align-items: center; gap: 6px; }
.batch-tools .sub { font-size: 12px; }
.brand-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
th .brand-check { margin: 0; vertical-align: middle; }
#importResult .imp-ok { color: var(--ok); }
#importResult .imp-err { color: var(--danger); }

/* ===== 进线数据 ===== */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.checkbox input { accent-color: var(--primary); }
.lead-dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 18px;
  text-align: center; color: var(--text-sub); font-size: 13px; cursor: pointer;
  transition: all .15s; background: #fafbfc;
}
.lead-dropzone:hover, .lead-dropzone.dragover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.lead-attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.lead-attach-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.lead-attach-item .fname { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-attach-item .file-ico { font-size: 16px; }
.lead-attach-item .thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; cursor: pointer; }
#importResult table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
#importResult td, #importResult th { border: 1px solid var(--border); padding: 4px 8px; }

/* ===== 个人备忘录 ===== */
.memo-editor { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--card); box-shadow: var(--shadow); }
.memo-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.memo-editor-title { font-weight: 700; font-size: 15px; color: var(--text); }
.memo-textarea { resize: vertical; min-height: 90px; }
.memo-editor-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.memo-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.memo-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; transition: all .15s; }
.memo-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(43, 92, 255, .08); }
.memo-content { font-size: 14px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.memo-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.memo-meta { font-size: 12px; color: var(--text-sub); }
.memo-actions { display: flex; gap: 8px; }

/* ===== 库存管理 ===== */
.inv-warn { padding: 10px 14px; border: 1px solid #f2c1c4; border-radius: 10px; background: #fdf2f2; color: var(--danger); font-size: 13px; margin-bottom: 14px; line-height: 1.6; }
.inv-low td { background: #fdf3f3; }
.inv-low-num { color: var(--danger); font-weight: 700; }
/* 已淘汰物品：置灰、排最后 */
.inv-eliminated td { background: #fafafa; color: var(--text-sub); }
/* 房屋状态：现房=红色，期房=紫色 */
.hs-sel.hs-xian, .hs-badge.hs-xian { color: #d93026 !important; border-color: #f0b2ad !important; background: #fdf2f1 !important; font-weight: 700 !important; }
.hs-sel.hs-qi, .hs-badge.hs-qi { color: #7b3fe4 !important; border-color: #d2c0f5 !important; background: #f6f1ff !important; font-weight: 700 !important; }
.hs-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; }
/* 库存分块：消耗品 / 资产 */
.inv-block { margin-bottom: 24px; }
.inv-block-head { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text); padding: 4px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.inv-block-head .count { font-weight: 500; color: var(--text-sub); font-size: 13px; }
.inv-block-head .hint { font-weight: 400; font-size: 12px; }

/* ===== 客情备注截断 ===== */
.remark-ellipsis {
  display: block; max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; cursor: default;
}

/* ===== 品牌部列显示控制 ===== */
.col-hidden { display: none !important; }
#brandColsList { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
#brandColsList .checkbox { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ===== 客资情况周录入表单 ===== */
.weekly-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.weekly-form label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-sub); gap: 4px; }
.weekly-form .input { width: 150px; }
.weekly-form #weekly-source.input { width: 130px; }
.weekly-form #weekly-leads.input, .weekly-form #weekly-customers.input { width: 90px; }

/* ===== 搜索框清空按钮 ===== */
.search-wrap { position: relative; display: inline-block; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; color: var(--text-sub);
  font-size: 18px; line-height: 1; padding: 0 2px;
}
.search-clear:hover { color: var(--text); }

/* ===== 施工流程拖拽手柄 ===== */
.drag-handle { cursor: grab; color: var(--text-sub); margin-right: 6px; font-size: 14px; }
.drag-handle:active { cursor: grabbing; }
tr[data-proc][draggable="true"]:hover td { background: #f5f7fb; }
.proc-num-cell { white-space: nowrap; }
.proc-num { display: inline-block; min-width: 18px; }
.btn-proc-add {
  margin-left: 8px; padding: 0 7px; font-size: 15px; line-height: 1.5;
  border-radius: 5px; color: var(--primary); background: #eaf1ff;
  border: 1px solid transparent; cursor: pointer; vertical-align: middle;
}
.btn-proc-add:hover { background: #d9e6ff; border-color: var(--primary); }

/* ===== 两周工作日历 ===== */
#ovCalendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-weektag { font-size: 10px; font-weight: 700; color: #fff; background: #2b5cff; border-radius: 999px; padding: 1px 6px; margin-right: 4px; letter-spacing: .5px; }
.cal-weektag:empty { display: none; }
.cal-day { border: 1px solid var(--border); border-radius: 10px; padding: 8px; min-height: 200px; min-width: 0; background: #fff; overflow: visible; }
.cal-weekend { background: #fafbfe; }
.cal-today { border-color: #2b5cff; box-shadow: 0 0 0 1px #2b5cff; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-date { font-weight: 700; font-size: 16px; color: var(--text); }
.cal-date-today { color: #2b5cff; }
.cal-week { font-size: 12px; color: var(--text-sub); }
.cal-body { display: flex; flex-direction: column; gap: 5px; }
.cal-item { font-size: 13px; padding: 4px 8px; border-radius: 6px; line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.cal-dept-品牌部 { background: #eafaf0; color: #1a9e63; }
.cal-dept-设计部 { background: #eaf1ff; color: #2b5cff; }
.cal-dept-工程部 { background: #fff3e0; color: #c47a00; }
.cal-invite { background: #e60012; color: #fff; font-weight: 600; }
.cal-empty { font-size: 12px; color: #c0c6d1; text-align: center; padding: 8px 0; }

/* ===== 资料库折叠 + 风格标签 ===== */
.lib-style-tag { display: inline-block; font-size: 12px; font-weight: 500; color: #2b5cff; background: #eaf1ff; border-radius: 999px; padding: 1px 10px; margin-left: 6px; vertical-align: middle; }
.lib-body { margin-top: 12px; }
.library-head { display: flex; align-items: center; gap: 8px; }

/* ===== Excel 预览表格 ===== */
.excel-preview-table { border-collapse: collapse; width: max-content; min-width: 100%; }
.excel-preview-table td { border: 1px solid var(--border); padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.excel-preview-table tr:first-child td { background: #f5f7fb; font-weight: 600; }

/* ===== 客户状态下拉（彩色选项卡） ===== */
select.badge.status-select { border: none; cursor: pointer; -webkit-appearance: none; appearance: none; padding: 3px 24px 3px 12px; font-size: 12px; font-weight: 600; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
select.badge.status-select option { background: #fff; color: #1f2329; font-weight: 500; }

/* ===== 资料库不公开文件标识 ===== */
.lib-private { background: #fff7e6; border-radius: 8px; }

/* ===== 卡片式日历（设计部/工程部） ===== */
.cal-day-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.cal-day-card:last-child { margin-bottom: 0; }
.cal-card-today { border-color: #2b5cff; box-shadow: 0 0 0 1px #2b5cff; background: #f7f9ff; }
.cal-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-card-date { font-weight: 700; font-size: 15px; color: var(--text); }
.cal-card-body { display: flex; flex-direction: column; gap: 5px; }

/* ===== 设计部/工程部日历并排 + 紧凑 ===== */
.cal-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 960px) { .cal-two-col { grid-template-columns: 1fr; } }
#ovDesignCalendar, #ovConstructionCalendar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#ovDesignCalendar .cal-day, #ovConstructionCalendar .cal-day { min-height: 72px; padding: 7px; }
#ovDesignCalendar .cal-item, #ovConstructionCalendar .cal-item { font-size: 12px; padding: 3px 6px; line-height: 1.4; }
#ovDesignCalendar .cal-head, #ovConstructionCalendar .cal-head { margin-bottom: 4px; }
#ovDesignCalendar .cal-date, #ovConstructionCalendar .cal-date { font-size: 14px; }

/* ===== 日历事务 ===== */
.cal-event { background: #fff8e1; color: #8a6d00; cursor: pointer; border: 1px dashed #e0c568; }
.cal-add-btn { margin-top: 4px; align-self: flex-start; border: 1px dashed var(--border); background: #f7f8fa; color: var(--text-sub); border-radius: 6px; font-size: 12px; line-height: 1; padding: 3px 8px; cursor: pointer; }
.cal-add-btn:hover { border-color: #2b5cff; color: #2b5cff; }

/* ===== 一键终结分组 ===== */
.fast-end-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }

/* ===== @我的事务：月份分组 ===== */
.mention-month-group { margin-bottom: 14px; }
.mention-month-head {
  font-weight: 600; font-size: 13px; color: var(--primary);
  padding: 4px 0; border-bottom: 1px dashed var(--border); margin-bottom: 8px;
}
.mention-month-head .count { color: var(--text-sub); font-weight: 400; font-size: 12px; margin-left: 4px; }
.fast-end-item .wo-item-title { font-weight: 600; }

/* ===== 设计师备注 ===== */
.designer-note { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid #ffe3a3; border-radius: 10px; background: #fffaf0; }
.designer-note-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.designer-note-view { color: var(--text); font-size: 13px; white-space: pre-wrap; }
/* 设计师备注输入框（无表头、无保存按钮，失焦自动保存） */
.designer-note-input { width: 100%; min-height: 52px; resize: vertical; }
/* 流程步骤"写备注"钢笔图标 */
.step-remark-icon { color: var(--text-sub); padding: 0 6px; border: none; background: transparent; font-size: 14px; cursor: pointer; }
.step-remark-icon:hover { color: var(--primary); }
.step-remark-icon.active { color: var(--primary); }
.step-remark-input { width: 100%; font-size: 12px; resize: vertical; margin-top: 6px; }
.step-remark-text { width: 100%; font-size: 12px; color: var(--text-sub); line-height: 1.6; margin-top: 6px; padding: 6px 8px; background: #fafbfe; border-left: 3px solid #b7c2ff; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
/* 已完成历史步骤折叠 */
.step-history-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--primary); cursor: pointer; user-select: none; padding: 4px 0; }
.step-history-toggle:hover { color: var(--primary-hover); }
.step-history { margin-top: 4px; }
/* 流程步骤日期按钮（触发自定义日历） */
.step-date-btn { min-width: 140px; padding: 4px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.step-date-btn:hover { border-color: var(--primary); }
/* 自定义日期日历 popover */
.date-popover { background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 10px; min-width: 240px; user-select: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-head span { font-weight: 600; font-size: 13px; }
.dp-nav { border: none; background: transparent; cursor: pointer; font-size: 16px; padding: 2px 8px; border-radius: 6px; color: var(--text); }
.dp-nav:hover { background: #f0f4ff; color: var(--primary); }
.dp-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-empty { height: 30px; }
.dp-day { height: 30px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 13px; }
.dp-day:hover { background: #f0f4ff; }
.dp-day.selected { background: var(--primary); color: #fff; }
.dp-day.today { font-weight: 700; color: var(--primary); }
.dp-day.selected.today { color: #fff; }
.dp-foot { display: flex; gap: 8px; margin-top: 8px; justify-content: space-between; }
.dp-clear-btn { color: var(--danger); }

/* ===== 客户详情卡片 ===== */
.cust-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.cust-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.cust-label { flex: 0 0 100px; color: var(--text-sub); font-size: 12px; }
.cust-value { flex: 1; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 640px) { .cust-info { grid-template-columns: 1fr; } }

/* ===== 日历：已延期展示区 ===== */
.cal-delayed { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #f2c1c4; border-radius: 10px; background: #fdf2f2; }
.cal-delayed-title { font-weight: 700; font-size: 13px; color: var(--danger); margin-bottom: 8px; }
.cal-dept-延期 { background: #fdecec; color: var(--danger); }
#ovDesignCalendar .cal-delayed, #ovConstructionCalendar .cal-delayed { grid-column: 1 / -1; }

/* ===== 日历事务 @ 功能 ===== */
.mention-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow-y: auto; padding: 4px 0; }
.mention-item { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer; background: #fafbfd; }
.mention-item:hover { border-color: var(--primary); }
.mention-item input { cursor: pointer; }
.cal-mention-tag { color: var(--primary); font-size: 12px; font-weight: 600; }
.cal-event-mention { background: #eaf1ff !important; color: var(--primary) !important; border: 1px solid #2b5cff !important; }

/* ===== @我的工作事务（总览列表 & 提醒弹窗） ===== */
.mention-ov-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fff; margin-bottom: 8px; }
.mention-ov-item:last-child { margin-bottom: 0; }
.mention-ov-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mention-ov-item-head strong { font-size: 14px; }
.mention-ov-item-content { margin-top: 6px; font-size: 14px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
/* @我的事务：单行紧凑展示（先事务，再谁@的+日期+状态+接收） */
.mention-ov-line { display: flex; align-items: center; gap: 10px; padding: 9px 14px; }
.mention-ov-content { flex: 1; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-ov-line .sub { flex-shrink: 0; font-size: 12px; }

/* ===== 移动端适配 ===== */
.mobile-topbar { display: none; }
.sidebar-mask { display: none; }

@media (max-width: 768px) {
  /* 移动端顶栏：始终在侧边栏抽屉之上，方便随时关闭抽屉 */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed; top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(23, 29, 44, .94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    z-index: 90;
    padding: 0 14px;
  }
  .mobile-menu-btn {
    background: transparent; border: none; color: #fff;
    font-size: 22px; line-height: 1; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
    min-width: 36px;
  }
  .mobile-menu-btn:active { background: rgba(255,255,255,.14); }
  .mobile-topbar-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 侧边栏抽屉化：显式高度（不用 bottom:0，避开 iOS Safari + transform 渲染异常） */
  .sidebar {
    width: 240px;
    height: 100vh;
    height: 100dvh;
    top: 0; left: 0; right: auto;
    position: fixed;
    transform: translateX(-100%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .sidebar:hover { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open:hover { transform: translateX(0); }
  .sidebar.fixed { transform: translateX(-100%); }
  .sidebar.fixed.open { transform: translateX(0); }
  .sidebar:not(:hover)::after { content: none; }
  .sidebar.open::after { content: none; }

  /* 关键：让 nav 区域在 flex column 中正确占据剩余空间 + 可滚动 */
  .sidebar .side-nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px 14px;
    flex-direction: column;  /* 覆盖旧的 900px 横排规则，主菜单竖排 */
  }
  .sidebar .logo { padding: 16px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sidebar .logo-text { display: block; }
  .sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); margin-left: 0; }
  .sidebar .nav-item { padding: 12px 14px; font-size: 15px; }

  /* 侧边栏遮罩 */
  .sidebar-mask {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 75;
  }
  .sidebar-mask.show { display: block; }

  /* 主内容区 */
  .main-content { margin-left: 0; padding: 66px 14px 40px; max-width: 100vw; }
  body.fixed-sidebar .main-content { margin-left: 0; max-width: 100vw; }

  /* 卡片 */
  .dept-grid { grid-template-columns: 1fr; gap: 14px; }
  .finance-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .brand-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-row { flex-wrap: wrap; gap: 10px; }
  .section-card { padding: 14px; }
  .dept-card { padding: 16px; }
  .brand-stat { padding: 14px; }

  /* 头部与操作栏 */
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .head-actions { width: 100%; }
  .toolbar-search { flex: 1 1 100%; max-width: none; }
  .sub-tabs { flex-wrap: wrap; }

  /* 弹窗 */
  .modal-mask { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
}

/* ===== 日历事务：按人员配色，每条整体成块（品牌邀约保持红色） ===== */
.cal-item.cal-event {
  display: block; border-radius: 6px; padding: 5px 8px; margin-bottom: 5px;
  font-size: 13.5px; line-height: 1.45; word-break: break-word;
  border-left: 3px solid transparent; background: #f2f4f7; color: var(--text);
}
.cal-p-chen { background: #e6f7ec !important; border-left-color: #34a853 !important; color: #1c6b39 !important; }
.cal-p-zhou { background: #e7f0ff !important; border-left-color: #2b6ef6 !important; color: #17417f !important; }
.cal-p-zhang { background: #fff5dd !important; border-left-color: #e0a100 !important; color: #7a5700 !important; }
.cal-p-wang { background: #f3ecff !important; border-left-color: #7b3fe4 !important; color: #4a2490 !important; }
.cal-item.cal-invite { display: block; border-radius: 6px; }

/* ===== 手机端日历：单周竖向排列 ===== */
@media (max-width: 768px) {
  #ovCalendar { grid-template-columns: 1fr; gap: 10px; }
  .cal-day { min-height: auto; padding: 10px 12px; }
  .cal-head { margin-bottom: 8px; }
  .cal-item.cal-event { font-size: 14px; padding: 7px 10px; margin-bottom: 6px; }
  .cal-item.cal-invite { font-size: 14px; padding: 7px 10px; }
  .cal-empty { padding: 2px 0 4px; }
  .cal-weektag { font-size: 11px; padding: 2px 8px; }
}

/* ===== 手机端：品牌部到店客户 / 客资数据 表格转卡片（与工程部卡片风格一致） ===== */
@media (max-width: 768px) {
  #brandBoard, #leadsBoard { display: block; border: none; background: transparent; box-shadow: none; }
  #brandBoard thead, #leadsBoard thead { display: none; }
  #brandTableBody, #leadsBody { display: block; }
  #brandTableBody > tr, #leadsBody > tr {
    display: block; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px;
  }
  /* 月份分组行：去掉卡片外观 */
  #brandTableBody > tr.month-group-row, #leadsBody > tr.month-group-row {
    background: transparent; border: none; box-shadow: none; padding: 2px 2px 6px; margin-bottom: 0;
  }
  #brandTableBody > tr.month-group-row > td, #leadsBody > tr.month-group-row > td { display: block; padding: 0; text-align: left; }
  /* 字段行：左标签 / 右内容 */
  #brandTableBody > tr:not(.month-group-row) > td,
  #leadsBody > tr:not(.month-group-row) > td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; border: none; padding: 6px 0; font-size: 13px; text-align: right;
  }
  #brandTableBody > tr:not(.month-group-row) > td::before,
  #leadsBody > tr:not(.month-group-row) > td::before {
    content: attr(data-label); color: var(--text-sub); font-size: 12px; flex: 0 0 auto; text-align: left;
  }
  /* 无标签列（勾选 / 操作）：右对齐，不显示标签文字 */
  #brandTableBody > tr > td[data-label=""]::before,
  #leadsBody > tr > td[data-label=""]::before { content: ''; display: none; }
  #brandTableBody > tr > td[data-label=""],
  #leadsBody > tr > td[data-label=""] { justify-content: flex-end; }
  /* 卡片标题：小区名 */
  #brandTableBody > tr > td[data-col="name"], #leadsBody > tr > td[data-col="community"] {
    justify-content: flex-start; text-align: left; font-size: 15px; font-weight: 700;
    border-bottom: 1px dashed var(--border); padding-bottom: 9px; margin-bottom: 4px;
  }
  #brandTableBody > tr > td[data-col="name"]::before,
  #leadsBody > tr > td[data-col="community"]::before { display: none; }
  /* 隐藏列在手机上也不显示 */
  #brandTableBody > tr > td.col-hidden, #leadsBody > tr > td.col-hidden { display: none; }
}

/* ===== 手机端：设计部工单卡片微调（与工程部一致） ===== */
@media (max-width: 768px) {
  .wo-item { border-radius: 12px; }
  .wo-item-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .wo-item-body { padding: 12px 14px; }
  .construction-project { padding: 12px 14px; }
}

/* ===== 手机端品牌部卡片：只保留 小区名 / 进店时间 / 客户状态（+ 勾选与操作按钮） ===== */
@media (max-width: 768px) {
  #brandTableBody > tr:not(.month-group-row) > td[data-col="unit"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="houseStatus"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="owner"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="area"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="source"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="designer"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="remark"],
  #brandTableBody > tr:not(.month-group-row) > td[data-col="attach"] { display: none !important; }
}

/* ===== 手机端：品牌部 / 客资 卡片模式适配屏幕宽度（去掉 800px 最小宽度与横向滚动） ===== */
@media (max-width: 768px) {
  .table-wrap.mobile-cards {
    overflow-x: visible; background: transparent; box-shadow: none; border-radius: 0; padding: 0;
  }
  .table-wrap.mobile-cards .table { min-width: 0 !important; width: 100% !important; display: block; }
  #brandTableBody > tr > td, #leadsBody > tr > td { min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
  /* 内容区不超出卡片：右侧内容可换行 */
  #brandTableBody > tr:not(.month-group-row) > td,
  #leadsBody > tr:not(.month-group-row) > td { min-width: 0; }
  #brandTableBody > tr:not(.month-group-row) > td > *, 
  #leadsBody > tr:not(.month-group-row) > td > * { max-width: 100%; }
}

/* ===== 手机端卡片：排列更紧凑 ===== */
@media (max-width: 768px) {
  #brandTableBody > tr, #leadsBody > tr {
    padding: 8px 11px; margin-bottom: 6px; border-radius: 10px;
  }
  #brandTableBody > tr.month-group-row, #leadsBody > tr.month-group-row {
    padding: 0 2px 4px; margin-bottom: 0;
  }
  #brandTableBody > tr:not(.month-group-row) > td,
  #leadsBody > tr:not(.month-group-row) > td {
    padding: 2.5px 0; font-size: 12.5px; gap: 8px;
  }
  #brandTableBody > tr:not(.month-group-row) > td::before,
  #leadsBody > tr:not(.month-group-row) > td::before { font-size: 11.5px; }
  #brandTableBody > tr > td[data-col="name"], #leadsBody > tr > td[data-col="community"] {
    font-size: 14.5px; padding-bottom: 6px; margin-bottom: 1px;
  }
  /* 内嵌下拉/按钮收紧 */
  #brandTableBody .status-select, #brandTableBody select.input { padding: 2px 6px !important; min-height: 26px; font-size: 12px; }
  #brandTableBody > tr > td .btn, #leadsBody > tr > td .btn { padding: 3px 8px; font-size: 12px; }
  /* 设计部 / 工程部卡片间距同步收紧 */
  .wo-item { margin-bottom: 8px; }
  .wo-item-head { padding: 10px 12px; }
  .wo-item-body { padding: 10px 12px; }
  .construction-project { padding: 10px 12px; }
  .designer-group { margin-bottom: 10px; }
}

/* 业主须知：项目选择列表 */
.on-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; background: #fff; }
.on-item { padding: 9px 12px; font-size: 13px; border-bottom: 1px solid #f2f5f9; cursor: pointer; }
.on-item:last-child { border-bottom: none; }
.on-item:hover { background: #f7f9fd; }
.on-item.on { background: #eef4ff; color: #2b5cff; font-weight: 700; }

/* 竣工预计周期（工程部填写，同步给业主） */
.dur-est { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; padding: 10px 12px; background: #f7f9fc; border: 1px dashed #d7dee9; border-radius: 8px; }
.dur-est .dur-title { font-weight: 700; font-size: 13px; }
.dur-est .dur-inp { width: 68px; height: 32px; padding: 0 8px; text-align: center; }
.dur-est .dur-date { width: 150px; height: 32px; padding: 0 8px; }
.dur-est .dur-sep, .dur-est .dur-unit { font-size: 13px; color: #6b7484; }

/* 业主手机号（品牌部/管理员在客户详情录入，最多 3 个） */
.owner-phones-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.owner-phones-row .input { min-width: 150px; }

/* 库存情况表：消耗品 / 资产左右并列（不用滚到底才看到资产） */
.inv-duo { display: flex; gap: 16px; align-items: flex-start; }
.inv-duo > .inv-block { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
.inv-duo .table { min-width: 0; }
.inv-duo .table th, .inv-duo .table td { padding: 10px 10px; font-size: 13px; }
.inv-duo .table td strong { word-break: break-all; }
@media (max-width: 900px) {
  .inv-duo { flex-direction: column; }
  .inv-duo > .inv-block { width: 100%; margin-bottom: 20px; }
}

/* 入库登记：只有领用记录、从未入库的物品（待补录） */
.inv-missing { background: #fffdf5 !important; }
.inv-missing td { color: #8a6d1f; }
.inv-missing:hover { background: #fff7e3 !important; }

/* 出库记录 / 入库登记：消耗品与资产左右并列（列较多时栏内横向滚动） */
.inv-duo-wide .table { min-width: 620px; }
.inv-duo-wide .table th, .inv-duo-wide .table td { padding: 10px 8px; font-size: 12.5px; }

/* 工地巡检备注 */
.i-note {
  margin: 8px 0 6px; font-size: 13px; line-height: 1.6; color: var(--text);
  background: #f7f9fc; border-left: 3px solid #b9cdf5; border-radius: 6px;
  padding: 8px 10px; white-space: pre-wrap; word-break: break-word;
}
