:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --ink: #16161d;
  --muted: #8a8a99;
  --line: #e7e7ec;
  --accent: #ff5436;
  --accent-soft: #fff0ec;
  --shadow: 0 1px 3px rgba(20,20,30,.06), 0 8px 24px rgba(20,20,30,.06);
  /* 状态色 */
  --s-gray: #9aa0aa; --s-gray-bg: #eef0f3;
  --s-blue: #2f6bff; --s-blue-bg: #eaf1ff;
  --s-indigo: #6b4fff; --s-indigo-bg: #f0ecff;
  --s-orange: #f5821f; --s-orange-bg: #fff2e3;
  --s-green: #1faa59; --s-green-bg: #e7f7ee;
  --s-red: #e23b3b; --s-red-bg: #fdeaea;
}

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

/* ====== 顶栏 ====== */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; margin-right: auto; }
.brand .logo { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.brand .sub { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.role-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.role-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; transition: .15s;
}
.role-btn:hover { border-color: var(--accent); color: var(--accent); }
.role-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.btn-primary {
  background: var(--accent); color: #fff; border: none; padding: 9px 20px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* ====== 容器 ====== */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }

/* ====== 统计卡 ====== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px; box-shadow: var(--shadow); overflow: hidden; }
.stat-card .num { font-size: 22px; font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card .lbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card.alert .num { color: var(--s-red); }

/* 经营总览专用 KPI 网格（更宽松） */
.dash-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.dash-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.dash-kpi .dk-num { font-size: 19px; font-weight: 800; line-height: 1.3; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-kpi .dk-num.dk-money { color: var(--s-green); font-variant-numeric: tabular-nums; }
.dash-kpi .dk-num.dk-warn { color: var(--s-orange); }
.dash-kpi .dk-lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ====== 筛选栏 ====== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=text], .filters select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; color: var(--ink);
}
.filters input[type=text] { min-width: 240px; flex: 1; }
.mine { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* 导出按钮 */
.export-btns { display: flex; gap: 6px; margin-left: auto; }
.btn-export {
  border: 1px solid var(--line); background: var(--surface); border-radius: 7px;
  padding: 7px 14px; font-size: 12.5px; cursor: pointer; transition: .15s;
  color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: 4px;
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ====== 看板卡片 ====== */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  border-left: 4px solid var(--accent);
}
.card.overdue { border-left-color: var(--s-red); }
.card .c-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card .c-customer { font-size: 16px; font-weight: 700; }
.card .c-code { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.card .price-tag {
  flex-shrink: 0;
  font-size: 15px; font-weight: 800; color: var(--s-green);
  background: var(--s-green-bg);
  border: 1px solid #bfe9cf;
  padding: 4px 12px; border-radius: 999px;
  white-space: nowrap; letter-spacing: .3px;
}
.card .price-tag.price-empty { color: var(--muted); background: #f1f1f3; border-color: var(--line); font-weight: 600; font-size: 12px; }
.card .c-meta { font-size: 12px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.b-gray { color: var(--s-gray); background: var(--s-gray-bg); }
.b-blue { color: var(--s-blue); background: var(--s-blue-bg); }
.b-indigo { color: var(--s-indigo); background: var(--s-indigo-bg); }
.b-orange { color: var(--s-orange); background: var(--s-orange-bg); }
.b-green { color: var(--s-green); background: var(--s-green-bg); }
.b-red { color: var(--s-red); background: var(--s-red-bg); }
.ddl { font-size: 12px; }
.ddl.over { color: var(--s-red); font-weight: 700; }
.ddl.ok { color: var(--muted); }
.card .c-desc { font-size: 13px; color: #444; background: #fafafb; border-radius: 8px; padding: 8px 10px; }
.card .c-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.mini-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: .15s; }
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.danger:hover { border-color: var(--s-red); color: var(--s-red); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; grid-column: 1 / -1; }

/* ========================================
   弹窗 — 完全重写，确保表单布局稳定
   ======================================== */

.modal-mask[hidden] { display: none !important; }
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20,20,30,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--surface);
  width: 100%; max-width: 640px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(20,20,30,.15);
  animation: pop .2s ease;
  margin: auto;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }

.close {
  border: none; background: none; font-size: 24px; cursor: pointer;
  color: var(--muted); line-height: 1;
  padding: 6px 10px; border-radius: 8px; transition: .15s;
  min-width: 38px; min-height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
}
.close:hover { background: #f3f3f5; color: var(--ink); }

/* 弹窗主体 — 表单区 */
.modal-body {
  padding: 22px 24px 16px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 单个字段：标签 + 输入控件 */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 12px; color: var(--muted); font-weight: 600;
  letter-spacing: .3px; text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  width: 100%;
  background: var(--surface);
  transition: border-color .15s;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: #bbb; }

/* select 下拉框确保正常渲染 */
.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238a8a99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.field select:disabled { opacity: .55; cursor: not-allowed; }
.field input:disabled, .field textarea:disabled { opacity: .55; cursor: not-allowed; background: #fafafa; }
.field textarea { resize: vertical; min-height: 68px; line-height: 1.5; }

/* 双列字段行 */
.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* 分节标题 */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 6px 0 -2px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  letter-spacing: .3px;
}
.section-title:first-child { margin-top: 0; }

/* 设计文件 / 附件 */
.att-list { display: flex; flex-direction: column; gap: 8px; }
.att-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fafafb; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 13px;
}
.att-ico { font-size: 15px; }
.att-name {
  color: var(--accent); font-weight: 600; text-decoration: none;
  word-break: break-all; max-width: 60%;
}
.att-name:hover { text-decoration: underline; }
.att-meta { color: var(--muted); font-size: 12px; }
.att-item .att-del { margin-left: auto; padding: 5px 10px; font-size: 12px; }
.upload-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.upload-row input[type="file"] {
  flex: 1; min-width: 0; font-size: 13px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; background: #fafafb;
}

/* 报价单 / 服务合同 绑定 */
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.doc-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.doc-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
}
.doc-row-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.doc-amt { margin-left: auto; font-weight: 700; color: var(--s-orange); font-variant-numeric: tabular-nums; }
.doc-date { font-size: 12px; color: var(--muted); margin-top: 3px; }
.doc-note { font-size: 13px; color: #44506a; margin-top: 4px; line-height: 1.5; }
.doc-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.doc-file { display: inline-flex; align-items: center; gap: 4px; background: #f3f5f8; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 8px; font-size: 12px; }
.doc-file a { color: var(--s-blue); text-decoration: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-file a:hover { text-decoration: underline; }
.doc-file .doc-file-del { padding: 2px 6px; font-size: 11px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.doc-upload-label { cursor: pointer; }
.doc-form {
  border: 1px dashed var(--s-orange); border-radius: 12px; padding: 14px; margin: 8px 0;
  background: #fff8f3;
}

/* 脚本传递板块 */
.sc-filters { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sc-filters select { font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; }
.sc-list { display: flex; flex-direction: column; gap: 12px; }
.sc-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; box-shadow: 0 1px 2px rgba(20,30,60,.04); }
.sc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-code { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 700; }
.sc-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.sc-head .badge { margin-left: auto; }
.sc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.sc-by, .sc-to, .sc-rel { color: #44506a; }
.sc-body { margin-top: 10px; padding: 10px 12px; background: #fafafb; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; line-height: 1.6; color: #2b3445; white-space: normal; max-height: 260px; overflow-y: auto; }
.sc-fb { margin-top: 8px; font-size: 13px; color: #2b3445; background: #fff8f3; border: 1px solid #ffd9bf; border-radius: 8px; padding: 8px 10px; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sc-actions .btn-mini { padding: 6px 12px; font-size: 12px; }
/* 小按钮（卡片内行内操作） */
.btn-mini { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: .15s; }
.btn-mini:hover { border-color: var(--s-blue); color: var(--s-blue); }
.btn-mini.b-blue { border-color: #bcd6ff; color: #2563eb; background: #f0f6ff; }
.btn-mini.b-green { border-color: #bfe6cf; color: #18a06a; background: #effaf3; }
.btn-mini.b-orange { border-color: #ffd9b0; color: #d9740b; background: #fff5ec; }
.btn-mini.b-red { border-color: #ffc2c2; color: #e0413e; background: #fff0f0; }
.empty-tip { color: var(--muted); font-size: 13px; padding: 28px 12px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; background: #fafafb; }

/* 待办计划板块 */
.todos:not([hidden]) { display: block; }
.todos[hidden] { display: none !important; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { border: none; background: #fff; color: var(--ink); padding: 7px 16px; font-size: 13px; cursor: pointer; transition: .15s; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--s-blue); color: #fff; }
.seg-btn:not(.active):hover { background: #f3f6fb; }
.chk-group { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink); cursor: pointer; }
.chk input { width: 15px; height: 15px; }
.b-purple { color: #7c3aed; background: #f3e8ff; }

/* 进展时间线 */
.note-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.note-item {
  background: #fafafb; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5;
}
.note-item .n-by { font-weight: 700; }
.note-item .n-at { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* 弹窗底部按钮栏 */
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-foot .mini-btn {
  padding: 9px 18px; font-size: 14px; border-radius: 8px;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px;
  border-radius: 999px; font-size: 13px; z-index: 99;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* 响应式：手机端 */
@media (max-width: 640px) {
  .topbar { padding: 12px 14px; }
  .brand { margin-right: 0; width: 100%; }
  .role-switch { width: 100%; }
  .container { padding: 16px 14px 50px; }
  .board { grid-template-columns: 1fr; }
  .modal { max-width: 100%; border-radius: 14px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field-row.three { grid-template-columns: 1fr; }
  .modal-body { padding: 18px 18px 12px; max-height: calc(100vh - 120px); }
  .modal-foot { padding: 12px 18px 18px; }
}

/* ====== Tab 切换：工单列表 / 甘特图 ====== */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab-btn {
  border: none; background: none; padding: 10px 18px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; position: relative; transition: .15s;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ====== 甘特图（Time Schedule） ====== */
.gantt { margin-top: 4px; }
.g-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.g-title { font-size: 15px; font-weight: 700; }
.g-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.g-leg { display: inline-flex; align-items: center; gap: 5px; }
.g-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.g-leg-today { color: var(--accent); font-weight: 600; }
.g-mine { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }

.g-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.g-grid { position: relative; }

.g-axis { display: flex; border-bottom: 1px solid var(--line); background: #fafafb; position: sticky; top: 0; z-index: 6; }
.g-corner {
  flex-shrink: 0; position: sticky; left: 0; z-index: 7; background: #fafafb;
  border-right: 1px solid var(--line); padding: 8px 12px; font-size: 12px; font-weight: 700;
  color: var(--muted); display: flex; align-items: center;
}
.g-axis-dates { position: relative; height: 36px; }
.g-tick { position: absolute; top: 0; height: 36px; border-left: 1px solid var(--line); padding-left: 4px; font-size: 11px; color: var(--muted); display: flex; align-items: center; }
.g-tick.wk { border-left-color: #d8d8e0; }
.g-tick.mo { border-left: 2px solid #c4c4d0; color: var(--ink); font-weight: 700; }

.g-body { position: relative; }
.g-row { display: flex; border-bottom: 1px solid var(--line); min-height: 46px; }
.g-row:last-child { border-bottom: none; }
.g-label {
  flex-shrink: 0; position: sticky; left: 0; z-index: 3; background: var(--surface);
  border-right: 1px solid var(--line); padding: 8px 12px;
  display: flex; flex-direction: column; justify-content: center;
}
.g-l-cust { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 136px; }
.g-l-code { font-size: 11px; color: var(--muted); }
.g-track { position: relative; flex: 1; }

.g-bar {
  position: absolute; top: 10px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; padding: 0 8px; overflow: hidden; cursor: pointer;
  color: #fff; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); transition: filter .15s;
}
.g-bar:hover { filter: brightness(1.08); }
.g-bar-txt { overflow: hidden; text-overflow: ellipsis; }
.g-gray { background: var(--s-gray); }
.g-blue { background: var(--s-blue); }
.g-indigo { background: var(--s-indigo); }
.g-orange { background: var(--s-orange); }
.g-green { background: var(--s-green); }
.g-red { background: var(--s-red); }
.g-bar.overdue { outline: 2px solid var(--s-red); outline-offset: 1px; }

.g-nosched { position: absolute; top: 14px; left: 8px; font-size: 12px; color: var(--muted); font-style: italic; }

.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .55; z-index: 5; pointer-events: none; }

/* ====== 甘特图响应式 ====== */
@media (max-width: 640px) {
  .tab-btn { padding: 9px 12px; font-size: 13px; }
  .g-label, .g-corner { width: 116px !important; }
  .g-l-cust { max-width: 92px; }
  .g-wrap { border-radius: 10px; }
}

/* ====== 用户区 ====== */
.user-area { display: flex; align-items: center; gap: 8px; }
.user-area .who { font-size: 13px; color: var(--ink); font-weight: 600; }
.user-area .mini-btn { padding: 6px 10px; font-size: 12px; }

/* ====== 登录遮罩 ====== */
#loginMask { display: flex; }
.login-box {
  margin: auto; width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface); border-radius: 16px; padding: 32px 26px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.login-brand { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-box input {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 14px; outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box .btn-primary { margin-top: 4px; padding: 11px; }
.login-err { color: var(--s-red); font-size: 13px; text-align: center; }

/* ====== 工单来源徽标 ====== */
.b-src { color: #7a4fd6; background: #f1ebff; }

/* ====== 流量投放 ====== */
.traffic { margin-top: 4px; }
.t-section { margin-bottom: 22px; }
.t-sec-title { font-size: 15px; font-weight: 700; margin: 4px 0 12px; }
.t-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.t-card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.t-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.t-leg { display: inline-flex; align-items: center; gap: 6px; }
.t-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.t-sw.v { background: #2f6bff; }
.t-sw.i { background: #f5821f; }

.t-bar-row { display: grid; grid-template-columns: 100px 1fr 155px; align-items: center; gap: 10px; padding: 7px 0; overflow: hidden; }
.t-bar-label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; }
.t-bar-n { font-size: 11px; color: var(--muted); font-weight: 400; }
.t-bar-track { display: flex; flex-direction: column; gap: 4px; }
.t-bar { position: relative; height: 20px; border-radius: 5px; min-width: 2px; }
.t-bar-v { background: #2f6bff; }
.t-bar-i { background: #f5821f; }
.t-bar-val { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #fff; white-space: nowrap; }
.t-bar-conv { font-size: 12px; color: var(--s-green); font-weight: 700; text-align: right; }
.t-bar-cr { font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-fc { font-weight: 700; }
.t-fc.direct { color: #7a4fd6; }
.t-fc.indirect { color: #18a999; }

/* 转化率公式说明框 */
.t-formula { background: #f7f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.t-formula-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.t-formula-row { font-size: 13px; color: var(--ink); line-height: 1.9; }
.t-formula-row .t-fc.direct { background: #f1ebff; padding: 1px 6px; border-radius: 4px; }
.t-formula-row .t-fc.indirect { background: #e6f7f4; padding: 1px 6px; border-radius: 4px; }

.t-svg { width: 100%; height: auto; display: block; }

.t-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.t-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.t-table th, .t-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t-table th { background: #fafafb; font-size: 12px; color: var(--muted); font-weight: 700; }
.t-table tbody tr:last-child td { border-bottom: none; }
.t-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-title-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-actions-cell { white-space: nowrap; }

@media (max-width: 640px) {
  .t-bar-row { grid-template-columns: 84px 1fr 115px; gap: 8px; }
  .t-title-cell { max-width: 140px; }
}

/* ========== 分红看板（Dividend） ========== */
.dividend { padding: 4px 0; }
.d-rules { background: #f7f8fb; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.d-rules-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.d-rule { font-size: 13px; line-height: 2; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.d-mode { font-size: 11px; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 8px; white-space: nowrap; }
.d-mode.mode-A { background: #2f6bff; }
.d-mode.mode-B { background: #7a4fd6; }
.d-mode.mode-C { background: #18a999; }
.d-mode.mode-1 { background: #7a4fd6; }
.d-mode.mode-2 { background: #2f6bff; }
.d-mode.mode-3 { background: #18a999; }
.d-mode.mode-4 { background: #f5821f; }

/* 总计卡配色 */
.stat-card.c-lily   { border-left: 4px solid #7a4fd6; }
.stat-card.c-july   { border-left: 4px solid #2f6bff; }
.stat-card.c-green  { border-left: 4px solid #18a999; }
.stat-card.c-boss   { border-left: 4px solid #ca8a04; }
.stat-card.c-public { border-left: 4px solid #f5821f; }
.stat-card.c-grand  { border-left: 4px solid var(--ink); }

.d-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); margin-top: 16px; }
.d-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.d-table th, .d-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.d-table th { background: #fafafb; font-size: 12px; color: var(--muted); font-weight: 700; }
.d-table tbody tr:last-child td { border-bottom: none; }
.d-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 工单卡片：分红归属徽标 */
.badge.b-res { color: #2f6bff; background: #e8f0ff; }
.badge.b-neg { color: #7a4fd6; background: #f1ebff; }
.badge.b-amt { color: #18a999; background: #e6f7f4; }
.badge.b-quote { color: #c2410c; background: #ffedd5; }
.badge.b-contract { color: #6d28d9; background: #f3e8ff; }
.badge.b-div { color: #ca8a04; background: #fef9c3; }

/* ========== 公共资金（Fund） ========== */
.fund { padding: 4px 0; }
/* ===== 公共资金规则卡片（清爽分段式） ===== */
.f-rules-card { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.f-rules-head { font-size: 13px; font-weight: 700; color: var(--muted); padding: 11px 16px 0; letter-spacing: .3px; }
.f-rules-body { padding: 8px 4px 12px; }
.f-rule-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 12px; border-radius: 6px; transition: background .15s; }
.f-rule-row:hover { background: rgba(0,0,0,.03); }
.f-idx { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: 11px; font-weight: 700; color: var(--accent); background: rgba(245,130,31,.1); border-radius: 50%; flex-shrink: 0; margin-top: 2px; }
.f-rule-content { flex: 1; min-width: 0; }
.f-rule-lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
.f-rule-txt { margin: 2px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.d-rule { flex-wrap: wrap; }
.f-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.f-tip { font-size: 12px; color: var(--muted); }
.f-sec-title { font-size: 15px; font-weight: 700; margin: 18px 0 12px; }
.f-shot { color: var(--accent); font-weight: 600; text-decoration: none; }
.f-shot:hover { text-decoration: underline; }
.f-muted { color: var(--muted); font-size: 12px; }
.f-cur-shot { font-size: 13px; color: var(--muted); }
.f-cur-shot a { color: var(--accent); text-decoration: none; }
.f-cur-shot a:hover { text-decoration: underline; }
.stat-card.c-red { border-left: 4px solid var(--s-red); }
.stat-card .num.c-grand { color: var(--s-indigo); }
.dash-kpi .dk-num.c-grand { color: var(--s-indigo); }
.dash-kpi .dk-num.c-green { color: var(--s-green); }

@media (max-width: 640px) {
  .dash-kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .dash-kpi { padding: 10px 10px; }
  .dash-kpi .dk-num { font-size: 16px; }
  .dash-kpi .dk-lbl { font-size: 10.5px; }
}
.stat-card.c-orange { border-left: 4px solid var(--s-orange); }

/* ========== 经营总览（Dashboard） ========== */
.dashboard { padding: 4px 0; }
.d-overview { display: flex; flex-direction: column; gap: 16px; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .d-grid { grid-template-columns: 1fr; } }
.d-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.d-card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.d-svg { width: 100%; height: auto; display: block; }

/* 横向条形（业务线 / 客户 TOP） */
.hb-list { display: flex; flex-direction: column; gap: 12px; }
.hb-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; }
.hb-label { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-sub { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.hb-track { background: #f1f1f3; border-radius: 6px; height: 14px; overflow: hidden; }
.hb-bar { height: 100%; border-radius: 6px; min-width: 2px; transition: width .3s; }
.hb-val { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 设计师产能 */
.designer-cap { display: flex; flex-direction: column; gap: 10px; }
.dc-head { font-size: 13px; color: var(--ink); }
.dc-head b { font-size: 18px; color: var(--accent); }
.dc-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ========== 客户档案（Customers） ========== */
.customers { padding: 4px 0; }
.cust-list { display: flex; flex-direction: column; gap: 14px; }
.cust-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.cust-head { padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: background .15s; }
.cust-head:hover { background: #fafafb; }
.cust-name { font-size: 16px; font-weight: 700; }
.cust-meta { font-size: 12px; color: var(--muted); }
.cust-figs { display: flex; gap: 22px; flex-wrap: wrap; }
.cf { display: flex; flex-direction: column; }
.cf-num { font-size: 16px; font-weight: 800; color: var(--ink); }
.cf-lbl { font-size: 11px; color: var(--muted); }
.cust-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.cust-toggle { font-size: 12px; color: var(--accent); font-weight: 600; }
.cust-detail { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.badge.b-line { color: #1f9aa8; background: #e3f6f8; }

/* ========== 私域运营（Private Domain） ========== */
.private { padding: 4px 0; }
.pr-section { margin-bottom: 26px; }
.pr-sec-title { font-size: 16px; font-weight: 700; margin: 4px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.pr-sec-tip { font-size: 12.5px; color: var(--muted); background: #f7f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.6; }
.attr-select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; background: var(--surface); color: var(--ink); max-width: 100%; }

/* 私域 SOP */
.sop-list { display: flex; flex-direction: column; gap: 14px; }
.sop-step { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.sop-num { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.sop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sop-stage { font-size: 15px; font-weight: 700; color: var(--ink); }
.sop-goal { font-size: 13px; color: #444; line-height: 1.6; }
.sop-ch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.sop-acts { font-size: 12.5px; color: var(--ink); }
.sop-acts-t { color: var(--muted); font-weight: 600; }
.sop-act { line-height: 1.7; color: #444; }
.sop-script { font-size: 13px; color: var(--ink); background: #f7f8fb; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 10px 14px; line-height: 1.7; }
.sop-script-t { color: var(--muted); font-weight: 600; }

/* SOP 实战案例 */
.sop-case { margin-top: 6px; background: linear-gradient(135deg, #fffbf5 0%, #fff7ec 100%); border: 1px solid #f5d9a8; border-radius: 8px; padding: 11px 14px; font-size: 13px; line-height: 1.7; color: #6b5500; }
.sop-case-t { display: inline-block; font-size: 11px; font-weight: 700; color: var(--s-orange); background: var(--s-orange-bg); padding: 2px 8px; border-radius: 4px; margin-bottom: 4px; letter-spacing: .3px; }

/* ====== 系统设置（选项维护） ====== */
.set-head { margin-bottom: 16px; }
.set-head { font-size: 18px; font-weight: 800; color: var(--ink); }
.set-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; max-width: 720px; }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.set-card-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.set-card-tip { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; line-height: 1.6; }
.set-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 30px; }
.set-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef4ff; color: #2b5cc4; border: 1px solid #d4e2ff; border-radius: 999px; padding: 5px 8px 5px 13px; font-size: 13px; font-weight: 600; }
.set-chip-x { border: none; background: transparent; color: #2b5cc4; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; border-radius: 50%; transition: background .15s; }
.set-chip-x:hover { background: rgba(43,92,196,.15); }
.set-empty { font-size: 12.5px; color: var(--muted); font-style: italic; align-self: center; }
.set-add { display: flex; gap: 8px; }
.set-input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; transition: border-color .15s; }
.set-input:focus { border-color: var(--accent); }
.set-add-btn { white-space: nowrap; }

/* 响应式：经营总览 / 客户 / 私域 网格 */
@media (max-width: 860px) {
  .d-grid { grid-template-columns: 1fr; }
  .hb-row { grid-template-columns: 110px 1fr auto; gap: 8px; }
  .sop-step { flex-direction: row; }
}
@media (max-width: 640px) {
  .cust-figs { gap: 14px; }
  .cf-num { font-size: 14px; }
  .sop-num { width: 30px; height: 30px; font-size: 13px; }
}

/* ===== 待办日历 ===== */
.cal { margin-top: 4px; }
.cal-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.cal-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { margin-bottom: 2px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 96px; padding: 6px 7px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color .15s, box-shadow .15s; overflow: hidden; }
.cal-cell:hover { border-color: var(--s-blue); box-shadow: 0 0 0 2px var(--s-blue-bg); }
.cal-cell.empty { background: #fafafb; border-style: dashed; cursor: default; }
.cal-cell.empty:hover { border-color: var(--line); box-shadow: none; }
.cal-cell.today { border-color: var(--s-blue); box-shadow: 0 0 0 2px var(--s-blue-bg); }
.cal-d { font-size: 13px; font-weight: 700; color: var(--ink); }
.cal-today-tag { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: var(--s-blue); border-radius: 4px; padding: 0 5px; width: fit-content; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.cal-chip { border: none; text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .1s, filter .15s; }
.cal-chip:hover { filter: brightness(.95); transform: translateX(1px); }
.cal-chip.b-gray { color: var(--s-gray); background: var(--s-gray-bg); }
.cal-chip.b-orange { color: var(--s-orange); background: var(--s-orange-bg); }
.cal-chip.b-green { color: var(--s-green); background: var(--s-green-bg); }
@media (max-width: 640px) {
  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 70px; padding: 4px; }
  .cal-d { font-size: 11px; }
  .cal-chip { font-size: 10px; padding: 2px 4px; }
  .cal-hint { width: 100%; margin-left: 0; }
}
.cal-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-lg { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 6px; }
.cal-lg.b-gray { color: var(--s-gray); background: var(--s-gray-bg); }
.cal-lg.b-orange { color: var(--s-orange); background: var(--s-orange-bg); }
.cal-lg.b-green { color: var(--s-green); background: var(--s-green-bg); }
.cal-lg-tip { font-style: italic; }

