:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #f97316;
  --accent-soft: #fff7ed;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --info: #0891b2;
  --info-soft: #ecfeff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }

/* ---------- 登录 ---------- */
.login-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #042f2e 0%, #0f766e 45%, #14b8a6 100%);
  padding: 20px;
}
.login-card {
  background: var(--panel); border-radius: var(--radius-xl); padding: 44px 36px; width: 100%;
  max-width: 400px; text-align: center; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 22px; margin: 0 0 8px; font-weight: 700; }
.login-sub { color: var(--text-secondary); margin: 0 0 28px; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 14px; }
#login-password {
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius); outline: none;
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
#login-password:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); background: #fff; }
#login-btn {
  padding: 13px; border: none; border-radius: var(--radius); background: var(--primary); color: #fff;
  font-weight: 600; font-size: 15px; transition: background .15s, transform .05s;
}
#login-btn:hover { background: var(--primary-dark); }
#login-btn:active { transform: translateY(1px); }
#login-btn:disabled { opacity: .65; cursor: not-allowed; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; text-align: left; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 64px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 30; box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.brand-title { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.sync-indicator {
  font-size: 12px; color: var(--text-secondary); padding: 5px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-text { background: transparent; border-color: transparent; color: var(--primary); padding: 6px 10px; font-weight: 600; }
.btn-text:hover { background: var(--primary-soft); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 13px; padding: 0; font-weight: 500; }
.icon-btn { background: none; border: none; font-size: 18px; color: var(--text-secondary); line-height: 1; padding: 4px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface); color: var(--text); }

/* ---------- 主布局 ---------- */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 20px 24px 32px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ---------- 筛选面板 ---------- */
.filter-panel { margin-bottom: 18px; }
.filter-panel-inner {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid transparent; transition: border-color .2s;
}
.filter-panel.expanded .filter-head { border-bottom-color: var(--border); }
.filter-quick { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.filter-title { font-weight: 700; font-size: 15px; white-space: nowrap; }
.filter-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.filter-summary:empty::before { content: ''; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 500;
}
.filter-chip .rm { background: none; border: none; color: inherit; font-size: 13px; padding: 0; line-height: 1; cursor: pointer; }
.filter-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; position: relative; }
#btn-toggle-filter { display: inline-flex; align-items: center; gap: 6px; }
.toggle-arrow { display: inline-block; transition: transform .25s; font-size: 11px; color: var(--primary); }
.filter-panel.expanded .toggle-arrow { transform: rotate(180deg); }

.quick-search {
  width: 200px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 20px;
  outline: none; background: var(--surface); transition: border-color .15s, box-shadow .15s, width .2s;
}
.quick-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff; width: 260px; }

.filter-body {
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height .35s ease, opacity .25s ease, padding .25s ease;
}
.filter-panel.expanded .filter-body {
  max-height: 900px; opacity: 1; padding: 10px 18px 18px;
}
.filter-row { display: flex; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.filter-row:last-child { border-bottom: none; }
.filter-row-half { gap: 24px; }
.filter-half { display: flex; align-items: flex-start; flex: 1; }
.filter-label {
  width: 110px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  padding-top: 7px; line-height: 1.4;
}
.filter-content { flex: 1; min-width: 0; }
.filter-keyword {
  width: 100%; max-width: 360px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.filter-keyword:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filter-select {
  padding: 8px 28px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; outline: none; min-width: 160px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.province-select {
  padding: 8px 28px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; outline: none; min-width: 160px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.province-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.region-filter { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-group label {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 20px; cursor: pointer; user-select: none;
  background: #fff; color: var(--text-secondary); transition: all .12s;
}
.pill-group label:hover { border-color: var(--primary); color: var(--primary); }
.pill-group input[type="checkbox"] { margin: 0; width: 14px; height: 14px; accent-color: var(--primary); }
.pill-group label.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 500; }
.city-list { max-height: 120px; overflow-y: auto; padding-right: 4px; flex: 1; min-width: 220px; }

.range-filter { display: flex; align-items: center; gap: 10px; max-width: 320px; }
.range-filter input {
  flex: 1; min-width: 80px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none;
}
.range-filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.range-sep { color: var(--text-muted); font-weight: 500; }

/* ---------- 内容卡片 ---------- */
.content-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.main-head {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
  border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap;
}
.count-info { color: var(--text-secondary); font-size: 13px; }
.count-info b { color: var(--text); }
.stats-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  font-size: 12px; color: var(--text-secondary); min-height: 40px;
}
.stats-bar:empty::before { content: '统计加载中…'; color: var(--text-muted); }
.stats-bar .stat b { color: var(--text); font-weight: 700; }
.stats-bar .stat-sep { color: var(--text-muted); }
@media (max-width: 768px) {
  .stats-bar { padding: 10px 14px; font-size: 11px; gap: 6px; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid {
  width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; font-size: 13px;
  table-layout: auto;
}
.grid thead th {
  text-align: left; padding: 13px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text-secondary); white-space: nowrap; position: sticky; top: 0; z-index: 10;
  font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
}
.grid thead th[data-sort] { cursor: pointer; user-select: none; }
.grid thead th[data-sort]:hover { color: var(--primary); }
.grid thead th[data-sort]::after { content: ' ⇅'; color: var(--text-muted); font-size: 11px; }
.grid thead th[data-sort].sort-asc::after { content: ' ↑'; color: var(--primary); }
.grid thead th[data-sort].sort-desc::after { content: ' ↓'; color: var(--primary); }
.grid tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top;
  color: var(--text-secondary); transition: background .12s;
}
.grid tbody tr:hover td { background: #fafbff; }
.grid tbody tr:last-child td { border-bottom: none; }

.col-name { min-width: 140px; max-width: 260px; }
.col-name .cell-inner { font-weight: 600; color: var(--text); word-break: break-word; }
.col-type { white-space: nowrap; }
.col-modes { min-width: 120px; }
.col-cats { min-width: 120px; }
.col-regions { min-width: 140px; }
.col-cost { white-space: nowrap; }
.col-contact { min-width: 140px; max-width: 220px; }
.col-contact .cell-inner { word-break: break-word; }
.col-risk { min-width: 120px; }
.col-status { white-space: nowrap; }
.col-time { white-space: nowrap; }
.col-actions { white-space: nowrap; width: 1%; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 12px; padding: 3px 9px; background: var(--surface); border-radius: 14px;
  color: var(--text-secondary); white-space: nowrap; border: 1px solid var(--border);
}
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-可展业 { background: var(--success-soft); color: var(--success); }
.badge-线索对接 { background: var(--info-soft); color: var(--info); }
.badge-开发中 { background: var(--warn-soft); color: var(--warn); }
.cost { font-weight: 700; color: var(--text); }
.risk-cell { display: flex; flex-direction: column; gap: 5px; }
.qual-text { font-size: 12px; color: var(--text-muted); line-height: 1.45; word-break: break-word; }
.row-actions { display: flex; gap: 6px; }
.row-actions button {
  padding: 5px 10px; font-size: 12px; border: 1px solid var(--border); background: #fff;
  border-radius: var(--radius-sm); color: var(--text-secondary); transition: all .12s;
}
.row-actions button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.row-actions .del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* 图标按钮（PC 紧凑操作列） */
.row-actions.icon-actions { flex-direction: column; gap: 4px; align-items: stretch; }
.row-actions.icon-actions button {
  width: 100%; min-height: 26px; padding: 4px 0; font-size: 15px; line-height: 1;
  border: none; background: transparent; border-radius: 6px; position: relative;
}
.row-actions.icon-actions button:hover { background: var(--primary-soft); color: var(--primary); }
.row-actions.icon-actions button.del:hover { background: var(--danger-soft); color: var(--danger); }
/* tooltip */
.row-actions.icon-actions button::after {
  content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%;
  transform: translateY(-50%) scale(.95); opacity: 0; pointer-events: none;
  background: rgba(15, 23, 42, .85); color: #fff; padding: 4px 8px; border-radius: 5px;
  font-size: 11px; white-space: nowrap; transition: all .15s; backdrop-filter: blur(4px);
}
.row-actions.icon-actions button:hover::after { opacity: 1; transform: translateY(-50%) scale(1); }
.desktop-ops { display: flex; }
.mobile-ops { display: none; }
@media (max-width: 768px) {
  .desktop-ops { display: none !important; }
  .mobile-ops { display: flex; }
}

.empty-state { padding: 64px 20px; text-align: center; color: var(--text-secondary); }
.empty-icon { font-size: 42px; margin-bottom: 12px; opacity: .7; }
.empty-state p { margin: 0; font-size: 15px; font-weight: 500; }
.empty-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px !important; }

/* ---------- 抽屉/弹窗 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; z-index: 50; }
.drawer {
  margin-left: auto; width: 540px; max-width: 100%; height: 100%; background: var(--panel);
  display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0, 0, 0, .15); animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head, .modal-head {
  display: flex; justify-content: space-between; align-items: center; padding: 18px 22px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px;
}
.drawer-head-actions { display: flex; align-items: center; gap: 8px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.drawer-body { padding: 22px; overflow-y: auto; flex: 1 1 auto; }
.drawer-foot, .modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }
.form-row { margin-bottom: 18px; }
.form-row > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.form-row input[type=text], .form-row input[type=number], .form-row select, .form-row textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row.two, .two { display: flex; gap: 14px; }
.form-row.two > div { flex: 1; }
.form-row.three, .three { display: flex; gap: 14px; }
.form-row.three > div { flex: 1; }
.sub-form {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); display: flex;
  flex-direction: column; gap: 14px;
}
.sub-form label.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; color: var(--text-secondary); }
.chip-input {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px; min-height: 44px; background: #fff;
}
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); color: var(--primary-dark); padding: 4px 10px; border-radius: 16px; font-size: 13px; }
.chip button { background: none; border: none; color: inherit; font-size: 13px; line-height: 1; padding: 0; cursor: pointer; }
.chip-input input { border: none; outline: none; flex: 1; min-width: 100px; padding: 5px; background: transparent; }
.suggest-btns { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.suggest-btns .link-btn { padding: 3px 8px; background: var(--surface); border-radius: 12px; }
.regions-box { display: flex; flex-direction: column; gap: 10px; }
.region-row { display: flex; gap: 10px; align-items: center; }
.region-row select { flex: 1; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.region-row input.region-city { flex: 1; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.region-row input.region-city:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filter-city-manual { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 170px; background: #fff; outline: none; }
.filter-city-manual:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.region-row .rm { color: var(--danger); background: none; border: none; font-size: 16px; padding: 4px; border-radius: 6px; }
.region-row .rm:hover { background: var(--danger-soft); }

.modal { background: var(--panel); border-radius: var(--radius-lg); width: 480px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; margin: auto; }
.modal-body { padding: 22px; }
.hint { color: var(--text-secondary); font-size: 13px; margin: 0 0 16px; line-height: 1.6; }
.hint code { background: var(--surface); padding: 2px 7px; border-radius: 4px; font-size: 12px; border: 1px solid var(--border); }
.import-msg { font-size: 13px; min-height: 18px; }
.import-msg.ok { color: var(--success); }
.import-msg.err { color: var(--danger); }
.draft-badge {
  display: flex; align-items: center; gap: 12px; margin: 0 0 18px;
  padding: 9px 14px; background: var(--accent-soft); border: 1px solid #fed7aa;
  border-radius: var(--radius); font-size: 13px; color: #9a3412;
}
.draft-badge .btn-text { color: var(--accent); margin-left: auto; }

/* ---------- 移动端 FAB（科技感悬浮按钮） ---------- */
.fab-wrap { position: fixed; right: 18px; bottom: 22px; z-index: 80; display: none; flex-direction: column; align-items: flex-end; pointer-events: none; }
.fab-wrap:not(.hidden) { pointer-events: auto; }
.fab-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .25);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; backdrop-filter: blur(2px);
}
.fab-wrap.open .fab-backdrop { opacity: 1; pointer-events: auto; }
.fab-menu {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  margin-bottom: 14px; transform: translateY(10px); opacity: 0; pointer-events: none;
  transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
}
.fab-wrap.open .fab-menu { transform: none; opacity: 1; pointer-events: auto; }
.fab-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 12px;
  border: none; border-radius: 28px; background: rgba(255, 255, 255, .92);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .14); backdrop-filter: blur(8px);
  transition: all .18s ease; transform: translateX(20px); opacity: 0;
}
.fab-wrap.open .fab-item { transform: none; opacity: 1; }
.fab-wrap.open .fab-item:nth-child(1) { transition-delay: 0ms; }
.fab-wrap.open .fab-item:nth-child(2) { transition-delay: 35ms; }
.fab-wrap.open .fab-item:nth-child(3) { transition-delay: 70ms; }
.fab-wrap.open .fab-item:nth-child(4) { transition-delay: 105ms; }
.fab-item:active { transform: scale(.96) !important; }
.fab-item-primary { background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; }
.fab-item-primary .fab-label { color: #fff; }
.fab-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.fab-label { color: var(--text-secondary); }
.fab-toggle {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 55%, var(--accent) 100%);
  color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .45), 0 4px 10px rgba(0, 0, 0, .2);
  transition: all .25s cubic-bezier(.34, 1.56, .64, 1); display: flex; align-items: center; justify-content: center;
}
.fab-toggle:hover { transform: scale(1.05); box-shadow: 0 10px 28px rgba(79, 70, 229, .55); }
.fab-toggle:active { transform: scale(.95); }
.fab-toggle-icon { display: inline-block; transition: transform .25s ease; }
.fab-wrap.open .fab-toggle-icon { transform: rotate(45deg); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 11px 20px; border-radius: var(--radius); font-size: 14px; z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: toastIn .2s ease;
}
.toast-err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- PC 紧凑布局（不影响移动端） ---------- */
@media (min-width: 1025px) {
  .topbar { height: 56px; padding: 0 18px; }
  .brand { width: 34px; height: 34px; font-size: 14px; border-radius: 9px; }
  .brand-title { font-size: 15px; }
  .main { padding: 14px 18px 26px; }
  .filter-panel { margin-bottom: 14px; }
  .filter-head { padding: 11px 16px; }
  .filter-row { padding: 8px 0; }
  .main-head { padding: 11px 16px; }
  .grid thead th { padding: 10px 14px; }
  .grid tbody td { padding: 10px 14px; }
  .drawer-body { padding: 18px; }
  .form-row { margin-bottom: 14px; }
  .form-row input[type=text], .form-row input[type=number], .form-row select, .form-row textarea { padding: 9px 12px; }
  .topbar-actions .btn { padding: 7px 14px; }
  /* 操作按钮 PC 端纵向紧凑图标堆叠 */
  .col-actions { width: 1%; min-width: 34px; white-space: normal; padding-left: 8px !important; padding-right: 8px !important; }
  .grid tbody td.col-actions { vertical-align: middle; }
  .row-actions { flex-direction: column; gap: 3px; align-items: stretch; }
  .row-actions button { width: 100%; text-align: center; padding: 4px 0; font-size: 15px; line-height: 1; min-height: 26px; border: none; background: transparent; border-radius: 6px; }
  .row-actions button:hover { background: var(--primary-soft); color: var(--primary); }
  .row-actions button.del:hover { background: var(--danger-soft); color: var(--danger); }
}

/* ---------- 视图导航 Tabs ---------- */
.view-nav {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 6px;
}
.view-tab {
  padding: 6px 14px; border: none; background: transparent;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; transition: all .15s;
}
.view-tab:hover { color: var(--text); background: var(--panel); }
.view-tab.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }

/* ---------- 客户金额高亮 ---------- */
.amount-pos { color: var(--success); font-weight: 700; }
.amount-neg { color: var(--danger); font-weight: 700; }
.amount-planned { color: var(--text); font-weight: 700; }

/* 逾期状态红色强调 */
.badge-逾期 { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.badge-已结清 { background: var(--success-soft); color: var(--success); }
.badge-跟进中 { background: var(--info-soft); color: var(--info); }

/* 客户表格列 */
.col-person { min-width: 90px; white-space: nowrap; }
.col-location { min-width: 100px; }
.col-funder { min-width: 120px; max-width: 180px; }
.col-funder .cell-inner { word-break: break-word; }
.col-amount { white-space: nowrap; text-align: right; }
.col-amount .cell-inner { text-align: right; }

/* 移动端样式 */
@media (max-width: 768px) {
  .view-nav { margin-right: 8px; }
  .view-tab { padding: 5px 10px; font-size: 12px; }
  .topbar-right { flex-wrap: wrap; }
}
@media (max-width: 1024px) {
  .main { padding: 16px; }
  .grid { min-width: 900px; }
}

@media (max-width: 768px) {
  .topbar { height: auto; padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .topbar-left { gap: 0; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { padding: 7px 12px; font-size: 13px; }
  .desktop-ops { display: none !important; }
  .fab-wrap { display: flex; }
  .brand { display: none; }
  .brand-text { display: none; }
  .main { padding: 12px 12px 80px; }

  .filter-head { flex-wrap: wrap; gap: 10px; }
  .filter-quick { width: 100%; }
  .filter-title { display: none; }
  .filter-actions { margin-left: auto; }
  .quick-search { width: 100%; }
  .quick-search:focus { width: 100%; }
  .btn, input, select, textarea { min-height: 40px; }

  .filter-row, .filter-row-half, .filter-half { flex-direction: column; gap: 8px; }
  .filter-label { width: auto; padding-top: 0; }
  .filter-content { width: 100%; }
  .region-filter { flex-direction: column; }
  .province-select { width: 100%; }
  .range-filter { max-width: 100%; }
  .filter-select { width: 100%; }

  .main-head { padding: 12px 14px; }

  /* 表格转卡片 */
  .table-wrap { padding: 12px; background: var(--bg); }
  .grid { min-width: 0; display: block; background: transparent; }
  .grid thead { display: none; }
  .grid tbody { display: block; }
  .grid tbody tr {
    display: block; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 12px; padding: 14px; box-shadow: var(--shadow-sm); position: relative;
  }
  .grid tbody td {
    display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 0;
    border-bottom: 1px dashed var(--border); color: var(--text-secondary);
  }
  .grid tbody td::before {
    content: attr(data-label); font-weight: 600; color: var(--text-secondary); margin-right: 16px;
    flex-shrink: 0; font-size: 12px;
  }
  .grid tbody td:last-child { border-bottom: none; }
  .grid tbody td.col-actions { position: absolute; top: 10px; right: 10px; padding: 0; border: none; justify-content: flex-end; }
  .grid tbody td.col-actions::before { display: none; }
  .grid tbody td.col-actions .row-actions { flex-direction: row; flex-wrap: nowrap; gap: 4px; align-items: center; justify-content: flex-end; width: auto; }
  .grid tbody td.col-actions .row-actions button { font-size: 12px; padding: 4px 8px; text-align: center; white-space: nowrap; }
  .grid tbody td.col-actions .mobile-ops { flex-direction: row !important; }
  .grid tbody td.col-name { display: block; font-weight: 700; font-size: 16px; color: var(--text); padding-right: 190px; border-bottom: 1px dashed var(--border); }
  .grid tbody td.col-name::before { display: none; }
  .grid tbody td.col-name .cell-inner { text-align: left; font-weight: 700; color: var(--text); }
  .col-name, .col-person, .col-location { min-width: 0; }
  .col-amount { text-align: right; }
  .col-amount::before { content: attr(data-label); }
  .col-name, .col-contact { max-width: none; }

  .drawer { width: 100%; }
  .modal { width: 92vw; }
  .form-row.two { flex-direction: column; gap: 0; }
}

@media (max-width: 480px) {
  .login-card { padding: 36px 24px; }
  .topbar-actions .btn { padding: 6px 10px; font-size: 12px; }
  .sync-indicator { display: none; }
  .filter-title { display: none; }
  .filter-chip { font-size: 11px; padding: 2px 8px; }
}

/* ========== 客户看板新增样式 ========== */

/* 导航 Tab */
.view-nav {
  display: flex; gap: 4px; margin-left: 24px; padding-left: 24px;
  border-left: 1px solid var(--border);
}
.nav-tab {
  padding: 6px 14px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; transition: all .15s;
}
.nav-tab:hover { background: var(--surface); color: var(--text); }
.nav-tab.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

/* 金额高亮 */
.money { font-weight: 700; color: var(--text); }
.money.received { color: var(--success); }
.money.unreceived { color: var(--warn); }
.money.plan { color: var(--primary); }
.stat-danger b { color: var(--danger); }

/* 客户状态徽章 */
.badge-customer-跟进中 { background: var(--info-soft); color: var(--info); }
.badge-customer-已结清 { background: var(--success-soft); color: var(--success); }
.badge-customer-逾期 { background: var(--danger-soft); color: var(--danger); }

/* 资金方选择下拉 */
.funder-select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; outline: none; font-size: 13px; min-width: 160px;
}
.funder-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 客户字段表单三列 */
.form-row.three { display: flex; gap: 14px; }
.form-row.three > div { flex: 1; }

/* 视图切换动画 */
.view-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 移动端适配 */
@media (max-width: 768px) {
  .view-nav { margin-left: 12px; padding-left: 12px; }
  .nav-tab { padding: 5px 10px; font-size: 13px; }
  .form-row.three { flex-direction: column; gap: 0; }
  .form-row.three > div { margin-bottom: 14px; }
}

/* ========== 新看板：业务跟进表格样式 ========== */

.pipeline-grid .col-num { width: 40px; text-align: center; color: var(--text-muted); font-size: 12px; }
.pipeline-grid .col-name input { width: 100%; border: none; background: transparent; font-weight: 500; }
.pipeline-grid .col-owner select,
.pipeline-grid .col-city select,
.pipeline-grid .col-funder select,
.pipeline-grid .col-blocker select { width: 100%; border: none; background: transparent; }
.pipeline-grid .col-stage { cursor: pointer; }
.pipeline-grid .col-progress textarea { width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.pipeline-grid .col-next-action { display: flex; flex-direction: column; gap: 6px; }
.pipeline-grid .next-action-wrap { display: flex; flex-direction: column; gap: 6px; }
.pipeline-grid .next-action-wrap input { width: 100%; }
.pipeline-grid .col-landing-date input,
.pipeline-grid .col-last-contact input { width: 100%; }
.pipeline-grid .col-amount input { width: 80px; text-align: right; }
.pipeline-grid .col-payment { min-width: 140px; }

/* 内联编辑控件 */
.inline-input, .inline-select, .inline-textarea, .inline-date {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.inline-input:hover, .inline-select:hover, .inline-textarea:hover, .inline-date:hover {
  border-color: var(--border);
  background: var(--surface);
}
.inline-input:focus, .inline-select:focus, .inline-textarea:focus, .inline-date:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 阶段徽章 */
.stage-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* 收款进度条 */
.payment-container { display: flex; flex-direction: column; gap: 4px; }
.payment-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.payment-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width .3s ease;
}
.payment-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 删除按钮 */
.btn-del {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.pipeline-grid tbody tr:hover .btn-del { opacity: 1; }
.btn-del:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* 可排序列 */
.grid thead th[data-sort] { cursor: pointer; user-select: none; }
.grid thead th[data-sort]:hover { color: var(--primary); }
.grid thead th[data-sort]::after { content: ' ⇅'; color: var(--text-muted); font-size: 11px; }
.grid thead th[data-sort].sort-asc::after { content: ' ↑'; color: var(--primary); }
.grid thead th[data-sort].sort-desc::after { content: ' ↓'; color: var(--primary); }

/* 表格行悬停 */
.pipeline-grid tbody tr:hover { background: var(--surface); }
.pipeline-grid tbody tr:hover td { background: transparent; }

/* 移动端适配 */
@media (max-width: 768px) {
  /* 不再强制最小宽度，改为卡片视图 */
  .pipeline-grid { display: none; }
  .btn-del { opacity: 1; }
}

/* ===================== 新看板样式 v2 ===================== */

/* 表格行高 */
.pipeline-grid tbody tr {
  min-height: 72px;
}

.pipeline-grid tbody tr.stalled {
  background-color: var(--surface-muted);
}

/* 列宽优化 */
.pipeline-grid .col-name { min-width: 180px; }
.pipeline-grid .col-stage { width: 100px; }
.pipeline-grid .col-dynamic { min-width: 200px; }
.pipeline-grid .col-landing-date { width: 120px; }
.pipeline-grid .col-amount { width: 80px; text-align: right; }
.pipeline-grid .col-owner { width: 80px; }
.pipeline-grid .col-blocker { width: 80px; }
.pipeline-grid .col-payment { width: 140px; }
.pipeline-grid .col-last-contact { width: 110px; }
.pipeline-grid .col-actions { width: 50px; }

/* 客户名称区 */
.customer-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.customer-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* 本周动态列 */
.dynamic-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.dynamic-progress {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.dynamic-next {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-label {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.next-date {
  font-size: 11px;
}

/* 日期预警 */
.date-warning {
  display: inline;
  font-size: 12px;
}

.date-empty {
  color: var(--text-muted);
}

.warning-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.warning-tag.overdue {
  background: #fee2e2;
  color: #dc2626;
}

.warning-tag.urgent {
  background: #ffedd5;
  color: #ea580c;
}

.warning-tag.warn {
  background: #fef3c7;
  color: #d97706;
}

/* 卡点标签 */
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-danger { background: #fee2e2; color: #dc2626; }
.chip-warn { background: #ffedd5; color: #ea580c; }
.chip-urgent { background: #fef3c7; color: #d97706; }
.chip-purple { background: #ede9fe; color: #7c3aed; }
.chip-info { background: #dbeafe; color: #2563eb; }
.chip-muted { background: var(--surface); color: var(--text-muted); }

/* 收款进度条 */
.payment-text {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.payment-pct {
  color: var(--text-muted);
  font-weight: 500;
}

.payment-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* 操作菜单 */
.action-menu {
  position: relative;
  display: inline-block;
}

.btn-more {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.btn-more:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 120px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 9999;
  padding: 4px 0;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--surface);
}

.dropdown-item.danger {
  color: #dc2626;
}

.dropdown-item.danger:hover {
  background: #fee2e2;
}

/* 统计栏 */
.stats-breakdown {
  margin-left: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* 本周待办按钮激活状态 */
.btn-weekly-todo {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}

.btn-weekly-todo.active {
  background: var(--warn);
  color: #fff;
  border-color: var(--warn);
}

.btn-weekly-todo:hover {
  background: var(--warn-soft);
}

/* ===================== 新看板列宽样式 ===================== */
.pipeline-grid .col-num { width: 40px; min-width: 40px; max-width: 40px; text-align: center; }
.pipeline-grid .col-name { min-width: 140px; }
.pipeline-grid .col-stage { min-width: 90px; }
.pipeline-grid .col-dynamic { min-width: 320px; }
.pipeline-grid .col-landing-date { min-width: 110px; }
.pipeline-grid .col-amount { min-width: 80px; }
.pipeline-grid .col-owner { min-width: 80px; }
.pipeline-grid .col-blocker { min-width: 60px; }
.pipeline-grid .col-payment { min-width: 150px; }
.pipeline-grid .col-last-contact { min-width: 110px; }
.pipeline-grid .col-actions { min-width: 60px; max-width: 60px; }

/* 列设置面板 */
.column-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.column-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.column-panel {
  position: fixed;
  top: 0;
  left: 0;
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 12px;
  min-width: 340px;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
}
.column-panel.hidden {
  display: none;
}
.column-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.column-panel-title {
  grid-column: 1 / -1;
}
.column-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  cursor: pointer;
  white-space: nowrap;
}
.column-item:hover {
  color: var(--primary);
}
.column-item input[type="checkbox"] {
  cursor: pointer;
}

/* 新看板列宽样式 */
.pipeline-grid .col-num { width: 40px; min-width: 40px; max-width: 40px; }
.pipeline-grid .col-name { min-width: 140px; }
.pipeline-grid .col-stage { min-width: 90px; }
.pipeline-grid .col-dynamic { min-width: 320px; }
.pipeline-grid .col-landing-date { min-width: 110px; }
.pipeline-grid .col-amount { min-width: 80px; }
.pipeline-grid .col-owner { min-width: 80px; }
.pipeline-grid .col-blocker { min-width: 60px; }
.pipeline-grid .col-payment { min-width: 150px; }
.pipeline-grid .col-last-contact { min-width: 110px; }
.pipeline-grid .col-actions { min-width: 60px; max-width: 60px; }

.col-hidden { display: none !important; }

/* ===================== 预设数据配置面板 ===================== */
.preset-drawer { max-width: 520px; }
.preset-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.preset-group { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--border); }
.preset-group:last-child { border-bottom: none; }
.preset-group-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.preset-values { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.preset-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
}
.preset-chip-del {
  border: none; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.preset-chip-del:hover { color: var(--danger); }
.preset-add-row { display: flex; gap: 8px; }
.preset-add-input {
  flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none;
}
.preset-add-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ===================== 资金方多选 ===================== */
.funder-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.funder-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  transition: all .15s;
  user-select: none;
}
.funder-check:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.funder-check input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}
.funder-check:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 500;
}

/* ===================== 本月收款展示 ===================== */
.payment-month {
  margin-top: 6px;
  font-size: 12px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 3px 8px;
  display: inline-block;
  white-space: nowrap;
}
.payment-month b {
  color: var(--success);
  font-weight: 700;
}
/* ===================== 移动端优化 v1 ===================== */

/* 卡片视图容器（默认隐藏） */
.pipeline-cards {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px;
}

.pipeline-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 2px 8px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.02);
  transition: all .2s ease;
}

.pipeline-card:active {
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
}

.pipeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

.pipeline-card-name {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  letter-spacing: -0.2px;
}

.pipeline-card-stage {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.pipeline-card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pipeline-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  gap: 10px;
}

.pipeline-card-label {
  color: #94a3b8;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
}

.pipeline-card-value {
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}

.pipeline-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,.06);
  gap: 8px;
}

.pipeline-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 下一步行动行 */
.pipeline-card-action {
  border-top: 1px dashed rgba(0,0,0,.08);
  margin-top: 6px;
  padding-top: 10px;
}
.pipeline-card-action .pipeline-card-value {
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
}

/* 移动端筛选面板优化 */
@media (max-width: 768px) {
  /* 隐藏桌面表格，显示卡片视图 */
  .pipeline-grid {
    display: none !important;
  }
  .pipeline-cards {
    display: flex !important;
    margin-top: 12px;
  }

  /* 筛选面板折叠 */
  #customer-filter-panel {
    position: relative;
  }
  .filter-panel-inner {
    display: none;
  }
  .filter-panel.expanded .filter-panel-inner {
    display: block;
  }

  /* 筛选按钮固定底部 */
  .filter-toggle-mobile {
    display: flex !important;
  }

  /* 顶部栏优化 */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
  }

  /* 移动端编辑弹窗全屏 */
  .editor-mask {
    background: #fff !important;
    align-items: flex-start !important;
  }
  .editor-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
  }

  /* 按钮点击区域扩大 */
  .btn, button, .pipeline-card-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }

  /* 金额显示优化 */
  .money {
    font-size: 16px;
    font-weight: 700;
  }

  /* 预警标签紧凑 */
  .date-warning, .warning-tag {
    font-size: 11px;
    padding: 2px 6px;
  }

  /* 统计栏换行 */
  .stats-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .stats-bar .stat-item {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
  }
}

/* 桌面端隐藏移动端元素 */
.filter-toggle-mobile {
  display: none;
}

/* 小屏手机优化 */
@media (max-width: 480px) {
  .pipeline-card {
    padding: 12px;
  }
  .pipeline-card-name {
    font-size: 14px;
  }
  .pipeline-card-value {
    font-size: 12px;
  }
  .pipeline-card-stage {
    font-size: 11px;
    padding: 2px 8px;
  }
}


/* 卡片编辑按钮样式 */
.pipeline-card-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--primary-soft);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}
.pipeline-card-edit-link:hover {
  background: #dbeafe;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59,130,246,.15);
}

/* 日期输入框美化 */
.form-row input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all .15s;
  min-height: 44px;
}
.form-row input[type="date"]:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.form-row input[type="date"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
.form-row input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
}
.form-row input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
