:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --success: #16a34a;
  --success-50: #f0fdf4;
  --warning: #d97706;
  --warning-50: #fffbeb;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --info: #0891b2;
  --info-50: #ecfeff;
  --purple: #7c3aed;
  --purple-50: #f5f3ff;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --border: #e5e9f0;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --sidebar-w: 228px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--gray-500); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

/* ============ 登录页 ============ */
.login-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
}
.login-bg { position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.18) 0, transparent 40%),
                    radial-gradient(circle at 80% 70%, rgba(96,165,250,.25) 0, transparent 45%); }
.login-card {
  position: relative; width: 400px; padding: 40px 38px 28px;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-logo { font-size: 30px; font-weight: 700; letter-spacing: .5px; color: var(--gray-900); }
.login-logo b { color: var(--primary); font-weight: 800; }
.login-logo img { max-height: 44px; max-width: 240px; vertical-align: middle; }
.login-title { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-top: 10px; }
.login-sub { font-size: 12px; color: var(--gray-500); margin-top: 6px; }
.login-form .form-item { margin-bottom: 16px; }
.login-form label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; font-weight: 500; }
.login-form input { width: 100%; }
.login-error { color: var(--danger); font-size: 12px; min-height: 18px; margin-bottom: 6px; }
.login-foot { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 22px; }

/* ============ 布局 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--gray-900);
  display: flex; flex-direction: column; color: #cbd5e1;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo-mark img { width: 32px; height: 32px; object-fit: contain; background: #fff; }
.logo-text { font-size: 16px; font-weight: 600; color: #f1f5f9; }
.logo-text b { color: #60a5fa; }
.logo-text span { font-size: 11px; background: rgba(96,165,250,.2); color: #93c5fd; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.menu { flex: 1; overflow-y: auto; padding: 10px 0 20px; scrollbar-width: thin; }
.menu-group { padding: 14px 18px 4px; font-size: 13.5px; color: #64748b; letter-spacing: 1px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer;
  color: #94a3b8; font-size: 13.5px; transition: all .15s; border-left: 3px solid transparent;
}
.menu-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.menu-item.active { color: #fff; background: rgba(37,99,235,.22); border-left-color: #3b82f6; }
.menu-item .m-icon { width: 20px; text-align: center; font-size: 15px; }
.menu-item .m-caret { margin-left: auto; font-size: 13px; color: #64748b; transition: transform .15s; }
.menu-parent.open .m-caret { transform: rotate(180deg); }
.menu-parent-item { justify-content: flex-start; }
.menu-sub { overflow: hidden; }
.menu-sub-item { padding-left: 42px; font-size: 13.5px; color: #7d8ba1; }
.menu-sub-item .m-icon { width: 16px; font-size: 15px; }
.menu-sub-item.active { color: #fff; background: rgba(37,99,235,.22); border-left-color: #3b82f6; }

/* ---- 一级 / 二级菜单层级强化 ---- */
.menu-item:not(.menu-sub-item) { font-weight: 600; font-size: 14px; color: #dbe4ee; letter-spacing: .3px; }
.menu-item:not(.menu-sub-item) .m-icon {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  background: rgba(148,163,184,.16); border-radius: 6px; font-size: 14px;
}
.menu-item:not(.menu-sub-item):hover .m-icon { background: rgba(255,255,255,.16); }
.menu-item:not(.menu-sub-item).active .m-icon { background: rgba(59,130,246,.38); }
.menu-parent { margin: 4px 0; }
.menu-parent:first-child { margin-top: 0; }
.menu-parent.open > .menu-parent-item { color: #fff; background: rgba(37,99,235,.16); border-left-color: #3b82f6; }
.menu-sub { margin: 2px 0 4px 24px; border-left: 1px solid rgba(148,163,184,.22); padding-left: 6px; }
.menu-sub-item { padding-left: 18px; font-size: 13px; color: #8494a8; }
.menu-sub-item .m-icon { width: 14px; height: 14px; font-size: 12px; line-height: 14px; background: transparent; border-radius: 3px; }
.menu-sub-item:hover { color: #e2e8f0; }
.menu-sub-item.active { background: rgba(37,99,235,.2); }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #475569; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.module-crumb { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.module-crumb .crumb-sep { color: var(--gray-300); margin: 0 8px; font-weight: 400; }
.module-crumb .crumb-sub { color: var(--gray-500); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.gsearch {
  display: flex; align-items: center; gap: 8px; background: var(--gray-100);
  border: 1px solid transparent; border-radius: 8px; padding: 0 10px; height: 34px; width: 300px;
  transition: all .15s;
}
.gsearch:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); width: 360px; }
.gsearch-icon { color: var(--gray-400); font-size: 16px; }
.gsearch input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; color: var(--gray-800); }
.gsearch-kbd { font-size: 11px; color: var(--gray-400); background: #fff; border: 1px solid var(--gray-200); border-radius: 4px; padding: 1px 6px; font-family: var(--mono); }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--gray-200); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all .15s; }
.icon-btn:hover { border-color: var(--primary); background: var(--primary-50); }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 8px; }
.user-chip:hover { background: var(--gray-100); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.user-meta { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-500); }
.content { flex: 1; overflow-y: auto; padding: 20px 24px 60px; scrollbar-width: thin; }

/* ============ 搜索面板 ============ */
.search-panel {
  position: fixed; top: 62px; right: 260px; width: 460px; max-height: 520px; overflow-y: auto;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200); z-index: 300;
}
.search-panel .sp-group { padding: 10px 14px 4px; font-size: 11px; color: var(--gray-400); letter-spacing: .5px; }
.search-panel .sp-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-50); }
.search-panel .sp-item:hover { background: var(--primary-50); }
.search-panel .sp-item .sp-icon { font-size: 16px; }
.search-panel .sp-item .sp-title { flex: 1; font-size: 13px; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-panel .sp-item .sp-no { font-family: var(--mono); font-size: 11px; color: var(--gray-400); }
.search-panel .sp-item .sp-meta { font-size: 11px; color: var(--gray-500); text-align: right; }
.search-panel .sp-empty { padding: 30px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-family: var(--font); cursor: pointer; transition: all .15s;
  background: var(--gray-100); color: var(--gray-700); white-space: nowrap;
}
.btn:hover { background: var(--gray-200); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: #fff; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: 5px 8px; }

/* ============ 表单 ============ */
.input, select.input, textarea.input {
  width: 100%; padding: 7px 11px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 13px; font-family: var(--font); color: var(--gray-800); background: #fff; outline: none; transition: all .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input::placeholder { color: var(--gray-400); }
.input, select.input { height: 34px; }
textarea.input { resize: vertical; min-height: 70px; height: auto; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; }
.form-grid .col-span-2 { grid-column: span 2; }
.form-grid .col-span-3 { grid-column: span 3; }
.form-grid .col-span-4 { grid-column: span 4; }
.form-item label { display: block; font-size: 12.5px; color: var(--gray-600); margin-bottom: 5px; font-weight: 500; }
.form-item label .req { color: var(--danger); }
.form-item .hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.contact-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.contact-row .input { flex: 1; min-width: 0; }
.contact-row .chk { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--gray-600); white-space: nowrap; cursor: pointer; }
.contact-row .chk input { cursor: pointer; }
.contact-row .btn-sm { flex-shrink: 0; }
#cf_contacts { margin-bottom: 8px; }

/* ============ 跟进页签 ============ */
.fu-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.fu-tab { border: 1px solid transparent; border-bottom: none; background: transparent; padding: 8px 18px; font-size: 13.5px; color: var(--gray-500); cursor: pointer; border-radius: 6px 6px 0 0; }
.fu-tab:hover { color: var(--primary); }
.fu-tab.active { background: var(--primary-50, #eef4ff); color: var(--primary); border-color: var(--border); font-weight: 600; }
.fu-done td { opacity: .55; }
.fu-done td:not(:first-child) { text-decoration: line-through; }

/* ============ 商机照片 ============ */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px; }
.photo-cell { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fafafa; }
.photo-thumb { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--gray-100); }
.photo-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; font-size: 11.5px; }
.photo-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ============ 卡片 ============ */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--gray-100); }
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.card-title .card-sub { font-size: 12px; color: var(--gray-400); font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }

/* ============ KPI ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.kpi.k-green::before { background: var(--success); }
.kpi.k-orange::before { background: var(--warning); }
.kpi.k-red::before { background: var(--danger); }
.kpi.k-cyan::before { background: var(--info); }
.kpi.k-purple::before { background: var(--purple); }
.kpi-label { font-size: 12px; color: var(--gray-500); }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--gray-900); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--gray-500); }
.kpi-note { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.kpi-link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.kpi-link:hover { box-shadow: 0 4px 14px rgba(30, 58, 138, .12); transform: translateY(-1px); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px; background: var(--gray-50); color: var(--gray-600);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 9px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.table tbody tr:hover td { background: var(--primary-50); }
.table tbody tr.row-sel td { background: var(--primary-50); }
.table .chk-col { width: 36px; text-align: center; padding-left: 14px; padding-right: 4px; }
.table .chk-col input[type="checkbox"] { width: 15px; height: 15px; margin: 0; vertical-align: middle; accent-color: var(--primary); cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .td-actions { white-space: nowrap; text-align: right; }
.table .td-actions a { margin-left: 10px; font-size: 12.5px; }
.table .td-actions .link-danger { color: var(--danger); }
.table-empty { padding: 36px; text-align: center; color: var(--gray-400); }
.batch-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--gray-50); border-top: 1px solid var(--gray-100); font-size: 12.5px; flex-wrap: wrap; }
.batch-bar .spacer { flex: 1; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--gray-50); border-top: 1px solid var(--gray-100); font-size: 12px; color: var(--gray-600); }

/* ============ 徽章 ============ */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-blue { background: var(--primary-50); color: var(--primary-600); }
.badge-green { background: var(--success-50); color: var(--success); }
.badge-orange { background: var(--warning-50); color: var(--warning); }
.badge-red { background: var(--danger-50); color: var(--danger); }
.badge-cyan { background: var(--info-50); color: var(--info); }
.badge-purple { background: var(--purple-50); color: var(--purple); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ============ 日历打勾 ============ */
.cal { user-select: none; border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden; background: #fff; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.cal-title { font-size: 13.5px; font-weight: 600; color: var(--gray-800); }
.cal-btn { border: none; background: none; cursor: pointer; font-size: 12.5px; color: var(--gray-600); padding: 4px 10px; border-radius: 6px; }
.cal-btn:hover { background: var(--gray-100); color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px 12px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--gray-400); padding: 3px 0; }
.cal-day { text-align: center; font-size: 12.5px; padding: 6px 0; border-radius: 8px; cursor: pointer; color: var(--gray-800); }
.cal-day:hover { background: var(--primary-50); }
.cal-day.checked { background: var(--primary); color: #fff; font-weight: 600; }
.cal-day.checked:hover { background: var(--primary-600); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-day.checked.today { box-shadow: none; }
.cal-day.other { color: var(--gray-300); pointer-events: none; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--gray-100); font-size: 12px; color: var(--gray-500); }

/* ============ 筛选栏 ============ */
.filter-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; flex-wrap: wrap; }
.filter-bar .input, .filter-bar select.input { width: auto; min-width: 160px; }
.filter-bar .spacer { flex: 1; }
.filter-bar .filter-label { font-size: 12px; color: var(--gray-500); }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gray-200); padding: 0 14px; background: #fff; }
.tab { padding: 12px 16px; font-size: 13px; color: var(--gray-600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .tab-count { background: var(--primary-50); color: var(--primary-600); border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 500; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s; }
.modal-box { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 760px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; animation: slideUp .18s; }
.modal-box.modal-sm { width: 420px; }
.modal-box.modal-md { width: 600px; }
.modal-box.modal-lg { width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--gray-100); }
.modal-head h3 { font-size: 15px; color: var(--gray-900); }
.modal-x { border: none; background: none; font-size: 20px; color: var(--gray-400); cursor: pointer; line-height: 1; }
.modal-x:hover { color: var(--gray-700); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--gray-100); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ Toast ============ */
#toastWrap { position: fixed; top: 18px; right: 20px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--gray-900); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: slideInR .2s; max-width: 360px;
}
.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-warning { background: #b45309; }
@keyframes slideInR { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ 详情页 ============ */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.detail-title { font-size: 18px; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title .no { font-family: var(--mono); font-size: 13px; color: var(--gray-500); font-weight: 500; }
.detail-sub { font-size: 12.5px; color: var(--gray-500); margin-top: 5px; display: flex; gap: 14px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.desc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 24px; }
.desc-item .dl-label { font-size: 11.5px; color: var(--gray-400); }
.desc-item .dl-value { font-size: 13.5px; color: var(--gray-800); margin-top: 2px; font-weight: 500; }

/* ============ 时间线 ============ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--gray-200); }
.tl-item { position: relative; padding: 0 0 14px 8px; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2.5px solid var(--primary); }
.tl-item .tl-time { font-size: 11.5px; color: var(--gray-400); }
.tl-item .tl-text { font-size: 13px; color: var(--gray-700); margin-top: 2px; }

/* ============ 单据追溯链（一号通查） ============ */
.chain-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 16px; }
.chain-title-box { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 16px; }
.chain-flow { display: grid; grid-template-columns: 1fr 200px 1fr; gap: 14px; align-items: stretch; }
.chain-col { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 12px; }
.chain-col-title { font-size: 11px; color: var(--gray-400); letter-spacing: 1px; margin-bottom: 10px; }
.chain-node { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 12.5px; position: relative; }
.chain-node:last-child { margin-bottom: 0; }
.chain-arrow { font-size: 10.5px; color: var(--gray-400); margin-bottom: 3px; }
.chain-no { font-size: 12.5px; font-weight: 600; color: var(--gray-900); }
.chain-title { color: var(--gray-500); font-size: 11.5px; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chain-rel { font-size: 11px; color: var(--primary); margin-bottom: 4px; }
.chain-empty { color: var(--gray-300); font-size: 12px; text-align: center; padding: 18px 0; }
.chain-curr { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--primary-50); border: 1.5px dashed var(--primary); border-radius: 10px; padding: 16px; text-align: center; }
.chain-cur-title { font-size: 13px; color: var(--primary-600); }
.chain-cur-no { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--gray-900); margin: 6px 0 8px; }
@media (max-width: 1100px) { .chain-flow { grid-template-columns: 1fr; } }

/* ============ 客户360 布局 ============ */
.c360-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.c360-left .card { margin-bottom: 16px; }
.c360-right { min-width: 0; }
.section-card { margin-bottom: 16px; }
.section-card .card-head { background: var(--gray-50); border-radius: var(--radius) var(--radius) 0 0; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-cell { background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 8px; padding: 8px 14px; min-width: 90px; }
.stat-cell .sc-label { font-size: 11px; color: var(--gray-500); }
.stat-cell .sc-value { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-top: 2px; }

/* ============ 柱状图 ============ */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 10px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-track { width: 70%; max-width: 34px; background: var(--gray-100); border-radius: 4px 4px 0 0; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 4px; }
.bar-fill { width: 100%; border-radius: 4px 4px 0 0; transition: height .4s; }
.bar-fill.b1 { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.bar-fill.b2 { background: linear-gradient(180deg, #34d399, #059669); }
.bar-fill.b3 { background: linear-gradient(180deg, #fbbf24, #d97706); }
.bar-label { font-size: 10.5px; color: var(--gray-500); }
.bar-legend { display: flex; gap: 16px; justify-content: center; margin-top: 8px; font-size: 12px; color: var(--gray-600); }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ============ 其他 ============ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input, .toolbar select.input { width: auto; min-width: 180px; }
.toolbar .spacer { flex: 1; }
.page-title { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--gray-400); gap: 10px; }
.loading .spin { width: 18px; height: 18px; border: 2.5px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.empty { padding: 48px 20px; text-align: center; color: var(--gray-400); }
.empty .e-icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.link { color: var(--primary); cursor: pointer; font-size: 12.5px; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--danger); cursor: pointer; font-size: 12.5px; }
.money { font-variant-numeric: tabular-nums; }
.money-pos { color: var(--success); }
.money-neg { color: var(--danger); }
.divider { height: 1px; background: var(--gray-100); margin: 14px 0; }
.progress-bar { height: 6px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); border-radius: 4px; }
.progress-fill.done { background: linear-gradient(90deg, #34d399, #059669); }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-100); color: var(--primary-600); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; margin-right: 6px; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
::-webkit-scrollbar-track { background: transparent; }
.sidebar ::-webkit-scrollbar-thumb { background: #334155; }

@media (max-width: 1100px) {
  .c360-grid { grid-template-columns: 1fr; }
  .gsearch { width: 200px; }
  .gsearch:focus-within { width: 240px; }
}

/* 记事本 */
.note-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #fff; transition: all .15s; }
.note-item:hover { border-color: var(--primary); background: var(--primary-50); }
.note-item-main { min-width: 0; flex: 1; }
.note-item-title { font-size: 13px; font-weight: 600; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-date { margin-top: 2px; }
.note-item .note-del { padding: 2px 8px; font-size: 12px; }
#noteHint.hint-ok { color: var(--success); }
#noteHint.hint-err { color: var(--danger); }
#noteHint.hint-busy { color: var(--gray-500); }

/* ============ 汉堡菜单按钮（默认隐藏，手机端显示） ============ */
.menu-toggle { display: none; }

/* ============ 手机端响应式 ============ */
@media (max-width: 768px) {
  /* 汉堡按钮 */
  .menu-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: none; background: none;
    font-size: 20px; color: var(--gray-700); cursor: pointer; border-radius: 6px;
  }
  .menu-toggle:hover { background: var(--gray-100); }

  /* 侧边栏：抽屉模式 */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 600;
    transform: translateX(-100%); transition: transform .25s ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; z-index: 550; background: rgba(0,0,0,.4);
    display: block;
  }
  .sidebar-overlay.hidden { display: none; }

  /* 主区域全宽 */
  .main { width: 100%; }

  /* 顶栏 */
  .topbar { padding: 0 10px; height: 50px; }
  .topbar-left { gap: 6px; }
  .module-crumb { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 6px; }
  .gsearch { display: none; }
  .gsearch-kbd { display: none; }
  .user-meta { display: none; }
  .user-avatar { width: 32px; height: 32px; }

  /* 内容区 */
  .content { padding: 12px 10px 80px; }

  /* 登录页 */
  .login-card { width: 92vw; padding: 30px 22px 22px; border-radius: 12px; }
  .login-logo { font-size: 26px; }
  .login-title { font-size: 14px; }
  .login-sub { font-size: 11px; }

  /* 表单：4列→1列 */
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid .col-span-2,
  .form-grid .col-span-3,
  .form-grid .col-span-4 { grid-column: span 1; }

  /* KPI */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }

  /* 表格 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.table { font-size: 12px; }
  .table th, .table td { padding: 7px 10px; white-space: nowrap; }

  /* 弹窗：全宽 */
  .modal-box { width: 95vw !important; max-width: 95vw !important; max-height: 90vh; border-radius: 10px; }
  .modal-head { padding: 12px 14px; }
  .modal-head h3 { font-size: 14px; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 10px 14px; }

  /* 筛选栏 */
  .filter-bar { padding: 10px 12px; gap: 8px; }
  .filter-bar .input, .filter-bar select.input { min-width: 0; flex: 1; }

  /* 工具栏 */
  .toolbar { gap: 8px; }
  .toolbar .input, .toolbar select.input { min-width: 0; flex: 1; }

  /* 按钮 */
  .btn { padding: 8px 12px; font-size: 12.5px; }
  .btn-lg { padding: 12px 18px; font-size: 14px; }

  /* 卡片 */
  .card { margin-bottom: 12px; }
  .card-head { padding: 10px 14px; }
  .card-body { padding: 12px 14px; }

  /* 详情页 */
  .detail-title { font-size: 16px; }
  .desc-list { grid-template-columns: 1fr 1fr; gap: 8px 16px; }

  /* 客户360 */
  .c360-grid { grid-template-columns: 1fr; }

  /* 搜索面板 */
  .search-panel { top: 52px; right: 8px; left: 8px; width: auto; max-height: 400px; }

  /* Tabs */
  .tabs { padding: 0 8px; overflow-x: auto; }
  .tab { padding: 10px 12px; font-size: 12px; white-space: nowrap; }

  /* 照片网格 */
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 10px; }

  /* 单据追溯链 */
  .chain-flow { grid-template-columns: 1fr; }

  /* 联系人行 */
  .contact-row { flex-wrap: wrap; }

  /* Toast */
  #toastWrap { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: 100%; font-size: 12px; }

  /* 批量操作栏 */
  .batch-bar { padding: 8px 10px; gap: 6px; font-size: 12px; }
}

/* ============ 大屏手机 / 小平板 ============ */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .desc-list { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px 18px; }
  .login-brand { margin-bottom: 20px; }
  .login-logo { font-size: 22px; }
  .content { padding: 10px 8px 70px; }
  .topbar { padding: 0 8px; }
  .module-crumb { font-size: 12px; max-width: 90px; }
}
