/* 渠道CRM · 样式 */

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e6eaf2;
  --text: #1c2434;
  --dim: #7b879b;
  --brand: #2f6feb;
  --brand-d: #1f57c9;
  --side: #16202f;
  --side-hover: #22304a;
  --warn: #e0533d;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 47, .04), 0 8px 24px rgba(22, 32, 47, .05);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------- 布局 */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 214px;
  flex: 0 0 214px;
  background: var(--side);
  color: #c9d4e5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3d7bfa, #1f57c9);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 15px;
}

.brand-text { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: .5px; }
.brand-text em { font-style: normal; color: #6f8dc0; font-size: 13px; margin-left: 2px; }

.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #a9b8cf;
  transition: background .15s, color .15s;
}

.nav-item svg { width: 17px; height: 17px; fill: currentColor; opacity: .9; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12.5px;
}

.who { color: #dbe4f2; margin-bottom: 6px; }
.foot-acts { display: flex; align-items: center; gap: 14px; }
.foot-link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: #7f90ab;
  cursor: pointer;
}
.foot-link:hover { color: #fff; }
.logout { color: #7f90ab; }
.logout:hover { color: #fff; }
.sidebar-foot .ver { display: block; margin-top: 7px; font-size: 10.5px; color: #4d5d77; letter-spacing: .5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  flex: 0 0 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-title { font-size: 16px; font-weight: 600; margin: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.content { padding: 22px 26px 46px; width: 100%; }

.icon-btn {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--dim);
}
.icon-btn:hover { background: #eef2f9; color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.only-mobile { display: none; }
.muted { color: var(--dim); font-size: 12.5px; }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- 卡片 / 图表 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  border-left: 3px solid #dbe3f0;
}
.stat-card:nth-child(2) { border-left-color: #22c55e; }
.stat-card:nth-child(3) { border-left-color: #f59e0b; }
.stat-card:nth-child(4) { border-left-color: #2f6feb; }

.stat-label { color: var(--dim); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.5px; margin: 4px 0 2px; }
.stat-value.money { font-size: 23px; }
.stat-sub { font-size: 12px; color: #96a1b3; }
.stat-sub b { color: #4a5a72; }

.chart-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.chart-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.chart-head .muted { margin-left: auto; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.chart-card { min-height: 240px; }
.chart-body { height: 240px; display: flex; align-items: center; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: #edf1f7; stroke-width: 1; }
.axis-text { fill: #9aa5b6; font-size: 10.5px; }
.line-path { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }

.chart-empty {
  width: 100%; text-align: center; color: #a7b1c1; font-size: 13px; padding: 60px 0;
}

/* 环形图 */
.donut-body { gap: 18px; }
.donut {
  width: 148px; height: 148px;
  border-radius: 50%;
  flex: 0 0 148px;
  display: grid; place-items: center;
  position: relative;
}
.donut-hole {
  width: 96px; height: 96px;
  background: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  align-content: center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .02);
}
.donut-hole b { font-size: 21px; line-height: 1.1; }
.donut-hole span { font-size: 11px; color: var(--dim); }

.legend { list-style: none; margin: 0; padding: 0; flex: 1; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.lg-name { flex: 1; }
.lg-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.lg-pct { color: var(--dim); width: 40px; text-align: right; font-size: 12px; }

/* 排行条 */
.rank { width: 100%; display: flex; flex-direction: column; gap: 9px; align-self: stretch; padding: 2px 0; }
.rank-row { display: grid; grid-template-columns: 116px 1fr auto; align-items: center; gap: 10px; }
.rank-name {
  font-size: 12.5px; color: #4a5a72;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-bar { height: 8px; background: #f0f3f9; border-radius: 6px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 6px; }
.rank-val {
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 62px; text-align: right;
}
.rank-val em { font-style: normal; color: var(--dim); font-weight: 400; margin-left: 6px; font-size: 11.5px; }

/* ---------------------------------------------------------- 待办列表 */

.todo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.list-card { padding: 16px 18px; }
.mini-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.mini-list li { border-bottom: 1px dashed #eef1f6; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { display: block; padding: 9px 2px; }
.mini-list a:hover { background: #f8fafd; }
.mi-name { display: block; font-size: 13px; font-weight: 500; }
.mi-sub { display: block; font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.empty-line { padding: 18px 2px; color: #a7b1c1; font-size: 12.5px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  background: #eef2f9;
  color: #5b6a80;
  font-size: 11.5px;
  border: 0;
}
.pill-ok { background: #e7f7ee; color: var(--ok); }
.pill-warn { background: #fdeeea; color: var(--warn); }

/* ---------------------------------------------------------- 工具栏 / 表格 */

.range-tabs { display: flex; gap: 4px; background: #eaeff7; padding: 3px; border-radius: 9px; }
.range-tab { padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: #5b6a80; }
.range-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .07); font-weight: 500; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: #9aa5b6;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 235, .1); }

.select {
  height: 38px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239aa5b6' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 6px center / 18px;
  appearance: none;
  outline: none;
}
.select:focus { border-color: var(--brand); }

.count-chip { font-size: 12.5px; color: var(--dim); margin-left: auto; }

.table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table-tip { margin: 9px 2px 0; font-size: 11.5px; color: #a7b1c1; }

/* 分页条 */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 2px 0;
}
.pager-pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #4a5a72;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .12s;
}
.pg:hover:not([disabled]):not(.on) { border-color: #c4d8ff; color: var(--brand); background: #f5f9ff; }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg[disabled] { opacity: .4; cursor: not-allowed; }
.pg-gap { color: #a7b1c1; padding: 0 1px; font-size: 12.5px; }
.pager-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.pager-info { font-size: 12.5px; color: var(--dim); }
.pager-size { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--dim); }
.pager-size .select { height: 30px; padding: 0 26px 0 8px; font-size: 12.5px; border-radius: 8px; }
.grid th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  padding: 12px;
  background: #fafbfe;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid th:nth-child(1) { width: 28px; }
.grid th:nth-child(2) { width: 224px; }
.grid th:nth-child(3) { width: 82px; }
.grid th:nth-child(4) { width: 50px; }
.grid th:nth-child(5) { width: 92px; }
.grid th:nth-child(6) { width: 112px; }
.grid th:nth-child(7) { width: 84px; }
.grid th:nth-child(8) { width: 150px; }
.grid th:nth-child(9) { width: 116px; }
.grid th:nth-child(10) { width: 46px; }
.grid th:nth-child(11) { width: 80px; }
.grid td { overflow: hidden; }

/* 窄一点的屏幕先把关键词、再先把产品收起来，保证公司列不被挤没 */
@media (min-width: 701px) and (max-width: 1420px) {
  .grid th.col-keyword, .grid td.col-keyword { display: none; }
}
@media (min-width: 701px) and (max-width: 1200px) {
  .grid th.col-product, .grid td.col-product { display: none; }
}
.grid td.mono, .grid td.due, .grid td.cell-dim {
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cell-main, .cell-sub, .cell-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td { padding: 11px 12px; border-bottom: 1px solid #f2f5fa; vertical-align: top; }
.grid tbody tr { cursor: pointer; transition: background .12s; }
.grid tbody tr:hover { background: #f7f9fd; }
.grid tbody tr:last-child td { border-bottom: 0; }

.cell-main { font-weight: 550; font-size: 13.5px; }
.star {
  border: 0;
  background: transparent;
  padding: 0 6px 0 0;
  font-size: 20px;
  line-height: 1;
  color: #d3dae5;
  cursor: pointer;
  vertical-align: -3px;
  transition: color .12s, transform .12s;
}
.star:hover { color: #ff5a4d; transform: scale(1.12); }
.star.on {
  color: #e8352b;
  text-shadow: 0 0 8px rgba(232, 53, 43, .35);
}
.cell-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.cell-note { font-size: 11.5px; color: #9aa5b6; margin-top: 2px; }
.i-sub { font-size: 11px; color: #9aa5b6; margin-top: 2px; }
.cell-dim { color: #61708a; font-size: 12.5px; }
.due { color: var(--warn); font-weight: 600; }

.grid tbody tr.selected { background: #f1f7ff; }
.grid tbody tr.selected:hover { background: #e9f1ff; }

.col-check { width: 30px; text-align: center; }
.col-check input, .row-check {
  width: 15px; height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
  margin: 0;
}
.col-ops { width: 96px; white-space: nowrap; }
.cell-type { white-space: nowrap; }

.op-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12.5px;
  padding: 2px 4px;
  border-radius: 5px;
}
.op-btn:hover { background: #eaf1ff; }
.op-btn + .op-btn { margin-left: 2px; }
.op-btn.danger { color: var(--warn); }
.op-btn.danger:hover { background: #fdeeea; }

.pri {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  font-style: normal;
  font-size: 11px;
  line-height: 17px;
  vertical-align: middle;
  background: #f1f4f9;
  color: #7b879b;
}

.cell-time {
  font-size: 11.5px;
  line-height: 1.55;
  color: #61708a;
  font-variant-numeric: tabular-nums;
}
.cell-time .tline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-time em { font-style: normal; color: #9aa5b6; margin-right: 5px; }
.cell-time .due { color: var(--warn); font-weight: 600; }
.pri-A { background: #fef4e2; color: #b4720a; }
.pri-B { background: #e8f0ff; color: #2f6feb; }
.pri-C { background: #f2f5fa; color: #8b97a9; }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #eef5ff;
  border: 1px solid #cfe1ff;
  border-radius: 12px;
  padding: 9px 14px;
  margin-bottom: 12px;
}
.bulk-text { font-size: 13px; color: #3c4a60; }
.bulk-text b { color: var(--brand); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  background: #eef2f9;
  color: #5b6a80;
  white-space: nowrap;
}
.t-interest { background: #eef1f6; color: #6b7a91; }
.t-intent { background: #e8f0ff; color: #2f6feb; }
.t-coop { background: #e7f7ee; color: #15903f; }
.t-core { background: #fef4e2; color: #b4720a; }
.t-ghost { background: #f2f5fa; color: #7b879b; }

.empty { padding: 48px 0; text-align: center; color: #a7b1c1; font-size: 13px; }

/* ---------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #eef2f9;
  color: var(--text);
  font-size: 13.5px;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: #e5ebf5; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-outline { background: #fff; border-color: var(--line); }
.btn-outline:hover { border-color: #cbd6e6; background: #fafcff; }
.btn-ghost { background: transparent; }
.btn-ghost.danger { color: var(--warn); }
.btn-ghost.danger:hover { background: #fdeeea; }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }
.form > .btn:not(.btn-block) { align-self: flex-start; }
.btn-ico { width: 16px; height: 16px; fill: currentColor; }

/* ---------------------------------------------------------- 抽屉 */

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 520px;
  max-width: 100vw;
  background: #fff;
  box-shadow: -18px 0 40px rgba(22, 32, 47, .14);
  transform: translateX(102%);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #f0f3f8;
}
.drawer-title-wrap { min-width: 0; flex: 1; }
.drawer-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.drawer-sub { margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; padding: 8px 16px 0; border-bottom: 1px solid #f0f3f8; }
.tabs button {
  border: 0; background: transparent;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 26px; }
.drawer-foot { padding: 10px 20px 16px; border-top: 1px solid #f0f3f8; }

/* ---------------------------------------------------------- 居中弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 26, 38, .4);
  backdrop-filter: blur(2px);
}
.modal.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 800px;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in .18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 19px 22px 14px;
  border-bottom: 1px solid #f0f3f8;
}
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 16px; font-weight: 600; margin: 0 0 3px; }
.modal-head .muted { font-size: 12.5px; }

.modal-body {
  padding: 16px 22px 8px;
  overflow-y: auto;
}

.modal-card.detail { max-width: 920px; }
.modal-card.small { max-width: 420px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 22px 16px;
  border-top: 1px solid #f0f3f8;
}

/* ---------------------------------------------------------- 表单 */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px 14px;
  align-items: start;
}
.form-grid.wide { grid-template-columns: repeat(3, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 2; }
.form-grid.wide .span-3 { grid-column: span 3; }
.form-grid .form-actions { grid-column: 1 / -1; }

.form { display: flex; flex-direction: column; gap: 11px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: #61708a; }
.field > span i { color: var(--warn); font-style: normal; }
.field input, .field select, .field textarea {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  width: 100%;
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 235, .1);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field textarea { min-height: 62px; line-height: 1.55; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 2px;
  position: sticky;
  bottom: -22px;
  background: #fff;
  padding: 10px 0 0;
  box-shadow: 0 -10px 14px -10px rgba(22, 32, 47, .18);
}
.form-actions .btn { min-width: 90px; justify-content: center; }
.form-hint { font-size: 11.5px; color: #a7b1c1; margin: 0; }

.inline-field { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.inline-field > span { font-size: 12px; color: var(--dim); white-space: nowrap; }
.inline-field input, .inline-field select { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12.5px;
  color: #61708a;
  background: #fff;
  user-select: none;
  cursor: pointer;
}
.chip input { display: none; }
.chip.on { background: #eaf1ff; border-color: #c4d8ff; color: var(--brand); }
.chip-x {
  border: 0; background: transparent;
  color: #a7b1c1; font-size: 14px; line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
}
.chip-x:hover { color: var(--warn); }

.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #61708a; }

/* 跟进 / 合作 */
.quick-add {
  background: #f8fafd;
  border: 1px solid #eef2f8;
  border-radius: 12px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}
.quick-row { display: flex; gap: 8px; }
.quick-row input, .quick-row select {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  min-width: 0;
}
.quick-row input:focus, .quick-row select:focus { border-color: var(--brand); }
.quick-add textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  outline: none;
  resize: vertical;
  width: 100%;
}
.quick-add textarea:focus { border-color: var(--brand); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 1px solid #e8edf5; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -4.5px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px #eaf1ff;
}
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tl-date { font-size: 12.5px; font-weight: 600; color: #4a5a72; }
.tl-text { font-size: 13px; color: #3c4a60; white-space: pre-wrap; word-break: break-word; }
.link-del {
  border: 0; background: transparent; color: #b6c0ce;
  font-size: 11.5px; margin-left: auto; padding: 0;
}
.link-del:hover { color: var(--warn); }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.summary-strip > div {
  background: #f8fafd;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.summary-strip b { display: block; font-size: 15px; }
.summary-strip span { font-size: 11.5px; color: var(--dim); }

.deal-list { list-style: none; margin: 0; padding: 0; }
.deal-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px dashed #eef1f6;
}
.deal-list li:last-child { border-bottom: 0; }
.deal-main { flex: 1; min-width: 0; }
.deal-title { font-size: 13.5px; font-weight: 550; }
.deal-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.deal-right { text-align: right; }
.deal-share { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 3px; }

/* ---------------------------------------------------------- 设置 */

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.dict-card .quick-row { margin-top: 12px; }
.dict-input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
}
.dict-input:focus { border-color: var(--brand); }
code {
  background: #f1f4f9;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

/* ---------------------------------------------------------- 登录 */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% 5%, #e8efff 0%, transparent 60%),
    radial-gradient(700px 500px at 90% 100%, #eef6ff 0%, transparent 55%),
    #f4f6fa;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(22, 32, 47, .1);
  padding: 32px 28px 26px;
  text-align: center;
}
.login-logo {
  width: 46px; height: 46px;
  margin: 0 auto 12px;
  border-radius: 13px;
  background: linear-gradient(135deg, #3d7bfa, #1f57c9);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: grid; place-items: center;
}
.login-card h1 { font-size: 19px; margin: 0 0 22px; }
.login-card .field { text-align: left; margin-bottom: 12px; }
.alert-error {
  background: #fdeeea;
  color: #c2412b;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
  text-align: left;
}

/* ---------------------------------------------------------- 提示 / 遮罩 */

#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 12px);
  background: #1c2434;
  color: #fff;
  padding: 9px 18px;
  border-radius: 22px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .2);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 26, 38, .34);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 50;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .todo-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .only-mobile { display: grid; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 55;
    transform: translateX(-102%);
    transition: transform .22s;
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 16px 14px 40px; }
  .topbar {
    padding: 9px 14px;
    height: auto;
    flex-basis: auto;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .page-title { white-space: nowrap; }
  .top-right { width: 100%; margin-left: 0; justify-content: flex-end; }
  .range-tabs { width: 100%; }
  .range-tab { flex: 1; text-align: center; white-space: nowrap; }
  .grid { table-layout: auto; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-body { height: 190px; }

  .toolbar .select { flex: 1 1 30%; }
  .count-chip { width: auto; text-align: right; margin-left: auto; }

  .table-wrap { overflow-x: auto; }
  .grid { min-width: 900px; }

  .drawer { width: 100vw; }
  .drawer-body { padding: 14px 14px 22px; }
  .drawer-head { padding: 14px 14px 10px; }
  .tabs { padding: 6px 10px 0; }
}

/* 手机上表格变卡片，不用横向滚 */
@media (max-width: 700px) {
  .form-grid, .form-grid.wide { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3, .form-grid.wide .span-3 { grid-column: span 1; }

  .table-wrap { background: transparent; box-shadow: none; overflow: visible; }
  .grid { display: block; min-width: 0; table-layout: auto; }
  .grid thead { display: none; }
  .grid tbody { display: block; }
  .grid tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 10px;
    position: relative;
  }
  .grid tr:hover { background: #fff; }
  .grid tr.selected { background: #f1f7ff; }
  .grid td {
    display: block;
    padding: 0;
    border: 0;
    overflow: visible;
    font-size: 12px;
    white-space: normal;
  }
  .grid td.col-check { position: absolute; right: 10px; top: 12px; }
  .grid td:nth-child(2) { width: 100%; padding-right: 30px; }
  .grid td.cell-time { width: 100%; }
  .grid td[data-label]::before {
    content: attr(data-label);
    color: #9aa5b6;
    margin-right: 4px;
  }
  .grid td.col-ops {
    width: 100%;
    margin-top: 2px;
    order: 99;
  }
  .grid td.col-ops .op-btn { font-size: 13px; padding: 3px 8px; }
  .grid td.col-ops .op-btn:first-child { margin-left: -8px; }
}

@media (max-width: 560px) {
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 21px; }
  .field-row { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 84px 1fr auto; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .range-tabs { width: 100%; overflow-x: auto; }

  .modal { padding: 10px; }
  .modal-card { max-height: 92vh; border-radius: 14px; }
  .modal-head { padding: 16px 14px 12px; }
  .modal-body { padding: 14px 14px 18px; }
}
