:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #6b7486;
  --line: #e3e7ee;
  --brand: #2557d6;
  --brand-soft: #e9effd;
  --red: #d93636;
  --red-soft: #fdecec;
  --orange: #e2780c;
  --orange-soft: #fff1e2;
  --yellow: #b98a00;
  --yellow-soft: #fff8db;
  --green: #1c8a4a;
  --green-soft: #e6f6ec;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 210px; flex: none; background: #172033; color: #c9d1e2; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 16px; }
.side a { display: flex; justify-content: space-between; align-items: center; color: #c9d1e2; padding: 8px 10px; border-radius: 8px; margin: 2px 0; }
.side a:hover { background: #24304a; text-decoration: none; }
.side a.on { background: var(--brand); color: #fff; }
.side .sec { font-size: 12px; color: #7d8aa5; padding: 14px 10px 4px; }
.side .me { border-top: 1px solid #2a3653; margin-top: 16px; padding: 12px 10px 0; font-size: 13px; }
.side .me button { background: none; border: 0; color: #9fb0d4; padding: 0; cursor: pointer; font: inherit; }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: none; }
.pill { background: var(--red); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; line-height: 18px; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel.tight { padding: 0; overflow: hidden; }
.panel.tight > h2 { padding: 14px 18px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

/* 提示 */
.flash { background: var(--green-soft); border: 1px solid #b9e3c8; color: #145c33; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.error { background: var(--red-soft); border: 1px solid #f3c1c1; color: #8f1f1f; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.warn { background: var(--yellow-soft); border: 1px solid #f0dc8c; color: #6d5200; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.notice-bar { display: block; background: var(--red); color: #fff; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; }
.notice-bar:hover { text-decoration: none; opacity: .92; }

/* 数字卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--brand); }
.card .num { font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card .lbl { color: var(--muted); font-size: 13px; }
.card.hot { background: var(--red); border-color: var(--red); color: #fff; }
.card.hot .lbl { color: #ffe1e1; }
.card.warm .num { color: var(--orange); }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* 标签 */
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #eef1f6; color: #3d4659; white-space: nowrap; line-height: 20px; }
.q-S { background: #1d2433; color: #ffd75e; font-weight: 700; }
.q-A { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.q-B { background: #eef1f6; color: #4c5568; font-weight: 700; }
.st-new { background: #eef1f6; }
.st-intent { background: var(--brand-soft); color: var(--brand); }
.st-demo { background: #efe7fd; color: #6b35c9; }
.st-deal { background: var(--green-soft); color: var(--green); }
.st-low { background: #f3f3f3; color: #8a8a8a; }
.st-dropped { background: #f3f3f3; color: #aaa; text-decoration: line-through; }
.lv { font-weight: 700; border-radius: 6px; padding: 2px 8px; white-space: nowrap; display: inline-block; }
.lv-yellow { background: var(--yellow-soft); color: var(--yellow); }
.lv-orange { background: var(--orange-soft); color: var(--orange); }
.lv-red { background: var(--red-soft); color: var(--red); }
.must { background: var(--red); color: #fff; }
.ok { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }

/* 预警行 */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-row { display: grid; grid-template-columns: 82px minmax(140px, 1.4fr) 1fr 1fr 1.1fr auto; gap: 10px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.alert-row:last-child { border-bottom: 0; }
.alert-row.l-red { border-left-color: var(--red); }
.alert-row.l-orange { border-left-color: var(--orange); }
.alert-row.l-yellow { border-left-color: #e5c142; }
.alert-row .who { font-size: 13px; }
.alert-row .cname { font-weight: 600; }
.alert-row form { margin: 0; }
.alert-head { font-size: 12px; color: var(--muted); background: #fafbfd; font-weight: 600; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cfd5e0; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8cbf7; border-color: var(--brand); }
.field { margin-bottom: 12px; }
.req::after { content: " *"; color: var(--red); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 14px; margin: 6px 0; }
.check input { width: 17px; height: 17px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { width: auto; min-width: 120px; padding: 6px 8px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline select, .inline input { width: auto; padding: 5px 8px; }

button, .btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; cursor: pointer; white-space: nowrap; line-height: 1.4;
}
button:hover, .btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost, button.ghost { background: #fff; color: var(--brand); }
.btn.sm, button.sm { padding: 4px 10px; font-size: 13px; }
button.danger { background: var(--red); border-color: var(--red); }
button.ok-btn { background: var(--green); border-color: var(--green); }
.btn.big, button.big { padding: 11px 26px; font-size: 16px; }

/* 今日 */
.countdown { font-size: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.countdown b { font-size: 20px; font-variant-numeric: tabular-nums; }
.countdown.urgent { background: var(--red-soft); border-color: #f3c1c1; }
.todo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.todo:last-child { border-bottom: 0; }
.todo.over { background: #fff7f7; }
.todo .t-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }

/* 客户详情 */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 0 12px 18px; border-left: 2px solid var(--line); margin-left: 6px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: #b9c2d3; }
.timeline li.k-followup::before { background: var(--brand); }
.timeline li.k-alert::before { background: var(--red); }
.timeline li.k-request::before { background: var(--orange); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.fu-body { background: #f8f9fc; border-radius: 8px; padding: 8px 12px; margin-top: 4px; font-size: 14px; }
.fu-body p { margin: 2px 0; }
.fu-body b { color: var(--muted); font-weight: 600; margin-right: 4px; }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
details.box summary { cursor: pointer; font-weight: 600; }
details.box[open] summary { margin-bottom: 10px; }

/* 看板 */
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #e9edf3; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col h3 { display: flex; justify-content: space-between; font-size: 14px; }
.bcard { display: block; background: #fff; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: inherit; border: 1px solid var(--line); font-size: 13px; }
.bcard:hover { text-decoration: none; border-color: var(--brand); }
.bcard .n { font-weight: 600; font-size: 14px; }

/* 分布条 */
.bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 6px 0 10px; background: #eef1f6; }
.bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.c-new { background: #9aa6bb; } .c-intent { background: #2557d6; } .c-demo { background: #7c4ddb; }
.c-deal { background: #1c8a4a; } .c-low { background: #d0d5de; } .c-dropped { background: #eceef2; }
.meter { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; min-width: 70px; }
.meter i { display: block; height: 100%; background: var(--green); }
.meter.low i { background: var(--red); }

/* 登录 */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login .panel { padding: 28px; }

/* 手机 */
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; position: fixed; inset: 0 30% 0 0; height: auto; z-index: 20; width: auto; }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: #172033; color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
  .topbar button { background: none; border: 1px solid #3a4766; padding: 4px 10px; }
  .topbar a { color: #fff; }
  .main { padding: 14px 16px 50px; }
  .grid2, .grid-detail, .row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card .num { font-size: 24px; }
  .alert-head { display: none; }
  .alert-row { grid-template-columns: auto 1fr auto; grid-template-areas: "lv name act" "lv who act" "lv last act"; gap: 2px 10px; padding: 10px 12px; }
  .alert-row > .c-lv { grid-area: lv; align-self: start; }
  .alert-row > .c-name { grid-area: name; }
  .alert-row > .c-group { display: none; }
  .alert-row > .c-who { grid-area: who; }
  .alert-row > .c-last { grid-area: last; }
  .alert-row > .c-act { grid-area: act; }
  .filters select, .filters input { min-width: 0; flex: 1 1 40%; }
  h1 { font-size: 19px; }
}
.contact-hist{margin-top:4px}
.channel-note{margin-top:6px}

/* ---------- 故事展示 ---------- */
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.story-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #c9cfda; border-radius: 10px; padding: 12px 14px; min-height: 96px; }
.story-card:hover, .story-card:focus-visible { border-color: var(--brand); border-left-color: var(--brand); }
.story-card.s-done { border-left-color: var(--green); background: #fbfefc; }
.story-card.s-na { opacity: .6; }
.story-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.story-no { font-size: 12px; letter-spacing: .08em; font-weight: 600; color: var(--muted); }
.s-done .story-state { color: var(--green); font-weight: 600; }
.story-title { font-size: 16px; font-weight: 600; }
.story-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.tag.ef-pending { background: var(--yellow-soft); color: var(--yellow); }
.tag.ef-ok { background: var(--green-soft); color: var(--green); }
.tag.ef-more { background: var(--red-soft); color: var(--red); }

.story-dlg { border: none; border-radius: 14px; padding: 18px 20px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.story-dlg::backdrop { background: rgba(20, 28, 45, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.dlg-head h2 { margin: 2px 0 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; font-size: 14px; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: none; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -2px; }
.drop { border: 1.5px dashed #c3cad6; border-radius: 10px; padding: 12px; text-align: center; cursor: pointer; background: #fafbfd; }
.drop:hover, .drop:focus { border-color: var(--brand); outline: none; }
.drop-tip { color: var(--muted); font-size: 13px; }
.preview { display: block; max-width: 100%; max-height: 320px; margin: 0 auto 8px; border-radius: 8px; border: 1px solid var(--line); }
.effect-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.effect-box h3 { font-size: 15px; margin: 0 0 8px; }
.effect-box .seg { margin-bottom: 10px; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.fb-text { max-width: 360px; white-space: pre-wrap; }
.ev-form { margin-top: 6px; display: grid; gap: 6px; min-width: 200px; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
