/* =========================================================================
   Valour Fits 行为观察台
   取色自牛仔布:丹宁靛蓝是主色,铜色缝线是「加购」,布边红只给「即将成交」。
   五个转化阶段在全站用同一套颜色:看板、路径进度、标签都一样。
   ========================================================================= */

:root {
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --ink: #1b2233;
  --ink-2: #464f66;
  --muted: #7a8296;
  --rule: #e1e4eb;
  --rule-2: #cfd4de;

  --indigo: #2f3e75;
  --indigo-2: #4a5ba0;
  --indigo-soft: #e7eaf6;
  --on-strong: #ffffff;
  --rail: #1d2647;
  --rail-ink: #c3c9de;
  --rail-dim: #8189a8;

  --selvedge: #c8423a;
  --selvedge-soft: #fbe9e7;

  /* 五个阶段 */
  --st-view: #8a93a8;
  --st-cart: #c4872b;
  --st-checkout: #3b6fd1;
  --st-pay: #7b4fd0;
  --st-won: #2e8a57;
  --st-cart-soft: #fbf1e1;
  --st-checkout-soft: #e6eefb;
  --st-pay-soft: #efe8fb;
  --st-won-soft: #e3f3ea;

  --ok: #2e8a57;
  --ok-soft: #e3f3ea;
  --warn: #a96a14;
  --warn-soft: #fbf1e1;
  --bad: #b8372f;
  --bad-soft: #fbe9e7;

  --r-lg: 14px;
  --r: 9px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(27, 34, 51, .05), 0 1px 1px rgba(27, 34, 51, .03);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "PingFang TC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151f; --surface: #191d2a; --surface-2: #1f2433; --ink: #e8ebf3; --ink-2: #b9bfd1;
    --muted: #868ea6; --rule: #2a3043; --rule-2: #363d54;
    --indigo: #8fa0e6; --indigo-2: #a9b6ee; --indigo-soft: #252c48; --rail: #0e111a; --on-strong: #10131c;
    --rail-ink: #b8bfd6; --rail-dim: #6d7592;
    --selvedge: #ef6a60; --selvedge-soft: #3a1f22;
    --st-view: #8d96ab; --st-cart: #e0a64c; --st-checkout: #6d98ec; --st-pay: #a687ec; --st-won: #4fb67e;
    --st-cart-soft: #3a2f1c; --st-checkout-soft: #1f2c47; --st-pay-soft: #2c2346; --st-won-soft: #1b3326;
    --ok: #4fb67e; --ok-soft: #1b3326; --warn: #e0a64c; --warn-soft: #3a2f1c; --bad: #ef6a60; --bad-soft: #3a1f22;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151f; --surface: #191d2a; --surface-2: #1f2433; --ink: #e8ebf3; --ink-2: #b9bfd1;
  --muted: #868ea6; --rule: #2a3043; --rule-2: #363d54;
  --indigo: #8fa0e6; --indigo-2: #a9b6ee; --indigo-soft: #252c48; --rail: #0e111a; --on-strong: #10131c;
  --rail-ink: #b8bfd6; --rail-dim: #6d7592;
  --selvedge: #ef6a60; --selvedge-soft: #3a1f22;
  --st-view: #8d96ab; --st-cart: #e0a64c; --st-checkout: #6d98ec; --st-pay: #a687ec; --st-won: #4fb67e;
  --st-cart-soft: #3a2f1c; --st-checkout-soft: #1f2c47; --st-pay-soft: #2c2346; --st-won-soft: #1b3326;
  --ok: #4fb67e; --ok-soft: #1b3326; --warn: #e0a64c; --warn-soft: #3a2f1c; --bad: #ef6a60; --bad-soft: #3a1f22;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--indigo-2); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted, .dim { color: var(--muted); }
.small { font-size: 12.5px; }
.nw { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------- 外框 */

.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--rail) 224px, transparent 224px); }

.sidebar {
  background: var(--rail); color: var(--rail-ink); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--indigo-2);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 -3px 0 var(--selvedge);
}
.brand b { display: block; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.3; }
.brand span { font-size: 12px; color: var(--rail-dim); }

.nav-group { margin-bottom: 14px; }
.nav-group h6 { margin: 0 0 4px; padding: 0 10px; font-size: 11.5px; font-weight: 500; color: var(--rail-dim); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--rail-ink); font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 500; }
.nav a.on svg { color: #fff; }
.nav a .count {
  margin-left: auto; background: var(--selvedge); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 0 7px; line-height: 18px; font-weight: 600;
}
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--rail-dim); }
.sidebar-foot a, .sidebar-foot button { color: var(--rail-dim); background: none; border: 0; padding: 0;
  font: inherit; cursor: pointer; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: #fff; }

.main { min-width: 0; padding: 22px 28px 64px; }

/* ------------------------------------------------------------- 页头 & 控件 */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 2px; gap: 2px; }
.seg a, .seg button { padding: 4px 11px; border-radius: 7px; color: var(--ink-2); font-size: 13px;
  border: 0; background: none; cursor: pointer; font-family: inherit; white-space: nowrap; }
.seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg a.on, .seg button.on { background: var(--indigo); color: #fff; }
.seg button { border: 0; background: none; cursor: pointer; font: inherit; }
:root[data-theme="dark"] .seg a.on { color: #12151f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg a.on { color: #12151f; } }
.seg.traffic a.on.human { background: var(--ok); }
.seg.traffic a.on.datacenter { background: var(--bad); }

input[type="text"], input[type="search"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], select, textarea {
  font: inherit; font-size: 13.5px; padding: 6px 10px; border: 1px solid var(--rule-2);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); min-height: 32px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--indigo-2);
  box-shadow: 0 0 0 3px var(--indigo-soft); }

.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 6px 13px; min-height: 32px; border-radius: var(--r-sm); border: 1px solid var(--indigo);
  background: var(--indigo); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { border-color: var(--indigo-2); color: var(--indigo); filter: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 3px 9px; min-height: 26px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: default; }

.refresh { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.refresh a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); padding: 5px 9px;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); }
.refresh a:hover { text-decoration: none; border-color: var(--indigo-2); }
.refresh a.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- 面板 */

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.panel-head .aside { color: var(--muted); font-size: 12.5px; }
.panel > h2 { margin: 0; font-size: 14.5px; font-weight: 600; padding: 13px 18px; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel > h2 small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.panel .body { padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.scroll { overflow-x: auto; }

/* ------------------------------------------------------------- 表格 */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px 12px;
  border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--surface-2); }
td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.click { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; font-weight: 600; }

/* ------------------------------------------------------------- 标签 */

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; line-height: 20px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--rule); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.info { background: var(--indigo-soft); color: var(--indigo); border-color: transparent; }
.tag.st-cart { background: var(--st-cart-soft); color: var(--st-cart); border-color: transparent; }
.tag.st-checkout { background: var(--st-checkout-soft); color: var(--st-checkout); border-color: transparent; }
.tag.st-paying { background: var(--st-pay-soft); color: var(--st-pay); border-color: transparent; }
.tag.st-won { background: var(--st-won-soft); color: var(--st-won); border-color: transparent; }
.tag.code { font-family: var(--mono); letter-spacing: .03em; }

/* 路径进度:五个阶段,一条线串起来,到哪一步就亮到哪一步 */
.path { display: inline-flex; align-items: center; gap: 0; }
.path i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface);
  border: 1.5px solid var(--rule-2); display: block; }
.path b { width: 10px; height: 1.5px; background: var(--rule-2); display: block; }
.path i.on.s1 { background: var(--st-view); border-color: var(--st-view); }
.path i.on.s2 { background: var(--st-cart); border-color: var(--st-cart); }
.path i.on.s3 { background: var(--st-checkout); border-color: var(--st-checkout); }
.path i.on.s4 { background: var(--st-pay); border-color: var(--st-pay); }
.path i.on.s5 { background: var(--st-won); border-color: var(--st-won); width: 11px; height: 11px; }
.path-label { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

/* ------------------------------------------------------------- 筛选栏 */

.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px;
  border-bottom: 1px solid var(--rule); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px; border-radius: 999px;
  color: var(--ink-2); font-size: 13px; border: 1px solid transparent; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.on { background: var(--indigo-soft); color: var(--indigo); font-weight: 500; }
.tabs a em { font-style: normal; color: var(--muted); font-size: 12px; }
.tabs a.on em { color: inherit; opacity: .8; }
.filterbar form.search { margin-left: auto; display: flex; gap: 6px; }
.filterbar form.search input { width: 260px; }

.pager { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 18px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--rule); }

/* ------------------------------------------------------------- 会话列表单元格 */

.who b { font-weight: 500; }
.who .ip { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.who .net { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--muted); }

.src { min-width: 210px; }
.who { min-width: 120px; }
.src .utm { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 3px; word-break: break-all; }
.src .utm .k { color: var(--muted); margin-right: 4px; font-size: 12px; }
.src .utm .fixed { color: var(--ok); font-size: 11.5px; margin-left: 3px; }
.src .utm a.fix { font-size: 11.5px; margin-left: 4px; color: var(--selvedge); }

/* 落地页:标题完整显示,网址完整显示(已解码),可以点开 */
.lp { display: block; min-width: 240px; max-width: 520px; color: inherit; }
.lp:hover { text-decoration: none; }
.lp:hover .lp-title { color: var(--indigo); text-decoration: underline; text-underline-offset: 2px; }
.lp-title { display: block; font-weight: 500; line-height: 1.45; color: var(--ink); }
.lp-url { display: block; font-size: 12px; color: var(--muted); word-break: break-all; line-height: 1.45; margin-top: 2px; }
.lp-url .q { opacity: .7; }

/* ------------------------------------------------------------- 实时看板 */

.live { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px 0; flex-wrap: wrap; }
.live-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--selvedge); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--selvedge);
  opacity: .5; animation: ping 1.8s ease-out infinite; }
@keyframes ping { from { transform: scale(.6); opacity: .6; } to { transform: scale(1.6); opacity: 0; } }
.live-head .aside { color: var(--muted); font-size: 12.5px; }

/* 阶段轨道:五个数字被一条缝线串起来 */
.track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 16px 18px 18px; position: relative; }
/* 缝线从第一个圆点的圆心连到最后一个圆点的圆心;圆点和下面的数字左边对齐 */
.track::before { content: ""; position: absolute; left: 25px; right: calc((100% - 36px) / 5 + 11px); top: 22px;
  border-top: 2px dashed var(--rule-2); }
.stop { position: relative; padding-right: 10px; }
.stop .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--st-view);
  position: relative; z-index: 1; margin: 0 0 10px; box-sizing: border-box; }
.stop.cart .dot { border-color: var(--st-cart); }
.stop.checkout .dot { border-color: var(--st-checkout); }
.stop.paying .dot { border-color: var(--st-pay); background: var(--st-pay); }
.stop.won .dot { border-color: var(--st-won); background: var(--st-won); }
.stop .n { font-size: 28px; font-weight: 650; line-height: 1.1; letter-spacing: -.02em; }
.stop .l { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.stop .h { font-size: 12px; color: var(--muted); }
.stop.paying .n { color: var(--st-pay); }
.stop.won .n { color: var(--st-won); }
.stop.hot .n { color: var(--selvedge); }

.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.lane { padding: 12px 12px 14px; min-width: 0; }
.lane + .lane { border-left: 1px solid var(--rule); }
.lane h3 { margin: 0 4px 10px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.lane h3 i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.lane.paying h3 i { background: var(--st-pay); }
.lane.checkout h3 i { background: var(--st-checkout); }
.lane.cart h3 i { background: var(--st-cart); }
.lane h3 em { font-style: normal; color: var(--muted); font-weight: 400; margin-left: auto; font-size: 12px; }
.lane-empty { color: var(--muted); font-size: 12.5px; padding: 6px 4px; }
.lane-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }

.vcard { display: block; border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 11px; color: inherit;
  background: var(--surface); border-left: 3px solid var(--st-cart); }
.lane.checkout .vcard { border-left-color: var(--st-checkout); }
.lane.paying .vcard { border-left-color: var(--st-pay); }
.vcard:hover { text-decoration: none; border-color: var(--rule-2); background: var(--surface-2); }
.vcard.fresh { box-shadow: 0 0 0 2px var(--selvedge-soft); }
.vcard.idle { opacity: .72; }
.vc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.vc-top b { font-weight: 600; }
.vc-top .t { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vc-top .t.now { color: var(--selvedge); font-weight: 500; }
.vc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vc-items { margin: 7px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-2); }
.vc-items li { display: flex; justify-content: space-between; gap: 8px; }
.vc-items li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.vc-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 7px; font-size: 12px; color: var(--muted); }
.vc-foot .page { width: 100%; overflow-wrap: anywhere; }
.vc-value { font-weight: 600; color: var(--ink); }

.won-feed { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--rule); flex-wrap: wrap;
  align-items: center; font-size: 12.5px; color: var(--muted); }
.won-feed a { display: inline-flex; gap: 6px; align-items: center; background: var(--st-won-soft); color: var(--st-won);
  padding: 2px 10px; border-radius: 999px; }

/* ------------------------------------------------------------- 指标 */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden; }
.stat { padding: 14px 18px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; }
.stat .note { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 14px 18px; border-right: 1px solid var(--rule); }
.kpi:last-child { border-right: 0; }
.kpi .label { font-size: 12.5px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; }
.kpi .note { font-size: 12px; color: var(--muted); }

/* 漏斗:真正的倒三角,每一步一层;层高相同,宽度只是形状,人数和比例写在层里 */
.ftri { display: grid; gap: 2px; max-width: 860px; margin: 0 auto; }
.frow { display: grid; grid-template-columns: 96px minmax(0, 1fr) 190px; gap: 14px; align-items: center; }
.fname { font-size: 13px; color: var(--ink-2); text-align: right; }
.fband { height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: color-mix(in oklab, var(--indigo) var(--fill), var(--surface)); color: var(--ink);
  font-variant-numeric: tabular-nums; transition: filter .15s; }
.fband b { font-size: 16px; font-weight: 650; }
.fband span { font-size: 12.5px; opacity: .8; }
.fband.strong { color: var(--on-strong); }
.frow:hover .fband { filter: brightness(1.08); }
.floss { font-size: 12.5px; color: var(--ink-2); }
.floss b { color: var(--bad); font-weight: 600; }
@media (max-width: 700px) {
  .frow { grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
  .floss { grid-column: 2; text-align: center; margin-bottom: 4px; }
}

/* 迷你柱状图 */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; padding: 0 18px 4px; }
.bars span { flex: 1; background: var(--indigo-soft); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars span i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--st-won); border-radius: 3px 3px 0 0; }

/* ------------------------------------------------------------- 详情 */

.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 7px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 82px; top: 6px; bottom: 6px; border-left: 2px dashed var(--rule); }
.timeline li { display: grid; grid-template-columns: 70px 24px minmax(0, 1fr); gap: 0; padding: 8px 0; }
.timeline time { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.timeline .node { width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--st-view);
  margin: 5px 0 0 6px; position: relative; z-index: 1; }
.timeline li.k-cart .node { border-color: var(--st-cart); background: var(--st-cart); }
.timeline li.k-checkout .node { border-color: var(--st-checkout); background: var(--st-checkout); }
.timeline li.k-pay .node { border-color: var(--st-pay); background: var(--st-pay); }
.timeline li.k-won .node { border-color: var(--st-won); background: var(--st-won); width: 13px; height: 13px; margin-left: 5px; }
.timeline li.k-out .node { border-color: var(--bad); }
.timeline .what { min-width: 0; }
.timeline .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .head b { font-weight: 600; font-size: 13.5px; }
.timeline .head .ttl { color: var(--ink-2); font-size: 13.5px; }
.timeline .url { display: block; font-size: 12.5px; color: var(--muted); word-break: break-all; margin-top: 1px; }
.timeline .url:hover { color: var(--indigo); }
.timeline .detail { margin-top: 6px; padding: 8px 11px; background: var(--surface-2); border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-2); }

/* ------------------------------------------------------------- 杂项 */

.flash { padding: 10px 14px; border-radius: var(--r); margin-bottom: 14px; font-size: 13.5px;
  border: 1px solid var(--rule); background: var(--surface); }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.flash.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.flash.info { background: var(--indigo-soft); color: var(--indigo); border-color: transparent; }
.notice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 18px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }
.notice.warn { background: var(--warn-soft); border-color: transparent; }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ink); }
.panel .body > .notice { margin-bottom: 0; display: block; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bigip { font-size: 22px; font-weight: 600; margin: 0 0 4px; font-family: var(--mono); }
.linkbox { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 8px 10px; word-break: break-all; user-select: all; font-family: var(--mono); font-size: 12.5px; }
details summary { cursor: pointer; font-size: 13px; }
details .purge { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
details .purge p { flex-basis: 100%; margin: 0; }
.fld { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.fld.chk input { width: 15px; height: 15px; }
table.datasets td { padding: 14px 18px; vertical-align: middle; }
table.datasets td:first-child { white-space: nowrap; width: 100px; }
table.datasets td:last-child { width: 90px; text-align: right; }
.suggest { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.suggest button { font: inherit; font-size: 12px; padding: 1px 9px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--ok); color: var(--ok); background: var(--ok-soft); }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form input[type="text"] { min-width: 220px; }
.theme-toggle svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------- 登录 */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--rail);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 6px); }
.login { background: var(--surface); border-radius: var(--r-lg); padding: 30px 28px; width: 100%; max-width: 360px;
  border-top: 4px solid var(--selvedge); }
.login h1 { font-size: 19px; margin: 0 0 4px; }
.login p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.login input { width: 100%; margin-bottom: 14px; padding: 9px 11px; }
.login .btn { width: 100%; justify-content: center; padding: 9px; }
.login .error { background: var(--bad-soft); color: var(--bad); padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 14px; }

/* ------------------------------------------------------------- 响应式 */

@media (max-width: 1180px) {
  .lanes { grid-template-columns: 1fr; }
  .lane + .lane { border-left: 0; border-top: 1px solid var(--rule); }
  .lane-list { max-height: none; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; background: none; }
  /* 窄屏下表格保持可读宽度,横向滑动看,而不是把每列挤成一两个字 */
  .scroll > table { min-width: 860px; }
  .scroll { -webkit-overflow-scrolling: touch; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px;
    gap: 6px; overflow-x: auto; }
  .brand { padding: 0 8px 0 0; }
  .brand > div { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav-group { display: contents; }
  .nav-group h6 { display: none; }
  .nav a { white-space: nowrap; padding: 6px 9px; }
  .sidebar-foot { display: none; }
  .main { padding: 16px 16px 48px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .track { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .track::before { display: none; }
  .filterbar form.search { margin-left: 0; width: 100%; }
  .filterbar form.search input { flex: 1; width: auto; }
  .step { grid-template-columns: 76px minmax(0, 1fr); }
  .step .num { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 挽回转化 · 参数与测试 ---------- */
.tabs a em.ok { color: var(--ok); opacity: 1; font-weight: 600; }
.tabs a em.bad { color: var(--bad); opacity: 1; font-weight: 600; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 28px; }
.settings fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.settings legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.field { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); }
.field.changed { border-color: var(--indigo-2); background: var(--indigo-soft); }
.field .name { font-size: 13.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.field .help { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.5; }
.num-in { display: inline-flex; align-items: center; gap: 6px; }
.num-in input { width: 92px; text-align: right; padding: 6px 8px; border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.num-in em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.switch input { width: 18px; height: 18px; accent-color: var(--indigo); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--rule); }
.verdict { display: flex; gap: 12px; align-items: baseline; padding: 12px 14px; border-radius: var(--r); }
.verdict b { font-size: 22px; font-variant-numeric: tabular-nums; }
.verdict.pass { background: var(--ok-soft); } .verdict.pass b { color: var(--ok); }
.verdict.fail { background: var(--bad-soft); } .verdict.fail b { color: var(--bad); }
tr.row-bad td { background: var(--bad-soft); }
.checks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 13px; padding-left: 22px; position: relative; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); }
.checks li.bad::before { content: "✗"; color: var(--bad); }
.checks li span { color: var(--ink-2); }
.trace summary { cursor: pointer; font-size: 12.5px; color: var(--indigo); }
.trace ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; display: grid; gap: 2px; min-width: 220px; }
.trace li { padding-left: 16px; position: relative; }
.trace li::before { position: absolute; left: 0; }
.trace li.ok::before { content: "✓"; color: var(--ok); }
.trace li.bad::before { content: "✗"; color: var(--bad); }
.trace li.bad { color: var(--bad); font-weight: 600; }
.trace li.skip { color: var(--muted); } .trace li.skip::before { content: "–"; }
.trace li em { font-style: normal; display: block; font-weight: 400; }
ul.plain { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) { .checks li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- 时间线:页面内操作 ---------- */
.timeline li.k-view .node { border-color: var(--indigo-2); }
.timeline .engage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px;
  font-size: 12px; color: var(--ink-2); }
.timeline .engage .depth { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--rule);
  overflow: hidden; vertical-align: middle; }
.timeline .engage .depth i { display: block; height: 100%; background: var(--indigo-2); }
.timeline ol.actions { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--indigo-soft);
  display: grid; gap: 3px; }
.timeline ol.actions li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 1px 0; font-size: 12.5px; color: var(--ink-2); }
.timeline ol.actions li time { width: 44px; flex: none; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.timeline ol.actions li.ui_option span:first-of-type { color: var(--ink); font-weight: 500; }
.timeline ol.actions li.rage span:first-of-type { color: var(--bad); font-weight: 600; }
.timeline ol.actions li.dead span:first-of-type { color: var(--warn); }

/* ---------- 页面互动 ---------- */
.tips { list-style: none; margin: 0; padding: 0; }
.tips li { padding: 12px 18px; border-top: 1px solid var(--rule); border-left: 3px solid var(--indigo-2); }
.tips li:first-child { border-top: 0; }
.tips li.warn { border-left-color: var(--warn); }
.tips li.bad { border-left-color: var(--bad); }
.tips li p { margin: 4px 0 0; line-height: 1.6; }
.depth-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; vertical-align: middle; }
.depth-bar i { display: block; height: 100%; background: var(--indigo-2); }
td.warn-text { color: var(--warn); font-weight: 600; }
tr.sel td { background: var(--indigo-soft); }

/* ---------- 发码漏斗 ---------- */
ol.funnel { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
ol.funnel li { position: relative; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); }
ol.funnel li b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
ol.funnel li span { font-size: 12.5px; color: var(--ink-2); }
ol.funnel li em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--ink); }
td.browser { min-width: 220px; }
ol.blog { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; display: grid; gap: 2px; min-width: 260px; }
ol.blog time { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }

/* ---------- 邮件自动化 ---------- */
.text-in { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; }
.field.wide { grid-template-columns: 1fr; }
.field.wide .text-in { grid-column: 1 / -1; }
select { padding: 6px 8px; border: 1px solid var(--rule-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.flow { display: grid; gap: 12px; }
.flow-start { justify-self: start; padding: 10px 14px; border-radius: var(--r); background: var(--indigo-soft); font-weight: 600; }
.flow-start em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-2); }
.flow-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px;
  padding-left: 18px; border-left: 2px solid var(--indigo-soft); }
.branch { border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; background: var(--surface); }
.branch .cond { font-weight: 600; margin-bottom: 8px; }
.branch ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.branch ol b { color: var(--ink); margin-right: 6px; }
.branch li.off { color: var(--muted); }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tpl-fields { display: grid; gap: 12px; }
.tpl-fields label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
.tpl-fields textarea { width: 100%; box-sizing: border-box; min-height: 520px; padding: 10px; border: 1px solid var(--rule-2);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 12.5px/1.5 var(--mono); resize: vertical; tab-size: 2; }
.tpl-help pre { white-space: pre-wrap; font: 12px/1.6 var(--mono); color: var(--ink-2); margin: 8px 0 0; }
.tpl-help summary { cursor: pointer; color: var(--indigo); font-size: 13px; }
.tpl-preview { position: sticky; top: 14px; }
.pv-frame { background: #f1efe9; padding: 12px; display: flex; justify-content: center; overflow: auto; max-height: 72vh; }
.pv-frame iframe { width: 600px; max-width: 100%; height: 70vh; border: 0; background: #fff; }
@media (max-width: 1100px) { .tpl-edit { grid-template-columns: 1fr; } .tpl-preview { position: static; } }

/* ---------- 转化实验 ---------- */
.exp-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.exp-desc p { margin: 0 0 8px; line-height: 1.65; }
.exp-cfg { display: grid; gap: 8px; align-content: start; }
@media (max-width: 900px) { .exp-body { grid-template-columns: 1fr; } }

/* ---------- 邮件联系人 ---------- */
.bulkbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 18px; background: var(--indigo-soft); border-bottom: 1px solid var(--rule); }
.bulkbar .sep { width: 1px; height: 22px; background: var(--rule-2); margin: 0 4px; }
.bulkbar label { display: inline-flex; gap: 5px; align-items: center; }
table.contacts td { vertical-align: top; }
th.chk, td.chk { width: 34px; padding-right: 0; }
.st-cart-t { color: var(--st-cart); font-weight: 600; }
.custom-box { border-bottom: 1px solid var(--rule); background: var(--surface-2, #fafbfc); }
.custom-mail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.custom-mail label { display: grid; gap: 5px; font-size: 13px; }
.custom-mail .cm-wide { grid-column: 1 / -1; }
.custom-mail textarea { width: 100%; font: inherit; }
.cm-row { display: flex; gap: 8px; }
@media (max-width: 760px) { .custom-mail { grid-template-columns: 1fr; } }
.ct-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .ct-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 44px; }
.hours i { flex: 1; background: var(--indigo-2); border-radius: 2px 2px 0 0; min-height: 1px; opacity: .85; }
.hours-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.kind-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.kind-tabs label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--rule-2);
  border-radius: 999px; cursor: pointer; font-size: 13px; }
.kind-tabs label:has(input:checked) { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); }
.kind-tabs input { accent-color: var(--indigo); }
.ai-box textarea { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 12px; }
.mail-row { padding: 9px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 3px; }
.mail-row:last-child { border-bottom: 0; }
.ct-grid .custom-mail { grid-template-columns: 1fr; }
.ct-grid .cm-row select { flex: 1; min-width: 0; }
.kind-tabs label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ---------- 邮件自动化:设置步骤 ---------- */
ol.steps { list-style: none; margin: 0; padding: 4px 18px 8px; counter-reset: st; }
ol.steps > li { position: relative; counter-increment: st; padding: 16px 0 16px 46px; border-bottom: 1px solid var(--rule); }
ol.steps > li:last-child { border-bottom: 0; }
ol.steps > li::before { content: counter(st); position: absolute; left: 0; top: 14px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--indigo-soft); color: var(--indigo); }
ol.steps > li.done::before { content: "✓"; background: var(--ok-soft, #e3f4ea); color: var(--ok, #1f7a4a); }
.step-h { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 14.5px; }
ol.steps p { margin: 4px 0 10px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline-form .text-in { max-width: 320px; }
.ev-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
ol.sub { margin: 6px 0 10px; padding-left: 20px; line-height: 1.75; }
details.adv summary, ol.steps details summary { cursor: pointer; color: var(--indigo); }
