/* ==========================================================================
   Facebook 半挂车线索 CRM · 设计系统
   重设计 2026-10：排版 / 留白 / 层级 / 色彩 / 动效 / 微交互 / 响应式
   ========================================================================== */

:root {
  color-scheme: light;

  /* 色彩令牌 */
  --bg: #eceff4;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #101a2c;
  --ink-2: #33415c;
  --muted: #67748e;
  --line: #e2e8f0;
  --line-strong: #c9d3e0;

  --brand: #1877f2;
  --brand-strong: #0d63d8;
  --brand-soft: #e9f1fe;
  --brand-ring: rgba(24, 119, 242, .16);

  --danger: #c03228;
  --whatsapp: #0c7a4d;
  --whatsapp-bg: #effaf4;

  /* 跟进状态语义色（前景 / 底 / 标识点） */
  --new-fg: #8a5a00;  --new-bg: #fdf0d3;  --new-dot: #d97706;
  --fol-fg: #0b5ed7;  --fol-bg: #e3edff;  --fol-dot: #2b7de9;
  --qua-fg: #0e7490;  --qua-bg: #d3f3fa;  --qua-dot: #06b6d4;
  --quo-fg: #6d28d9;  --quo-bg: #ece8fd;  --quo-dot: #8b5cf6;
  --won-fg: #15803d;  --won-bg: #dbf4e4;  --won-dot: #22c55e;
  --inv-fg: #b42318;  --inv-bg: #fde4e1;  --inv-dot: #ef4444;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* 圆角 / 阴影 / 动效 */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 22px;
  --sh-sm: 0 1px 2px rgba(16, 26, 44, .05);
  --sh-md: 0 1px 2px rgba(16, 26, 44, .04), 0 10px 28px -14px rgba(16, 26, 44, .18);
  --sh-lg: 0 2px 8px rgba(16, 26, 44, .06), 0 32px 80px -28px rgba(16, 26, 44, .32);
  --ease: cubic-bezier(.22, .68, .32, 1);
  --spring: cubic-bezier(.34, 1.35, .44, 1);
  --t-fast: 130ms;  --t-mid: 200ms;  --t-slow: 300ms;

  font-family: var(--font);
  font-size: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 85% -10%, rgba(24, 119, 242, .07), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(20, 184, 166, .05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 21px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 4px; }
h2 { font-size: 22px; font-weight: 740; letter-spacing: -.015em; margin-bottom: 6px; }
h3 { font-size: 15px; font-weight: 680; margin-bottom: 14px; }
p  { line-height: 1.7; }

/* ---------------- 按钮 / 输入 ---------------- */

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

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink-2);
  font-weight: 560; line-height: 1.3; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
button:hover, .button:hover {
  border-color: var(--brand); color: var(--brand-strong);
  background: var(--brand-soft);
  transform: translateY(-1px); box-shadow: var(--sh-sm);
}
button:active, .button:active { transform: translateY(0); box-shadow: none; }
button:disabled { opacity: .5; cursor: wait; transform: none; box-shadow: none; }

button.primary, .primary {
  background: linear-gradient(180deg, #2b86f5, var(--brand) 55%, #0f6ae0);
  border-color: #0f6ae0; color: #fff; font-weight: 640;
  box-shadow: 0 1px 2px rgba(13, 99, 216, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
button.primary:hover, .primary:hover {
  background: linear-gradient(180deg, #3a90f7, #1a7bf3 55%, #0d63d8);
  border-color: #0d63d8; color: #fff;
  box-shadow: 0 6px 18px -6px rgba(13, 99, 216, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
}

button > svg, .button > svg { width: 15px; height: 15px; flex-shrink: 0; }

input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fbfcfe; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #aebccf; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3.5px var(--brand-ring);
}
input:focus, select:focus, textarea:focus,
button:focus, .button:focus { outline: none; }
textarea { resize: vertical; }
::placeholder { color: #8b95a5; opacity: 1; }
input[type="checkbox"] {
  width: 17px; height: 17px; min-height: 0; accent-color: var(--brand); cursor: pointer;
}

label { display: grid; gap: 7px; font-size: 12.5px; font-weight: 560; color: var(--ink-2); }

button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand-ring); outline-offset: 2px; border-radius: 6px;
}

.muted, .fine { color: var(--muted); }
.fine { font-size: 12px; line-height: 1.6; }
.error { color: var(--danger); }

/* ---------------- 顶部toast ---------------- */

.message {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 100; max-width: calc(100vw - 24px);
  display: flex; align-items: center; gap: 9px;
  padding: 11px 18px 11px 15px; border-radius: 999px;
  border: 1px solid #bcd6f8; background: rgba(240, 247, 255, .92);
  color: var(--ink-2); font-weight: 560; font-size: 13px;
  box-shadow: var(--sh-md); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toast-in var(--t-slow) var(--spring);
}
.message::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); flex-shrink: 0;
}
.message.is-error { background: rgba(255, 243, 241, .94); border-color: #efc4bf; color: var(--danger); }
.message.is-error::before { background: var(--inv-dot); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px) scale(.96); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ---------------- 品牌标识 ---------------- */

.brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #2f8bf6, #0d63d8);
  box-shadow: 0 4px 12px -3px rgba(13, 99, 216, .5), inset 0 1px 0 rgba(255, 255, 255, .25);
  color: #fff;
}
.brand-mark svg { width: 24px; height: 24px; }

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

.login-view {
  position: relative; overflow: hidden;
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background: linear-gradient(160deg, #0a1830 0%, #0e2547 48%, #0a1830 100%);
}
/* 极光氛围层 */
.login-view::before {
  content: ""; position: absolute; inset: -12%;
  background:
    radial-gradient(640px 340px at 72% 18%, rgba(43, 134, 245, .34), transparent 62%),
    radial-gradient(560px 340px at 18% 82%, rgba(20, 184, 166, .22), transparent 60%),
    radial-gradient(900px 500px at 50% 115%, rgba(99, 102, 241, .16), transparent 65%);
  animation: aurora 16s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes aurora {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2.5%, 2%, 0) scale(1.07); }
}
/* 网格纹理层（中心清晰、边缘消散） */
.login-view::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(72% 62% at 50% 42%, #000 25%, transparent 78%);
  mask-image: radial-gradient(72% 62% at 50% 42%, #000 25%, transparent 78%);
}
.login-panel {
  position: relative; z-index: 1;
  width: 424px; max-width: 100%;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r-xl);
  background: #fff; padding: 36px 36px 26px;
  box-shadow: 0 2px 6px rgba(2, 10, 26, .22),
              0 60px 130px -24px rgba(2, 10, 26, .8),
              0 0 100px -20px rgba(43, 134, 245, .5);
  animation: panel-in 460ms var(--spring);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-panel .brand-mark {
  width: 54px; height: 54px; border-radius: 15px; margin-bottom: 18px;
  box-shadow: 0 8px 20px -5px rgba(13, 99, 216, .55), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.login-panel .brand-mark svg { width: 35px; height: 35px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  color: var(--brand-strong); margin-bottom: 9px;
}
.login-panel h1 { font-size: 23px; }
.login-panel > .muted { font-size: 13px; margin-bottom: 2px; }
.login-panel label { margin: 13px 0 0; }
.login-panel input { min-height: 43px; border-radius: 11px; background: #fff; }
.login-panel > .primary {
  width: 100%; min-height: 45px; margin-top: 20px; border-radius: 11px; font-size: 15px;
}
.login-panel .fine { margin: 16px 0 0; text-align: center; }
.login-features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 22px 0 0; padding: 15px 2px 0; border-top: 1px dashed var(--line-strong);
}
.login-features span {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-2); text-align: center; line-height: 1.45;
}
.login-features svg { width: 20px; height: 20px; color: var(--brand); }
#login-error { margin: 12px 0 0; font-size: 12.5px; }

/* 短视口紧凑模式：保证一屏内完整呈现 */
@media (max-height: 780px) {
  .login-panel { padding: 26px 30px 20px; }
  .login-panel .brand-mark { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 13px; }
  .login-panel .brand-mark svg { width: 26px; height: 26px; }
  .login-panel h1 { font-size: 21px; }
  .login-panel label { margin: 11px 0 0; }
  .login-panel input { min-height: 40px; }
  .login-panel > .primary { min-height: 42px; margin-top: 16px; }
  .login-features { margin-top: 16px; padding-top: 12px; }
}
@media (max-height: 640px) {
  .login-features { display: none; }
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: 68px; padding: 12px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
}
.brand { display: flex; gap: 13px; align-items: center; }
.brand h1 { font-size: 17px; }
.brand .muted { font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
#current-user {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px 6px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
#current-user::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(145deg, #2f8bf6, #0d63d8);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}
#logout { min-height: 34px; padding: 6px 13px; font-size: 12.5px; }

/* ---------------- 页面骨架 ---------------- */

.page { padding: 26px 30px 40px; max-width: 1680px; margin: auto; }
.page-title { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 20px; }
.page-title h2 { font-size: 24px; }
.page-title p { margin-bottom: 0; font-size: 12.5px; max-width: 640px; }
.meta-item { display: inline-block; }
.meta-item + .meta-item::before { content: "·"; margin: 0 7px; color: var(--line-strong); }
.action-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.action-grid > button { border-radius: 10px; }

@media (max-width: 1500px) {
  .page-title { flex-direction: column; align-items: flex-start; gap: 15px; }
  .page-title > .action-grid { width: 100%; }
}

/* ---------------- 统计卡片 ---------------- */

.stats {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 20px;
}
.stat {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px 15px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); cursor: pointer; overflow: hidden;
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease),
              border-color var(--t-mid) var(--ease), opacity var(--t-mid) var(--ease);
}
.stat::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 3px;
  background: var(--stat-dot, var(--line-strong));
  opacity: 0; transition: opacity var(--t-mid) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.stat:hover::after { opacity: .65; }
.stat.is-active {
  border-color: var(--stat-dot, var(--brand));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--stat-dot, var(--brand)) 22%, transparent);
}
.stat.is-active::after { opacity: 1; }
.stat.is-zero { opacity: .52; }
.stat.is-zero:hover, .stat.is-zero.is-active { opacity: 1; }
.stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px;
  background: var(--stat-bg, var(--surface-2)); color: var(--stat-fg, var(--ink-2));
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-body { display: grid; gap: 3px; min-width: 0; }
.stat-label { font-size: 11.5px; font-weight: 560; color: var(--muted); white-space: nowrap; }
.stat strong {
  font-size: 24px; font-weight: 760; letter-spacing: -.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}

/* ---------------- 面板 / 筛选 ---------------- */

.panel {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--sh-sm); overflow: hidden;
}
.filters {
  display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 16px;
  padding: 18px 20px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.check-label { display: flex; align-items: center; gap: 8px; }
.filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.filter-actions > button { flex: 1; }

.table-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 20px; color: var(--muted); font-size: 12.5px; position: relative;
}
.table-toolbar details { z-index: 4; }
summary {
  cursor: pointer; font-weight: 600; color: var(--ink-2); line-height: 2;
  padding: 4px 10px; border-radius: 8px; list-style: none;
  transition: background var(--t-fast) var(--ease);
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "▸"; margin-right: 6px; font-size: 11px; color: var(--muted);
  transition: transform var(--t-fast) var(--ease); display: inline-block;
}
details[open] > summary::before { transform: rotate(90deg); }
summary:hover { background: var(--surface-2); }
#column-options {
  position: absolute; right: 20px; top: 50px;
  width: 390px; max-width: calc(100vw - 64px);
  padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-lg);
  display: grid; grid-template-columns: 1fr 1fr; gap: 11px;
  animation: pop-in var(--t-mid) var(--spring);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.table-scroll { overflow-x: auto; }
.table-scroll::-webkit-scrollbar { height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: #cfd8e4; border-radius: 8px; border: 2px solid #f1f4f8; }
.table-scroll::-webkit-scrollbar-track { background: #f1f4f8; }

table { border-collapse: collapse; width: 100%; text-align: left; }
thead tr { background: var(--surface-2); }
th { font-weight: 600; white-space: nowrap; border-block: 1px solid var(--line); }
th > button {
  border: 0; background: transparent; border-radius: 0; padding: 13px 12px;
  font-size: 12px; font-weight: 640; letter-spacing: .02em; color: var(--muted);
  box-shadow: none !important; transform: none !important;
}
th > button:hover { color: var(--brand-strong); background: transparent; border-color: transparent; }
th > span {
  display: inline-block; padding: 13px 12px;
  font-size: 12px; font-weight: 640; letter-spacing: .02em; color: var(--muted);
}

td {
  padding: 13px 12px; border-bottom: 1px solid #eef1f6;
  font-size: 13px; min-width: 110px; max-width: 300px; overflow-wrap: anywhere;
  color: var(--ink-2);
}
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover { background: #f5f9ff; }
td.literal { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 150px; color: var(--ink); }
td.source-form { min-width: 185px; max-width: 260px; }

.form-tag {
  display: inline-block; max-width: 100%; padding: 5px 10px;
  border: 1px solid #c9ddf8; border-radius: 8px;
  background: #eef5ff; color: #1c5cb8;
  font-size: 12px; font-weight: 560; line-height: 1.55;
  white-space: normal; overflow-wrap: anywhere;
}
.card-form { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin: 12px 0 0; min-width: 0; }
.form-label { font-size: 11px; color: var(--muted); }

/* 行内操作 */
.row-actions { display: flex; gap: 7px; align-items: center; }
.row-actions button, .row-actions .button { font-size: 12px; padding: 7px 11px; min-height: 33px; border-radius: 8px; }
.whatsapp { color: var(--whatsapp); border-color: #b7e0cb; background: var(--whatsapp-bg); font-weight: 620; }
.whatsapp:hover { background: #dcf3e7; border-color: #8fd0ae; color: #085c3a; }

/* ---------------- 状态徽章（点 + 文字） ---------------- */

.badge {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px !important; font-weight: 640 !important;
  min-height: 28px !important; padding: 4px 11px !important;
  border-radius: 999px !important;
  border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: currentColor;
}
.badge:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); filter: saturate(1.15); }

.status-new       { background: var(--new-bg); color: var(--new-fg); border-color: color-mix(in srgb, var(--new-dot) 32%, transparent); }
.status-following { background: var(--fol-bg); color: var(--fol-fg); border-color: color-mix(in srgb, var(--fol-dot) 32%, transparent); }
.status-qualified { background: var(--qua-bg); color: var(--qua-fg); border-color: color-mix(in srgb, var(--qua-dot) 34%, transparent); }
.status-quoted    { background: var(--quo-bg); color: var(--quo-fg); border-color: color-mix(in srgb, var(--quo-dot) 32%, transparent); }
.status-won       { background: var(--won-bg); color: var(--won-fg); border-color: color-mix(in srgb, var(--won-dot) 34%, transparent); }
.status-invalid   { background: var(--inv-bg); color: var(--inv-fg); border-color: color-mix(in srgb, var(--inv-dot) 32%, transparent); }

/* ---------------- 骨架屏 ---------------- */

.skeleton-row td { padding: 14px 12px; }
.skeleton {
  display: block; height: 13px; border-radius: 6px;
  background: linear-gradient(90deg, #edf1f6 25%, #f7fafd 50%, #edf1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  from { background-position: 180% 0; }
  to   { background-position: -20% 0; }
}

/* ---------------- 分页 ---------------- */

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 20px; flex-wrap: wrap;
}
.pagination label { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pagination select { width: 92px; }
.page-buttons { display: flex; align-items: center; gap: 5px; }
.page-buttons button { min-width: 35px; padding: 7px 10px; border-radius: 9px; font-variant-numeric: tabular-nums; }
.page-buttons button.primary { font-weight: 700; }
.page-buttons span { color: var(--muted); padding: 0 3px; }
#jump-form { display: flex; gap: 8px; }
#jump-page { width: 68px; }

.empty { padding: 48px 40px; text-align: center; color: var(--muted); line-height: 1.8; }

/* 手机端线索卡片（桌面隐藏） */
.lead-cards { display: none; }

/* ---------------- 弹窗 ---------------- */

dialog {
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 0; width: 700px; max-width: calc(100vw - 28px); max-height: 90dvh;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-lg);
}
dialog[open] { animation: dialog-in var(--t-slow) var(--spring); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(16px) scale(.965); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
dialog::backdrop {
  background: rgba(10, 22, 40, .42);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}

.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh;
  width: 660px; max-width: 100vw; border-radius: 0; border: 0; border-left: 1px solid var(--line);
}
.drawer[open] { animation: drawer-in var(--t-slow) var(--ease); }
@keyframes drawer-in {
  from { opacity: .4; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0); }
}

.dialog-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  padding: 17px 22px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.dialog-header [data-close] {
  width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 10px;
  font-size: 0; flex-shrink: 0;
  border-color: transparent; background: var(--surface-2); color: var(--muted);
}
.dialog-header [data-close]::before { content: "✕"; font-size: 13px; }
.dialog-header [data-close]:hover {
  background: #fdeceb; border-color: transparent; color: var(--danger);
  transform: none; box-shadow: none;
}
#detail-content, #admin-content { padding: 22px; }

.detail-section { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 16px 0 22px; }
.detail-grid > div {
  min-width: 0; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid #edf1f6; border-radius: 10px;
}
dt { color: var(--muted); font-size: 11.5px; font-weight: 560; margin-bottom: 5px; }
dd { margin: 0; overflow-wrap: anywhere; line-height: 1.6; white-space: pre-wrap; color: var(--ink); }
pre {
  max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 12px; font-family: var(--mono);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 14px; border-radius: 10px;
}

#feedback-form, #note-form, #create-user { display: grid; gap: 14px; }
#note-form > button, #create-user > button { justify-self: start; }

/* 跟进记录时间线 */
.timeline article { position: relative; padding: 0 0 0 22px; margin: 18px 0; }
.timeline article::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft);
}
.timeline article::after {
  content: ""; position: absolute; left: 4px; top: 22px; bottom: -16px;
  width: 1.5px; background: var(--line);
}
.timeline article:last-child::after { display: none; }
.timeline p { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.timeline small { color: var(--muted); font-size: 12px; }

.status-banner {
  padding: 13px 15px; background: var(--brand-soft);
  border: 1px solid #c3dafa; border-radius: 10px; color: var(--ink-2); font-weight: 600;
}
.error-box {
  background: #fdf6f5; border: 1px solid #f0dcd9; border-radius: 10px;
  padding: 13px 15px; margin-bottom: 24px;
}
.error-box p { overflow-wrap: anywhere; white-space: pre-wrap; margin: 8px 0 0; }

.user-row {
  display: grid; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; margin-bottom: 13px; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.user-row:hover { border-color: var(--line-strong); box-shadow: var(--sh-sm); }
.user-row h3 { margin: 0; }
.user-row h3 small { font-weight: 500; font-size: 12px; color: var(--muted); }
.user-row button { justify-self: start; }

/* ==========================================================================
   状态切换弹窗 —— 竖向漏斗式列表（本次重设计核心）
   每个状态：彩色图标块 + 名称 + 一句话说明，当前态带对勾徽章；无效独立分区
   ========================================================================== */

.status-picker-content { padding: 14px 20px 16px; }
.status-options { display: grid; gap: 6px; margin: 10px 0 2px; counter-reset: funnel; }
.status-option:not(.status-invalid) { counter-increment: funnel; }
/* 漏斗步骤编号：前五个阶段图标右下角叠数字徽章 */
.status-option:not(.status-invalid) .status-option-icon::after {
  content: counter(funnel);
  position: absolute; right: -5px; bottom: -5px; z-index: 2;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--opt-dot, var(--brand)); color: #fff;
  font-size: 10px; font-weight: 750; line-height: 1;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(16, 26, 44, .28);
}

.status-option {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 7px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: left;
  transition: border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
/* 漏斗连接轨：前五个阶段纵向串联（z-index 提层，避免被下一行背景覆盖） */
.status-option:not(.status-invalid):not(.status-won)::after {
  content: ""; position: absolute; left: 31px; top: calc(100% + 1px); z-index: 3;
  width: 3px; height: 6px; background: #a8b5c8; border-radius: 2px;
}
.status-option:hover {
  transform: translateX(3px);
  border-color: var(--opt-dot, var(--brand));
  background: var(--opt-bg-soft, var(--surface-2));
  box-shadow: var(--sh-sm);
}
.status-option:active { transform: translateX(3px) scale(.99); }

.status-option-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
  background: var(--opt-bg, var(--surface-2)); color: var(--opt-fg, var(--ink-2));
  position: relative; z-index: 1;
}
.status-option-icon svg { width: 19px; height: 19px; }
.status-option-text { display: grid; gap: 1px; min-width: 0; flex: 1; }
.status-option-text strong { font-size: 14px; font-weight: 680; color: var(--ink); }
.status-option-text small { font-weight: 480; font-size: 12px; color: #57637a; line-height: 1.4; }
.status-option-current {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  padding: 4px 10px; border-radius: 999px;
  background: var(--opt-bg, var(--brand-soft)); color: var(--opt-fg, var(--brand-strong));
  font-size: 11.5px; font-weight: 700;
}
.status-option-current svg { width: 12px; height: 12px; }

.status-option.is-current {
  border-color: var(--opt-dot, var(--brand));
  background: var(--opt-bg-soft, var(--brand-soft));
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--opt-dot, var(--brand)) 16%, transparent);
}
.status-option.is-current:hover { transform: none; }

/* 状态主题变量（picker 选项与统计卡片共用） */
.status-new       { --opt-fg: var(--new-fg); --opt-bg: var(--new-bg); --opt-dot: var(--new-dot); --opt-bg-soft: #fffaef; }
.status-following { --opt-fg: var(--fol-fg); --opt-bg: var(--fol-bg); --opt-dot: var(--fol-dot); --opt-bg-soft: #f3f8ff; }
.status-qualified { --opt-fg: var(--qua-fg); --opt-bg: var(--qua-bg); --opt-dot: var(--qua-dot); --opt-bg-soft: #f0fbfe; }
.status-quoted    { --opt-fg: var(--quo-fg); --opt-bg: var(--quo-bg); --opt-dot: var(--quo-dot); --opt-bg-soft: #f9f6ff; }
.status-won       { --opt-fg: #ffffff; --opt-bg: linear-gradient(145deg, #22a455, #148040); --opt-dot: var(--won-dot); --opt-bg-soft: #f2fbf5; }
.status-invalid   { --opt-fg: var(--inv-fg); --opt-bg: var(--inv-bg); --opt-dot: var(--inv-dot); --opt-bg-soft: #fef5f4; }

/* 成交为实心芯片：与有效意向的青绿描边拉开层级 */
.status-won .status-option-icon { box-shadow: 0 3px 8px -2px rgba(20, 128, 64, .5), inset 0 1px 0 rgba(255, 255, 255, .25); }
.status-won .status-option-current { background: var(--won-bg); color: var(--won-fg); }

.stat-total     { --stat-fg: var(--brand-strong); --stat-bg: var(--brand-soft); --stat-dot: var(--brand); }
.stat-new       { --stat-fg: var(--new-fg); --stat-bg: var(--new-bg); --stat-dot: var(--new-dot); }
.stat-following { --stat-fg: var(--fol-fg); --stat-bg: var(--fol-bg); --stat-dot: var(--fol-dot); }
.stat-qualified { --stat-fg: var(--qua-fg); --stat-bg: var(--qua-bg); --stat-dot: var(--qua-dot); }
.stat-quoted    { --stat-fg: var(--quo-fg); --stat-bg: var(--quo-bg); --stat-dot: var(--quo-dot); }
.stat-won       { --stat-fg: #ffffff; --stat-bg: linear-gradient(145deg, #22a455, #148040); --stat-dot: var(--won-dot); }
.stat-invalid   { --stat-fg: var(--inv-fg); --stat-bg: var(--inv-bg); --stat-dot: var(--inv-dot); }

/* 无效分区 */
.status-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 2px 2px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; color: #8a94a8;
}
.status-divider::before, .status-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

#status-reason-form {
  display: none;
  margin-top: 12px; padding: 14px;
  background: #fef5f4; border: 1px dashed #efc4bf; border-radius: var(--r-md);
}
/* 仅在选中无效（原因下拉可见）时呈现 */
#status-reason-form:has(label:not([hidden])) { display: grid; gap: 12px; }
#status-picker-note { margin-bottom: 2px; }
#status-picker-note:empty { display: none; }
.status-picker-foot { margin-top: 10px; }
#status-dialog { max-height: 94dvh; }

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

@media (min-width: 1450px) {
  .filters { grid-template-columns: 2fr repeat(5, 1fr); }
  .filters .check-label, .filters .filter-actions { grid-row: 2; }
  .filters .filter-actions { grid-column: 6 / 7; }
}

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .search-label { grid-column: span 2; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .stat { padding: 12px 13px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat strong { font-size: 21px; }
}

@media (max-width: 700px) {
  .topbar { padding: 12px 15px; align-items: flex-start; }
  .topbar h1 { font-size: 15px; }
  .topbar .muted { font-size: 11px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: 7px; font-size: 11px; }
  .header-actions button { font-size: 12px; min-height: 32px; padding: 6px 10px; }
  #current-user { font-size: 11.5px; padding: 5px 11px 5px 6px; }
  #current-user::before { width: 18px; height: 18px; }

  .page { padding: 18px 12px 30px; }
  .page-title { gap: 13px; }
  .page-title h2 { font-size: 20px; }
  .page-title p { font-size: 12px; line-height: 2; }
  .meta-item + .meta-item::before { margin: 0 6px; }
  .page-title > .action-grid { width: 100%; }
  .action-grid { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .action-grid > button { white-space: normal; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stats > .stat:last-child { grid-column: span 2; }
  .stat { padding: 12px; border-radius: var(--r-md); gap: 10px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat strong { font-size: 21px; }
  .stat-label { font-size: 11px; }

  .filters { grid-template-columns: 1fr 1fr; padding: 15px; gap: 13px; }
  .search-label { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }

  .table-scroll { display: none; }
  .table-toolbar { padding: 11px 16px; font-size: 12px; }

  .lead-cards { display: grid; gap: 12px; padding: 0 12px 12px; }
  .lead-card {
    border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 15px; background: var(--surface); box-shadow: var(--sh-sm);
    animation: card-in var(--t-mid) var(--ease);
  }
  @keyframes card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .card-heading h3 { margin: 0; font-size: 16px; }
  .lead-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
  .lead-card dl > div { min-width: 0; }
  .row-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .row-actions > span { font-size: 11px; }

  .pagination { padding: 14px 12px; gap: 14px; }
  .page-buttons { flex-wrap: wrap; order: 3; width: 100%; justify-content: center; }
  .page-buttons button { padding: 7px; min-width: 32px; }

  .detail-grid { grid-template-columns: 1fr; gap: 10px; }
  .dialog-header { padding: 15px 16px; }
  #detail-content, #admin-content { padding: 16px; }
  dialog { max-height: 94dvh; }
  .drawer { width: 100%; max-height: 100dvh; }
  .empty { padding: 30px 15px; }

  .status-option { min-height: 56px; padding: 9px 12px; gap: 11px; }
  .status-option-icon { width: 34px; height: 34px; }
  .status-option-text strong { font-size: 14px; }
  .status-option-text small { font-size: 11.5px; }

  .login-panel { padding: 28px 22px; }
  .login-view { padding: 18px; }
  .login-features { gap: 4px; }
  #column-options { right: 10px; width: 340px; max-width: calc(100vw - 48px); }
}

/* ---------------- 动效偏好 ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
