:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --ink: #15171c;
  --ink-2: #3d4350;
  --muted: #79808f;
  --line: #e5e7ec;
  --line-2: #eef0f4;
  --brand: #16181d;
  --gold: #b7903f;
  --gold-soft: #f3ecdc;
  --red: #d0342c;
  --red-soft: #fdecea;
  --amber: #c77700;
  --amber-soft: #fdf3e2;
  --green: #16785c;
  --green-soft: #e6f4ef;
  --blue: #2b5bd7;
  --blue-soft: #eaf0fe;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .05), 0 8px 24px -12px rgba(20, 22, 28, .14);
  --shadow-lg: 0 24px 60px -20px rgba(20, 22, 28, .38);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--blue); }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, #1b1e24 0%, #131519 100%);
  color: #fff;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark img { height: 100%; width: auto; display: block; }
.brand-text { min-width: 0; }
.brand-title { font-size: 15px; font-weight: 650; letter-spacing: .3px; white-space: nowrap; }
@media (max-width: 620px) {

  .brand-mark { height: 38px; }
  .brand-title { font-size: 13.5px; letter-spacing: 0; }
  .brand-sub { font-size: 10px; }
}
.brand-sub { font-size: 11px; color: #9aa1af; letter-spacing: .6px; white-space: nowrap; }
.topbar-spacer { flex: 1 1 auto; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* 右上角按钮在深色顶栏里；「设置」页打开时高亮 */
.topbar .chip.is-active {
  background: var(--gold); border-color: var(--gold); color: #1a1c22;
}
.topbar .chip.is-active:hover { background: var(--gold); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .09); color: #d6dae2;
  border: 1px solid rgba(255, 255, 255, .13);
  cursor: default; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #e0b355; }
.chip.is-click { cursor: pointer; }
.chip.is-click:hover { background: rgba(255, 255, 255, .16); }

/* ---------------- Tabs ---------------- */
.tabs {
  position: sticky; top: var(--topbar-h, 58px); z-index: 35;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 2px; padding: 0 12px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; cursor: pointer;
  padding: 12px 14px 10px; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.tab .cnt {
  font-size: 10.5px; background: var(--line-2); color: var(--muted);
  border-radius: 999px; padding: 1px 6px; font-weight: 500;
}
.tab.is-active .cnt { background: var(--gold-soft); color: #8a6a1f; }

/* ---------------- Layout ---------------- */
main { max-width: 1220px; margin: 0 auto; padding: 20px 18px 90px; }
.view-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
.view-head .sub { color: var(--muted); font-size: 12.5px; padding-bottom: 2px; }
.view-head .grow { flex: 1 1 auto; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.card > h2 {
  font-size: 13px; margin: 0 0 12px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card > h2 .grow { flex: 1 1 auto; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; max-width: 100%; }
.card { min-width: 0; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.align-start { align-items: start; }
@media (max-width: 1240px) {
  .grid.g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid.g3, .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid.g2, .grid.g3, .grid.g4, .grid.g5 { grid-template-columns: 1fr; }
  main { padding: 14px 12px 96px; }
  .topbar { padding: 10px 12px; }
  /* 手机上表格太挤：把「商品编码 / 操作」两列藏起来，留 分类 / 名称 / 成本价 / 质保 */
  .hide-sm { display: none !important; }
  /* 精品加装只有 4 列，手机上直接铺满，不用横向拖 */
  table.data.data-acc { min-width: 0; table-layout: fixed; }
  table.data.data-acc th, table.data.data-acc td { padding: 8px 6px; }
  table.data.data-acc th:nth-child(1) { width: 66px; }
  table.data.data-acc th:nth-child(4) { width: 76px; }
  table.data.data-acc th:nth-child(5) { width: 58px; }
  table.data.data-acc td { word-break: break-word; white-space: normal; }
  table.data.data-acc td.num { white-space: nowrap; }
  /* 分类卡片在手机上两列排，别一张占一整屏 */
  .acc-cats.grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .acc-cats .kpi { padding: 11px 12px; }
  .acc-cats .kpi-value { font-size: 21px; }
}

/* ---------------- KPI ---------------- */
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gold); opacity: .85;
}
.kpi.k-red::after { background: var(--red); }
.kpi.k-green::after { background: var(--green); }
.kpi.k-blue::after { background: var(--blue); }
.kpi.k-amber::after { background: var(--amber); }
.kpi-label { font-size: 11.5px; color: var(--muted); letter-spacing: .3px; }
.kpi-value { font-size: 24px; font-weight: 680; margin: 3px 0 1px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--muted); }
/* 精品加装 · 分类卡片：点一下按该分类筛选，再点一次取消 */
.acc-cat { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; -webkit-tap-highlight-color: transparent; }
.acc-cat:hover { border-color: var(--gold); transform: translateY(-1px); }
.acc-cat.is-on { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 2px rgba(183, 144, 63, .18), var(--shadow); }
.acc-cat.is-on .kpi-label { color: var(--gold); font-weight: 700; }
.acc-cat.is-on::after { opacity: 1; width: 4px; }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--panel); position: sticky; top: 0;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.num { text-align: right; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); }
/* 最近跟进内容：限宽 + 最多两行，避免长文本把表撑开 */
.cell-note { max-width: 300px; white-space: normal; font-size: 12px; line-height: 1.5; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--line-2); color: var(--ink-2); font-weight: 600;
  white-space: nowrap;
}
.badge--H { background: #fdecec; color: #b3261e; }
.badge--A { background: var(--amber-soft); color: #9a5c00; }
.badge--B { background: var(--blue-soft); color: #23479f; }
.badge--C { background: #eef0f4; color: #5c6472; }
.badge--O { background: var(--green-soft); color: var(--green); }
.badge--none { background: #f1f2f5; color: #9aa1af; font-weight: 500; }
.badge--overdue { background: var(--red-soft); color: var(--red); }
.badge--today { background: var(--amber-soft); color: var(--amber); }
.badge--ok { background: var(--green-soft); color: var(--green); }
.badge--lost { background: #eceef2; color: #5c6472; }
.badge--gold { background: var(--gold-soft); color: #8a6a1f; }

/* ---------------- Buttons ---------------- */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; transition: .15s; white-space: nowrap; font-weight: 500;
}
.btn:hover { border-color: #cfd3db; background: var(--panel-2); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: #2a2d35; border-color: #2a2d35; }
.btn--gold { background: linear-gradient(140deg, #c8a450, #a07c2c); border-color: transparent; color: #fff; }
.btn--gold:hover { filter: brightness(1.06); }
.btn--danger { color: var(--red); border-color: #f0d5d3; background: #fff; }
.btn--danger:hover { background: var(--red-soft); }
.btn--sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; outline: none; transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(183, 144, 63, .13); }
.textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters .select { width: auto; min-width: 116px; }
.filters .input.search { min-width: 190px; flex: 1 1 190px; }

/* ---------------- 待办（概览 · 今天/明天/后天） ---------------- */
.todo-card { display: flex; flex-direction: column; }
.todo-card.is-today { position: relative; }
.todo-card.is-today::before {
  content: ''; position: absolute; left: 16px; right: 16px; top: 0; height: 3px;
  background: var(--gold); border-radius: 0 0 3px 3px;
}
.todo-md { color: var(--muted); font-weight: 500; }
.todo-count { font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.todo-card.is-today .todo-count { color: var(--gold); }
.todo-card.is-important { position: relative; }
.todo-card.is-important::before {
  content: ''; position: absolute; left: 16px; right: 16px; top: 0; height: 3px;
  background: var(--amber); border-radius: 0 0 3px 3px;
}
.todo-card.is-important .todo-count { color: var(--amber); }
.todo-list { flex: 1 1 auto; margin-bottom: 10px; }
.todo-item {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 7px 0; border-bottom: 1px solid var(--line-2);
}
.todo-item:last-child { border-bottom: 0; }
.todo-tick {
  flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px;
  border: 1.5px solid #d5d9e2; border-radius: 5px; background: var(--panel-2);
  font-size: 10.5px; line-height: 14px; text-align: center; color: #fff; font-weight: 700;
}
.todo-item:hover .todo-tick { border-color: var(--gold); }
.todo-item.is-done .todo-tick { background: var(--green); border-color: var(--green); }
.todo-text { flex: 1 1 auto; font-size: 13.5px; line-height: 1.45; color: var(--ink); word-break: break-word; }
.todo-item.is-done .todo-text { color: var(--muted); text-decoration: line-through; }
.todo-late {
  flex: 0 0 auto; margin-top: 1px; font-size: 10.5px; line-height: 1.4;
  color: var(--amber); background: var(--amber-soft); border-radius: 999px; padding: 1px 6px;
}
.todo-del {
  flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 15px; line-height: 1; padding: 0 2px;
  color: var(--muted); opacity: .38;
}
.todo-del:hover { opacity: 1; color: var(--red); }
.todo-empty { font-size: 12.5px; color: var(--muted); padding: 8px 0 10px; }
.todo-add { display: flex; gap: 6px; align-items: stretch; margin-top: auto; }
.todo-add .input { flex: 1 1 auto; font-size: 13px; }
.todo-plus {
  flex: 0 0 auto; width: 36px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink-2);
  font-size: 18px; line-height: 1; cursor: pointer; font-family: inherit;
}
.todo-plus:hover { border-color: var(--gold); color: var(--gold); }
.todo-clear {
  margin-top: 8px; padding: 0; border: 0; background: transparent; text-align: left;
  font-family: inherit; font-size: 11.5px; color: var(--muted); cursor: pointer;
}
.todo-clear:hover { color: var(--gold); }
/* 待办看板下方：后天之后的预约折叠区 */
.todo-more > summary {
  cursor: pointer; list-style: none; font-size: 12.5px; color: var(--muted);
  padding: 9px 2px; border-top: 1px dashed var(--line);
}
.todo-more > summary::-webkit-details-marker { display: none; }
.todo-more > summary::before { content: '▸ '; }
.todo-more[open] > summary::before { content: '▾ '; }
.todo-more > summary:hover { color: var(--gold); }
.todo-more .todo-list { padding: 2px 14px; }
.todo-more[open] > .todo-list {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px 14px;
}
.todo-when {
  flex: 0 0 auto; margin-top: 1px; font-size: 10.5px; line-height: 1.4;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 6px;
}
/* 车主生日 / 提车纪念日（自动生成，不能勾选、不能删） */
.todo-item.is-ann { cursor: default; background: var(--gold-soft); border-radius: 8px; padding: 7px 8px; margin: 2px 0; border-bottom: 0; }
.todo-item.is-ann:hover .todo-ann-dot { transform: scale(1.15); }
.todo-ann-dot {
  flex: 0 0 auto; width: 9px; height: 9px; margin: 5px 4px 0 4px;
  border-radius: 50%; background: var(--gold); transition: transform .15s;
}
.todo-item.is-ann .todo-text { font-weight: 600; color: var(--ink-2); }
.todo-ann-tag {
  flex: 0 0 auto; margin-top: 1px; font-size: 10px; line-height: 1.5;
  color: var(--gold); background: #fff; border: 1px solid rgba(183, 144, 63, .35);
  border-radius: 999px; padding: 0 6px;
}
@media (max-width: 620px) {
  .todo-card { padding: 13px; }
  .todo-card.is-today::before { left: 13px; right: 13px; }
  .todo-card.is-important::before { left: 13px; right: 13px; }
}

/* 多选筛选（车型 / 渠道 / 级别）：长得像下拉，展开后每项前一个小方块 */
.ms-wrap { position: relative; display: inline-block; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; padding: 8px 11px; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink-2);
  min-width: 116px; justify-content: space-between;
}
.filter-btn:hover { border-color: var(--gold); color: var(--ink); }
.filter-btn.is-on { background: var(--gold-soft); border-color: var(--gold); color: #8a6a1f; font-weight: 600; }
.ms-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-caret { font-size: 10px; color: var(--muted); }
.ms-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  min-width: 100%; width: max-content; max-width: 260px; max-height: 280px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 4px; text-align: left;
}
.ms-head {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px 7px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.ms-clear {
  margin-left: auto; border: 0; background: transparent; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 11.5px; color: var(--gold);
}
.ms-clear:hover { text-decoration: underline; }
.ms-opt {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: transparent; padding: 7px 9px; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink); text-align: left;
  border-radius: 6px; white-space: nowrap;
}
.ms-opt:hover { background: var(--panel-2); }
.ms-opt.is-on { font-weight: 600; }
.ms-box {
  flex: 0 0 auto; width: 15px; height: 15px; border: 1.5px solid #c9ced8; border-radius: 4px;
  background: #fff; font-size: 10.5px; line-height: 12px; text-align: center; color: #fff; font-weight: 700;
}
.ms-opt.is-on .ms-box { background: var(--gold); border-color: var(--gold); }
/* 抽屉里的「意向车型」：按钮占满整行，面板在行内展开（抽屉有 overflow，浮层会被裁掉） */
.ms-wrap--block { display: block; }
.ms-wrap--block .filter-btn { width: 100%; min-width: 0; }
.ms-panel--inline {
  position: static; width: 100%; max-width: none;
  margin-top: 5px; max-height: 232px;
}
@media (max-width: 620px) {
  .ms-wrap { flex: 1 1 46%; }
  .filter-btn { width: 100%; min-width: 0; }
  .ms-panel { max-width: min(300px, calc(100vw - 32px)); }
  .ms-wrap--block { flex: none; width: 100%; }
  .ms-panel--inline { max-width: none; }
}

/* 「订单状态」分段按钮 */
.seg {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); overflow: hidden;
}
.seg-label { padding: 0 9px 0 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.seg-btn {
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  padding: 7px 11px; font-size: 12.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line-2); }
.seg-btn:hover { background: var(--panel-2); }
.seg-btn.is-on { background: var(--ink); color: #fff; }
.seg-btn.is-on .seg-n { background: rgba(255, 255, 255, .22); color: #fff; }
.seg-n {
  font-size: 10.5px; line-height: 1; padding: 3px 5px; border-radius: 999px;
  background: var(--line-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
@media (max-width: 620px) {
  .seg { width: 100%; justify-content: space-between; }
  .seg-btn { flex: 1 1 auto; justify-content: center; padding: 7px 8px; }
}

/* ---------------- Charts ---------------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 128px 1fr 62px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { background: var(--line-2); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #c9a45c, #a37f2c); transition: width .5s ease; }
.bar-fill.b-red { background: linear-gradient(90deg, #e0706a, #c0392b); }
.bar-fill.b-blue { background: linear-gradient(90deg, #6f8fe8, #2b5bd7); }
.bar-fill.b-green { background: linear-gradient(90deg, #4fae8f, #16785c); }
.bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.cols { display: flex; align-items: flex-end; gap: 10px; height: 166px; padding-top: 6px; }
.col { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.col-bar { width: 100%; max-width: 46px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #d3b06a, #a37f2c); }
.col-x { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.col-v { font-size: 11px; color: var(--ink-2); font-weight: 600; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--gold);
}
.tl-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 13px; margin-top: 1px; white-space: pre-wrap; word-break: break-word; }

/* ---------------- Drawer ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 18, 22, .42);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--panel); z-index: 61; box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 10px;
}
.drawer-head h2 { margin: 0; font-size: 16.5px; }
.drawer-body { overflow-y: auto; padding: 16px 18px 40px; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--muted); padding: 2px 6px; border-radius: 7px;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

.section-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; }

/* ---------------- Modal ---------------- */
.modal {
  position: fixed; z-index: 62; left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.98);
  width: min(600px, calc(100% - 28px)); max-height: 88vh; overflow: auto;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .2s;
}
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-head { padding: 16px 18px 0; display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 16px; flex: 1 1 auto; }
.modal-body { padding: 14px 18px 18px; }
.modal-foot { padding: 0 18px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* 有新版本提示条（浏览器缓存了旧 index.html 时用） */
.ver-bar {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px 9px 16px; border-radius: 999px;
  background: var(--brand); color: #fff; box-shadow: var(--shadow-lg);
  font-size: 13px; white-space: nowrap;
}
.ver-bar .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.ver-bar .btn--gold { color: #fff; }
@media (max-width: 420px) {
  .ver-bar { left: 10px; right: 10px; transform: none; justify-content: space-between; }
}

/* ---------------- 内联添加行 ---------------- */
.check-add { display: flex; gap: 8px; margin-top: 8px; }
.check-add .input { flex: 1 1 auto; }

/* ---------------- 系统参数：底部保存条 ---------------- */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(24, 26, 32, .97), rgba(16, 18, 22, .99));
  color: #fff; box-shadow: 0 -8px 24px -10px rgba(0, 0, 0, .5);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.savebar-tip { font-size: 12.5px; color: #9aa1af; }
.savebar-tip.is-dirty { color: #e8c473; font-weight: 600; }
.savebar .btn { background: transparent; border-color: rgba(255, 255, 255, .26); color: #fff; }
.savebar .btn:hover { background: rgba(255, 255, 255, .12); }
.savebar .btn--primary { background: linear-gradient(140deg, #c8a450, #a07c2c); border-color: transparent; color: #fff; }
.savebar .btn--primary:hover { filter: brightness(1.06); }

/* ---------------- 云服务：登录门 ---------------- */
.gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 20px; overflow: auto;
  /* 登录门背景：曼哈顿天际线 + 一层上暗下更暗的渐变，
     目的是让中间那张白卡片的字始终读得清（天空很亮，不压暗会糊） */
  background-color: #0a0e15;
  background-image:
    linear-gradient(180deg, rgba(7, 10, 16, .62) 0%, rgba(7, 10, 16, .44) 42%, rgba(7, 10, 16, .76) 100%),
    url("assets/login-bg.jpg");
  background-size: cover, cover;
  background-position: center, center 58%;
  background-repeat: no-repeat, no-repeat;
}
.gate[hidden] { display: none; }
body.is-gated { overflow: hidden; }
body.is-gated .topbar, body.is-gated .tabs, body.is-gated main { display: none; }
/* 登录卡片 = 毛玻璃：
   底色是「深色半透明」而不是白色 —— 参考图的浅色玻璃在亮天空上白字会糊；
   叠一层白色薄雾渐变作出磨砂质感，再用 backdrop-filter 把身后的照片模糊掉。
   描边 + 内高光是玻璃的"厚度"，外阴影负责"浮起来"。 */
.gate-card {
  width: 100%; max-width: 430px; padding: 26px 24px;
  color: #f6f4ee;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .26);
  background-color: rgba(10, 12, 18, .36);
  background-image:
    radial-gradient(120% 80% at 12% 0%, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(160deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .04) 48%, rgba(255, 255, 255, .11) 100%);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, .46),
    0 2px 10px rgba(0, 0, 0, .22),
    inset 0 1px 0 rgba(255, 255, 255, .30),
    inset 0 -1px 0 rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(26px) saturate(165%) brightness(1.14);
  backdrop-filter: blur(26px) saturate(165%) brightness(1.14);
}
/* 老内核不支持 backdrop-filter：给一个更实的深色底，别假装是玻璃 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .gate-card {
    background-color: rgba(16, 18, 26, .92);
    background-image: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  }
}
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.gate-brand .brand-mark { height: 38px; display: flex; align-items: center; }
.gate-brand .brand-mark img { height: 100%; width: auto; display: block; }
.gate-card h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: .2px; }
.gate-err { color: var(--red); font-size: 12.5px; margin-top: 8px; }
.confirm-msg { white-space: pre-line; line-height: 1.6; }
.gate-code { display: flex; gap: 8px; }
.gate-code .input { flex: 1 1 auto; min-width: 0; }
.gate-code .btn { flex: none; white-space: nowrap; }
.gate-sep { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; }

/* ---------------- 毛玻璃卡片内部：所有控件改成"通透"版 ---------------- */
.gate-card .brand-title { color: #fff; }
.gate-card .brand-sub { color: rgba(255, 255, 255, .55); }
.gate-card h3 { font-size: 18px; margin: 0 0 10px; color: #fff; }
.gate-card .hint { color: rgba(255, 255, 255, .68); line-height: 1.6; }
.gate-card .gate-err { color: #ff9d93; }
.gate-card .gate-sep { color: rgba(255, 255, 255, .50); }

.gate-card .field label { color: rgba(255, 255, 255, .74); }
.gate-card .input {
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .20);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  caret-color: #e2c178;
}
.gate-card .input::placeholder { color: rgba(255, 255, 255, .54); }
.gate-card .input:hover { border-color: rgba(255, 255, 255, .32); }
.gate-card .input:focus {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(226, 193, 120, .90);
  box-shadow: 0 0 0 3px rgba(226, 193, 120, .22);
}
/* Chrome 自动填充会刷成黄底黑字，在深色玻璃上非常刺眼，这里压回去 */
.gate-card .input:-webkit-autofill,
.gate-card .input:-webkit-autofill:hover,
.gate-card .input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(26, 29, 38, .96) inset;
  caret-color: #fff;
}

.gate-card .btn {
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #f4f1ea;
  border-radius: 10px;
  padding: 9px 14px;
}
.gate-card .btn:hover {
  background: rgba(255, 255, 255, .17);
  border-color: rgba(255, 255, 255, .34);
}
/* 主按钮用实心金 + 深色字：比"白字压金"对比度高一档，也更像参考图里那颗实心按钮 */
.gate-card .btn--primary,
.gate-card .btn--gold {
  background: linear-gradient(180deg, #d5b273, #b7903f);
  border-color: rgba(255, 255, 255, .16);
  color: #24190a;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .30), inset 0 1px 0 rgba(255, 255, 255, .40);
}
.gate-card .btn--primary:hover,
.gate-card .btn--gold:hover {
  background: linear-gradient(180deg, #dfbd7f, #c19a48);
  border-color: rgba(255, 255, 255, .22);
  filter: none;
}
.gate-card .btn:disabled { opacity: .55; }
.gate-card .btn:focus-visible,
.gate-card .input:focus-visible {
  outline: 2px solid rgba(226, 193, 120, .75);
  outline-offset: 2px;
}

/* 待审核 / 被拒 页里的信息框（复用 .rule-box，在深色玻璃上要重配一遍） */
.gate-card .rule-box {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .88);
  border-radius: 12px;
  line-height: 1.7;
}
.gate-card .rule-box--danger {
  background: rgba(214, 80, 68, .20);
  border-color: rgba(255, 141, 129, .48);
  color: #ffdcd7;
}
/* 登录时「保留哪一份数据」的对比 */
.gsync { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.gsync-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; }
.gsync-row + .gsync-row { border-top: 1px solid var(--line-2); background: var(--panel-2); }
.gsync-tag {
  flex: 0 0 auto; font-size: 11px; line-height: 1.5; padding: 2px 8px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.gsync-tag.is-local { background: var(--gold-soft); color: #8a6a1f; }
.gsync-tag.is-cloud { background: var(--blue-soft); color: var(--blue); }
.gsync-body { flex: 1 1 auto; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.gsync-body b { color: var(--ink); }
.gsync-at { display: block; font-size: 11px; color: var(--muted); }
.btn--block { width: 100%; justify-content: center; }
.chip.is-ok .dot { background: #4fae8f; }
.chip.is-busy .dot { background: #e0a83c; }
.chip.is-warn .dot { background: #e0706a; }

/* 客户大定：全屏烟花叠层（不拦截点击） */
.fx-fireworks {
  position: fixed; inset: 0; z-index: 300;
  pointer-events: none;
  width: 100%; height: 100%;
}

/* 客户大定：烟花尾声的大字寄语 */
.fx-motto {
  position: fixed; inset: 0; z-index: 301;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  align-content: center;
  gap: 0 .1em;
  padding: 0 18px; text-align: center;
  pointer-events: none;
  max-width: 100%;
  font-size: clamp(26px, 7.8vw, 78px);
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--gold);
  opacity: 0;
  transform: scale(.94);
  transition: opacity .45s ease, transform .9s cubic-bezier(.22, .61, .36, 1);
  text-shadow: 0 0 18px rgba(255, 255, 255, .95), 0 0 46px rgba(255, 255, 255, .9),
    0 4px 26px rgba(183, 144, 63, .45);
}
.fx-motto > span { white-space: nowrap; }
.fx-motto.is-on { opacity: 1; transform: scale(1); }
.fx-motto.is-out {
  opacity: 0; transform: scale(1.05);
  transition: opacity 1.2s ease, transform 1.6s ease;
}

/* 全局快速记一笔（悬浮按钮） */
.fab {
  /* 比原来抬高 2cm；并避开 iPhone 底部安全区 */
  position: fixed; right: 18px; z-index: 55;
  bottom: calc(18px + 2cm + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px; border-radius: 50%;
  border: 0; cursor: pointer; color: #fff;
  background: var(--gold);
  box-shadow: 0 12px 28px -10px rgba(183, 144, 63, .85), 0 2px 6px rgba(20, 22, 28, .16);
  font-size: 27px; line-height: 1; font-family: var(--font-sans, inherit);
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 2px;
  transition: transform .15s ease, background .15s ease;
}
.fab:hover { background: #a37f2c; transform: translateY(-2px); }
.fab:active { transform: scale(.95); }
.overlay.is-open ~ .fab, body.is-gated .fab { display: none; }

/* 「快速记一笔」里的客户选择列表 */
.pick-list {
  margin-top: 8px; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.pick-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--panel); }
.pick-item.is-on { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.pick-name { font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.pick-tag {
  font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 999px;
  background: var(--line-2); color: var(--muted);
}
.pick-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pick-empty { padding: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }
@media (max-width: 620px) {
  .fab { right: 14px; bottom: calc(14px + 2cm + env(safe-area-inset-bottom, 0px)); width: 50px; height: 50px; font-size: 25px; }
}

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1d2026; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px);
  transition: .22s; max-width: 88vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: none; }
.toast.is-err { background: #8f2119; }

/* ---------------- Misc ---------------- */
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: .5; }
.split { display: flex; gap: 14px; flex-wrap: wrap; }
.split > * { flex: 1 1 260px; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; }
.strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.rule-box { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 12.5px; white-space: pre-wrap; color: var(--ink-2); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.summary-table th, .summary-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); }
.summary-table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.summary-table td.num, .summary-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-table tr.is-total td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; background: var(--panel-2); }

.quote-sheet { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: linear-gradient(180deg, #fff, #fcfbf8); }
.quote-sheet h3 { margin: 0 0 2px; font-size: 15.5px; }
.quote-sheet .qs-sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

@media print {
  .topbar, .tabs, .no-print, .drawer-foot { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; }
}

/* 用户管理（审核队列 + 账号列表） */
.adm-list { display: flex; flex-direction: column; }
.adm-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line-2);
}
.adm-row:first-child { border-top: 0; }
.adm-row.is-on { background: var(--gold-soft); border-radius: 10px; padding: 12px 10px; }
.adm-row--pending { align-items: center; }
.adm-pick { flex: 0 0 auto; display: flex; align-items: center; }
.adm-pick input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.adm-main { flex: 1 1 auto; min-width: 0; }
.adm-name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 700; font-size: 14px; color: var(--ink);
}
.adm-name .muted { font-weight: 400; }
.adm-note { font-size: 13px; color: var(--ink-2); margin-top: 3px; word-break: break-word; }
.adm-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; word-break: break-word; }
.adm-acts { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }
.adm-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px;
  background: var(--gold-soft); font-size: 12.5px; color: #8a6a1f;
}
.adm-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.adm-chip {
  font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  cursor: pointer; text-align: left;
}
.adm-chip b { font-weight: 600; margin-left: 2px; color: var(--muted); }
.adm-chip:hover { border-color: var(--gold); }
.adm-chip.is-on { background: var(--gold-soft); border-color: var(--gold); color: #8a6a1f; }

@media (max-width: 620px) {
  /* 手机上让按钮靠右跟内容同一行；名字太长会自动换行，不会把按钮挤没 */
  .adm-row { flex-wrap: wrap; }
  .adm-acts { margin-left: auto; }
}

/* 手机竖屏：换成专门裁的竖版（天空砍掉一半、楼群更完整），
   横图在竖屏上 crop 太狠，只剩一条天空。放在文件最后，确保覆盖上面那条大图规则 */
@media (max-width: 620px) {
  .gate {
    background-image:
      linear-gradient(180deg, rgba(7, 10, 16, .46) 0%, rgba(7, 10, 16, .26) 38%, rgba(7, 10, 16, .74) 100%),
      url("assets/login-bg-portrait.jpg");
    background-position: center, 50% 50%;
    /* 卡片往上提一点，把下面那片城市天际线露出来（竖屏上卡片几乎占满宽度，
       落在正中会把楼群全挡住） */
    align-items: start;
    padding: 9vh 16px 16px;
  }
}

/* 手机：玻璃模糊半径降一档（省电），圆角与内边距跟着收 */
@media (max-width: 620px) {
  .gate-card {
    max-width: 100%;
    border-radius: 18px;
    padding: 20px 18px;
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    backdrop-filter: blur(16px) saturate(130%);
  }
  .gate-card h3 { font-size: 17px; }
}

/* 系统开启「降低透明度」时不做玻璃效果，直接给实底（可读性优先） */
@media (prefers-reduced-transparency: reduce) {
  .gate-card {
    background-color: rgba(14, 16, 23, .95);
    background-image: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* 登录门底部的 ICP 备案号（工信部要求可见） */
.gate-foot {
  margin-top: 18px; padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  text-align: center; font-size: 11.5px; letter-spacing: .02em;
  color: rgba(255, 255, 255, .62);
}
.gate-foot a { color: inherit; text-decoration: none; }
.gate-foot a:hover { color: rgba(255, 255, 255, .8); }
