/* CRM 界面：水泥灰底 + 墨绿主色；询价类线索用信号黄标出来，是整套界面唯一的亮色 */
:root {
  --paper: #edf0ee; --card: #fff; --ink: #16201d; --ink-2: #4c5753; --muted: #7d8783; --line: #d5dbd7; --line-2: #e6eae7;
  --green: #0b6b5a; --green-soft: #e3f0ec; --green-ink: #07483d;
  --signal: #f2b705; --signal-soft: #fff6d6; --bad: #c4402f; --bad-soft: #fbe9e6;
  --dy: #16201d; --xhs: #ff2442;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
  --r: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--green); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.err { color: var(--bad); min-height: 20px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); padding: 36px 32px 28px; border-radius: 14px; width: 100%; max-width: 340px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0 0 10px; font: 600 26px/1 var(--mono); letter-spacing: .08em; }
.login-mark { display: flex; gap: 6px; margin-bottom: 6px; }
.login-mark span { width: 26px; height: 18px; border-radius: 9px 9px 9px 2px; background: var(--line); }
.login-mark span:last-child { background: var(--green); border-radius: 9px 9px 2px 9px; }

/* ---------- 表单 / 按钮 ---------- */
input, textarea, select { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); width: 100%; }
textarea { resize: vertical; min-height: 60px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 6px 14px; border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-ink); }
.btn.sm { padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
kbd { font: 11px/1 var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: #fff; color: var(--ink-2); }

/* ---------- 框架：左侧墨色栏 ---------- */
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) 200px, var(--paper) 200px); }
.side { background: var(--ink); color: #c9d1cd; display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
.brand { font: 600 18px/1 var(--mono); letter-spacing: .1em; color: #fff; padding: 4px 10px 22px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { color: #c9d1cd; padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; text-decoration: none; }
#nav a:hover { background: rgba(255,255,255,.06); }
#nav a.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
#nav a b { font: 600 12px/18px var(--mono); min-width: 22px; text-align: center; border-radius: 9px; padding: 0 6px; background: var(--signal); color: var(--ink); }
#nav a b:empty { display: none; }
.me { font-size: 13px; display: flex; justify-content: space-between; padding: 0 10px; color: #9aa59f; }
.me a { color: #9aa59f; }
main { padding: 28px 32px 80px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 600; }

/* ---------- 概览：流水线 ---------- */
.flow { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 20px; }
.flow a { padding: 18px 20px 16px; color: var(--ink); position: relative; text-decoration: none; border-right: 1px solid var(--line-2); }
.flow a:last-child { border-right: 0; }
.flow a:not(:last-child)::after { content: ""; position: absolute; right: -7px; top: 50%; width: 12px; height: 12px; background: var(--card); border-top: 1px solid var(--line-2); border-right: 1px solid var(--line-2); transform: translateY(-50%) rotate(45deg); z-index: 1; }
.flow a:hover { background: #fafbfa; }
.flow .k { color: var(--muted); font-size: 13px; }
.flow .v { font: 600 32px/1.2 var(--mono); display: block; margin: 2px 0; }
.flow .h { font-size: 12px; color: var(--muted); }
.flow a.hot .v { color: var(--green); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 20px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; }
.card h3 a { font-weight: 400; font-size: 13px; }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.mini li:first-child { border-top: 0; }
.mini li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini li .s { color: var(--muted); font-size: 12px; white-space: nowrap; }
.help ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.help li { margin-bottom: 2px; }

/* ---------- 标签 ---------- */
.plat { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 6px 1px 0; vertical-align: middle; }
.plat.douyin { background: var(--dy); }
.plat.xhs { background: var(--xhs); }
.chip { display: inline-block; font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--line-2); color: var(--ink-2); margin-left: 6px; }
.chip.lead { background: var(--signal); color: var(--ink); font-weight: 600; }
.chip.ok { background: var(--green-soft); color: var(--green-ink); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- 工具条 / 分段 ---------- */
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }
.bar select, .bar input { width: auto; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.seg a { padding: 4px 12px; border-radius: 7px; color: var(--ink-2); font-size: 13px; text-decoration: none; }
.seg a i { font: normal 12px var(--mono); margin-left: 5px; color: var(--muted); }
.seg a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(22,32,29,.12); }
.seg a.on i { color: var(--green); }

/* ---------- 评论：一来一回两个气泡 ---------- */
.cm { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px 18px; margin-bottom: 10px; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.cm.lead::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 3px 3px 0; background: var(--signal); }
.cm.focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.cm .head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cm .head input { width: auto; margin: 0; }
.cm .head .who { color: var(--ink); font-weight: 600; font-size: 14px; }
.cm .head .work { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.bubble { border-radius: 4px 14px 14px 14px; background: #f1f3f2; padding: 9px 13px; white-space: pre-wrap; word-break: break-word; align-self: start; }
.reply { align-self: start; }
.reply textarea, .reply .sent { border-radius: 14px 4px 14px 14px; background: var(--green-soft); border: 1px solid transparent; padding: 9px 13px; min-height: 64px; color: var(--green-ink); }
.reply textarea:focus { background: #fff; border-color: var(--green); }
.reply .sent { min-height: 0; white-space: pre-wrap; }
.reply .sent.empty { background: transparent; color: var(--muted); padding-left: 0; }
.cm .why { font-size: 12px; color: var(--muted); margin-top: 5px; }
.cm .why.bad { color: var(--bad); }
.cm .meta { font-size: 12px; color: var(--muted); margin-top: 5px; }
.cm .acts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; border-top: 1px dashed var(--line-2); padding-top: 9px; }
.cm .acts .sp { flex: 1; }
.keys { margin: -4px 0 14px; background: var(--ink); color: #c9d1cd; border-radius: 10px; padding: 8px 14px; font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; width: fit-content; }
.keys kbd { background: transparent; color: #fff; border-color: #4c5753; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #f7f8f7; }
tr.click:hover td { background: #f7f9f8; cursor: pointer; }
td .sub { color: var(--muted); font-size: 12px; }
.stage { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--line); }
.stage.s-hot { border-color: var(--green); color: var(--green); }
.stage.s-done { background: var(--green); border-color: var(--green); color: #fff; }
.stage.s-dead { color: var(--muted); }
.due { color: var(--bad); font-weight: 600; }

/* ---------- 设置 ---------- */
.form-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; margin-bottom: 10px; }
.form-row label { color: var(--muted); padding-top: 7px; font-size: 13px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { width: auto; }
.acc { border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px; margin-bottom: 12px; background: #fafbfa; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; background: rgba(22,32,29,.35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer-body { background: var(--paper); width: 100%; max-width: 560px; height: 100%; overflow-y: auto; padding: 22px; }
.drawer-body h2 { margin: 0; font-size: 18px; }
.timeline { border-left: 2px solid var(--line); padding-left: 14px; margin-top: 8px; }
.timeline > div { margin-bottom: 12px; position: relative; }
.timeline > div::before { content: ""; position: absolute; left: -19px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline small { color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 44px 16px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 10px; z-index: 30; max-width: 90vw; }
.toast.bad { background: var(--bad); }

@media (prefers-reduced-motion: no-preference) {
  .cm, .flow a, .btn { transition: border-color .15s, box-shadow .15s, background .15s; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: var(--paper); }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; z-index: 5; gap: 8px; overflow-x: auto; }
  .brand { padding: 0 8px 0 4px; font-size: 15px; }
  #nav { flex-direction: row; flex: 1; }
  #nav a { padding: 6px 10px; gap: 6px; white-space: nowrap; }
  .me { padding: 0 4px; white-space: nowrap; }
  .me span { display: none; }
  #nav a { padding: 6px 8px; }
  main { padding: 18px 16px 70px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow a:nth-child(2) { border-right: 0; }
  .flow a:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .flow a::after { display: none; }
  .cols { grid-template-columns: 1fr; }
  .cm { grid-template-columns: 1fr; }
  .cm .head .work { display: none; }
  .keys { display: none; }
  .form-row { grid-template-columns: 1fr; gap: 4px; }
  .form-row label { padding-top: 0; }
}
