/* ============================
   CRM Pro - Professional UI
   ============================ */

:root {
  --primary: #4f46e5; --primary-hover: #4338ca; --primary-light: #eef2ff;
  --success: #10b981; --success-light: #d1fae5;
  --warning: #f59e0b; --warning-light: #fef3c7;
  --danger: #ef4444; --danger-light: #fee2e2;
  --info: #3b82f6; --info-light: #dbeafe;
  --sidebar-bg: #1e293b; --sidebar-hover: #334155; --sidebar-active: #4f46e5;
  --bg: #f1f5f9; --card-bg: #fff; --border: #e2e8f0;
  --text: #1e293b; --text-secondary: #64748b; --text-muted: #94a3b8;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.08); --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --sidebar-w: 10.5rem;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 13px; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.empty-state { text-align:center; color:var(--text-muted); padding:40px; }
.text-muted { color:var(--text-muted); font-size:12px; }
.loading-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:10000; }
.loading-spinner { text-align:center; }
.loading-spinner i { font-size:40px; color:var(--primary); }
.loading-spinner p { margin-top:12px; color:var(--text-secondary); }

/* ====== Login Page ====== */
.login-page { display:flex; align-items:center; justify-content:center; min-height:100vh; background: linear-gradient(135deg, #1e293b 0%, #4f46e5 50%, #7c3aed 100%); }
.login-wrapper { width:100%; max-width:400px; padding:20px; }
.login-card { background:#fff; border-radius:16px; padding:36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-header { text-align:center; margin-bottom:28px; }
.login-logo { width:56px; height:56px; margin:0 auto 14px; background: linear-gradient(135deg, #4f46e5, #7c3aed); border-radius:14px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:24px; }
.login-header h1 { font-size:22px; font-weight:700; color:var(--text); }
.login-header p { color:var(--text-secondary); margin-top:4px; font-size:13px; }
.login-form .form-group { margin-bottom:16px; }
.login-form label { display:block; font-size:12px; font-weight:600; color:var(--text-secondary); margin-bottom:5px; }
.login-form label i { width:14px; color:var(--primary); }
.login-form input { width:100%; padding:9px 12px; border:1.5px solid var(--border); border-radius:var(--radius); font-size:13px; transition: border-color .2s, box-shadow .2s; outline:none; }
.login-form input:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.login-error { background:var(--danger-light); color:var(--danger); padding:8px 12px; border-radius:var(--radius); margin-bottom:14px; font-size:12px; }
.login-success { background:var(--success-light); color:#065f46; padding:8px 12px; border-radius:var(--radius); margin-bottom:14px; font-size:12px; }
.login-footer { text-align:center; margin-top:20px; font-size:11px; color:var(--text-muted); }
.login-footer code { background:var(--bg); padding:2px 6px; border-radius:4px; font-size:11px; }

/* ====== Layout ====== */
.app-layout { display:flex; min-height:100vh; }
.sidebar { width:var(--sidebar-w); background:var(--sidebar-bg); color:#fff; display:flex; flex-direction:column; position:fixed; top:0; left:0; bottom:0; z-index:100; transition: transform .3s; }
.sidebar-brand { padding:16px; display:flex; align-items:center; gap:10px; border-bottom:1px solid rgba(255,255,255,.1); }
.sidebar-brand .brand-icon { width:36px; height:36px; background:var(--primary); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:16px; }
.sidebar-brand .brand-text h2 { font-size:14px; font-weight:700; }
.sidebar-brand .brand-text span { font-size:10px; color:#94a3b8; }
.sidebar-nav { flex:1; padding:8px 6px; overflow-y:auto; scrollbar-width:none; }
.sidebar-nav::-webkit-scrollbar { display:none; }
.sidebar-nav .nav-section { font-size:9px; text-transform:uppercase; color:#64748b; padding:10px 12px 4px; letter-spacing:1px; font-weight:600; cursor:pointer; user-select:none; display:flex; align-items:center; justify-content:space-between; transition:color .15s; }
.sidebar-nav .nav-section:hover { color:#94a3b8; }
.sidebar-nav .nav-section::after { content:'\f107'; font-family:'Font Awesome 6 Free'; font-weight:900; font-size:10px; transition:transform .25s; }
.sidebar-nav .nav-section.collapsed::after { transform:rotate(-90deg); }
.sidebar-nav .nav-item.nav-hidden, .sidebar-nav .nav-section.nav-hidden { display:none; }
.sidebar-nav .nav-item.nav-collapsed { display:none; }
.sidebar-nav .nav-item { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:6px; color:#cbd5e1; cursor:pointer; transition:all .2s; font-size:12px; margin-bottom:1px; border:none; background:none; width:100%; text-align:left; }
.sidebar-nav .nav-item:hover { background:var(--sidebar-hover); color:#fff; }
.sidebar-nav .nav-item.active { background:var(--sidebar-active); color:#fff; }
.sidebar-nav .nav-item i { width:18px; text-align:center; font-size:13px; }
.sidebar-nav .nav-badge { margin-left:auto; background:var(--danger); color:#fff; font-size:9px; padding:2px 6px; border-radius:10px; }
.sidebar-footer { padding:10px; border-top:1px solid rgba(255,255,255,.1); }
.sidebar-footer .user-info { display:flex; align-items:center; gap:8px; padding:6px; border-radius:6px; }
.sidebar-footer .user-avatar { width:28px; height:28px; background:var(--primary); border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:12px; flex-shrink:0; }
.sidebar-footer .user-meta { font-size:11px; }
.sidebar-footer .user-meta .uname { font-weight:600; }
.sidebar-footer .user-meta .urole { color:#94a3b8; font-size:10px; }
.sidebar-footer .btn-logout { margin-top:6px; width:100%; padding:6px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); color:#cbd5e1; border-radius:6px; cursor:pointer; font-size:11px; transition:all .2s; }
.sidebar-footer .btn-logout:hover { background:rgba(255,255,255,.1); color:#fff; }

.main-content { flex:1; margin-left:var(--sidebar-w); min-height:100vh; }
.topbar { background:#fff; border-bottom:1px solid var(--border); padding:0 20px; height:48px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:50; }
.topbar h3 { font-size:14px; font-weight:600; }
.topbar-actions { display:flex; align-items:center; gap:8px; }
.topbar .btn-menu-toggle { display:none; background:none; border:none; font-size:18px; color:var(--text); cursor:pointer; }

.content { padding:20px; max-width:1800px; margin:0 auto; }
.content-section { display:none; }
.content-section.active { display:block; }

/* ====== Cards ====== */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(165px, 1fr)); gap:12px; margin-bottom:20px; }
#finReportStats { grid-template-columns:repeat(4, 1fr); grid-auto-rows:1fr; }
.stat-card { background:var(--card-bg); border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow); display:flex; align-items:center; gap:12px; border-left:3px solid transparent; min-width:0; }
.stat-card.primary { border-left-color:var(--primary); }
.stat-card.success { border-left-color:var(--success); }
.stat-card.warning { border-left-color:var(--warning); }
.stat-card.danger { border-left-color:var(--danger); }
.stat-card.info { border-left-color:var(--info); }
.stat-card.cyan { border-left-color:#06b6d4; }
.stat-card.orange { border-left-color:#f97316; }
.stat-card .stat-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.stat-card.primary .stat-icon { background:var(--primary-light); color:var(--primary); }
.stat-card.success .stat-icon { background:var(--success-light); color:var(--success); }
.stat-card.warning .stat-icon { background:var(--warning-light); color:var(--warning); }
.stat-card.danger .stat-icon { background:var(--danger-light); color:var(--danger); }
.stat-card.info .stat-icon { background:var(--info-light); color:var(--info); }
.stat-card.cyan .stat-icon { background:#cffafe; color:#06b6d4; }
.stat-card.orange .stat-icon { background:#fff7ed; color:#f97316; }
.stat-card .stat-info { min-width:0; flex:1; }
.stat-card .stat-info h4 { font-size:15px; font-weight:700; word-break:break-all; overflow-wrap:anywhere; line-height:1.3; min-width:0; overflow:hidden; }
.stat-card .stat-info p { font-size:11px; color:var(--text-secondary); }

.card { background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow); }
.card-header { padding:12px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.card-header h4 { font-size:13px; font-weight:600; }
.card-body { padding:16px; }
.chart-wrap { height:280px; position:relative; }

.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }

/* ====== Dashboard Layout ====== */
.dash-donuts-row { display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; margin-bottom:20px; }
.dash-donut-panel { overflow:visible; }
.dash-donut-panel .card-body { padding:4px 8px 0; }
.dash-donut-panel .card-header { padding:12px 16px; }
.dash-donut-panel .card-header h4 { font-size:12px; }
.chart-donut-lg { height:380px; }
.dash-lines-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.dash-lines-row .card-header { padding:14px 18px; }
.dash-info-row { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:20px; }

/* Enhanced stat cards */
.stat-card { transition:transform .2s,box-shadow .2s; position:relative; overflow:hidden; }
.stat-card:hover { transform:translateY(-2px); box-shadow:0 8px 25px rgba(0,0,0,.1); }
.stat-card::after { content:''; position:absolute; top:0; right:0; width:80px; height:80px; border-radius:0 0 0 80px; opacity:.06; transition:opacity .2s; }
.stat-card.primary::after { background:var(--primary); }
.stat-card.success::after { background:var(--success); }
.stat-card.warning::after { background:var(--warning); }
.stat-card.danger::after { background:var(--danger); }
.stat-card.info::after { background:var(--info); }
.stat-card.cyan::after { background:#06b6d4; }
.stat-card.orange::after { background:#f97316; }
.stat-card:hover::after { opacity:.1; }
.stat-card .stat-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }
.stat-card .stat-info h4 { font-size:22px; font-weight:700; line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stat-card .stat-info p { font-size:11px; color:var(--text-secondary); margin-top:2px; }
.stat-card .stat-info small { font-size:10px; color:var(--text-muted); display:block; }

/* Dashboard chart cards */
.dash-lines-row .card-header { background:linear-gradient(180deg, #fafbfc 0%, #fff 100%); }
.dash-donut-panel .card-header { background:linear-gradient(180deg, #fafbfc 0%, #fff 100%); }

/* Dashboard mini-list items */
.dash-item { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; border-bottom:1px solid var(--border); gap:8px; border-radius:6px; transition:background .15s, transform .15s; margin:0 -6px; }
.dash-item:last-child { border-bottom:none; }
.dash-item:hover { background:#e0f2fe; transform:translateX(3px); }
.dash-item:hover .dash-item-left strong { color:#0284c7; }
.dash-item .dash-item-left { flex:1; min-width:0; }
.dash-item .dash-item-left strong { font-size:12px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; transition:color .15s; }
.dash-item .dash-item-left span { font-size:11px; color:var(--text-muted); }
.dash-item .badge { flex-shrink:0; }

/* Birthday cake highlight */
.birthday-today { background:linear-gradient(135deg,#fef3c7,#fde68a); border-radius:6px; padding:4px 8px; }
.birthday-today strong { color:#92400e; }

/* Card header arrow button */
.card-arrow { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px 6px; border-radius:4px; font-size:11px; transition:all .15s; flex-shrink:0; }
.card-arrow:hover { background:var(--bg); color:var(--primary); }

/* Chart canvas glow effect */
.dash-donut-panel canvas,
.dash-lines-row canvas { filter:drop-shadow(0 1px 3px rgba(0,0,0,.03)); }

/* Industry bar */
.industry-bar { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.industry-bar .bar-label { width:48px; font-size:11px; text-align:right; color:var(--text-secondary); flex-shrink:0; }
.industry-bar .bar-track { flex:1; height:18px; background:var(--bg); border-radius:4px; overflow:hidden; }
.industry-bar .bar-fill { height:100%; border-radius:4px; background:linear-gradient(90deg,var(--primary),#818cf8); transition:width .5s ease; }
.industry-bar .bar-count { width:28px; font-size:11px; color:var(--text-muted); flex-shrink:0; text-align:right; }

/* ====== Tables ====== */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
table th, table td { padding:7px 10px; text-align:left; border-bottom:1px solid var(--border); font-size:12px; }
table th { background:#f8fafc; font-weight:600; color:var(--text-secondary); white-space:nowrap; font-size:11px; text-transform:uppercase; letter-spacing:.5px; }
table td { white-space:nowrap; }
#aiResult table th,
#aiResult table td { white-space:normal; word-break:break-word; }
table tbody tr { transition:background .15s; }
table tbody tr:hover { background:#f8fafc; }

/* ====== Badges ====== */
.badge { display:inline-block; padding:2px 8px; border-radius:12px; font-size:10px; font-weight:600; white-space:nowrap; }
.badge-primary { background:var(--primary-light); color:var(--primary); }
.badge-success { background:var(--success-light); color:#065f46; }
.badge-warning { background:var(--warning-light); color:#92400e; }
.badge-danger { background:var(--danger-light); color:#991b1b; }
.badge-info { background:var(--info-light); color:#1e40af; }
.badge-gray { background:#f1f5f9; color:#475569; }

/* ====== Buttons ====== */
.btn { display:inline-flex; align-items:center; gap:5px; padding:6px 12px; border-radius:6px; font-size:12px; font-weight:500; cursor:pointer; border:1px solid transparent; transition:all .2s; white-space:nowrap; }
.btn i { font-size:11px; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-hover); }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover { background:#059669; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#dc2626; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-warning:hover { background:#d97706; }
.btn-outline { background:#fff; border-color:var(--border); color:var(--text); }
.btn-outline:hover { background:var(--bg); }
.btn-sm { padding:4px 8px; font-size:11px; }
.btn-block { width:100%; justify-content:center; }
.btn-icon { width:28px; height:28px; padding:0; justify-content:center; border-radius:6px; }
.btn:disabled { opacity:.5; cursor:not-allowed; }

/* ====== Forms ====== */
.form-group { margin-bottom:12px; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--text-secondary); margin-bottom:4px; }
.form-group input, .form-group select, .form-group textarea {
  width:100%; padding:7px 10px; border:1.5px solid var(--border); border-radius:6px;
  font-size:12px; outline:none; transition:border-color .2s, box-shadow .2s; background-color:#fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light);
}
.form-group textarea { resize:vertical; min-height:70px; }

/* ====== 全局下拉框美化 ====== */
select {
  -webkit-appearance:none;
  appearance:none;
  cursor:pointer;
  padding:7px 28px 7px 10px;
  border:1.5px solid var(--border);
  border-radius:6px;
  font-size:12px;
  font-family:inherit;
  color:var(--text);
  background-color:#fff;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  outline:none;
  transition:border-color .2s, box-shadow .2s;
}
select:hover { border-color:#cbd5e1; }
select:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-actions { display:flex; justify-content:flex-end; gap:8px; padding-top:12px; border-top:1px solid var(--border); margin-top:12px; }

/* ====== Toolbar ====== */
.toolbar { display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.toolbar input[type="text"] {
  padding:8px 12px 8px 34px;
  border:1.5px solid #e2e8f0;
  border-radius:8px;
  font-size:12.5px;
  outline:none;
  min-width:180px;
  background:#f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") 11px center no-repeat;
  transition:border-color .2s, box-shadow .2s, background-color .2s;
}
.toolbar input[type="text"]:hover { border-color:#cbd5e1; background:#fff; }
.toolbar input[type="text"]:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(99,102,241,.1); background:#fff; }
.toolbar input[type="text"]::placeholder { color:#94a3b8; font-size:12px; }
.toolbar input[type="date"] {
  padding:8px 10px 8px 30px; border:1.5px solid #e2e8f0; border-radius:8px;
  font-size:12px; outline:none; background:#f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") 10px center no-repeat;
  color:var(--text); transition:border-color .2s, box-shadow .2s; font-family:inherit;
  min-width:125px;
}
.toolbar input[type="date"]:hover { border-color:#cbd5e1; background-color:#fff; }
.toolbar input[type="date"]:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(99,102,241,.1); background-color:#fff; }
.toolbar .date-sep { color:var(--text-muted); font-size:12px; flex-shrink:0; }
.toolbar .date-quick { display:flex; gap:0; border-radius:8px; overflow:hidden; border:1.5px solid #e2e8f0; flex-shrink:0; }
.toolbar .date-quick button {
  padding:6px 10px; font-size:11px; border:none; background:#f8fafc; color:var(--text-secondary);
  cursor:pointer; transition:all .15s; border-right:1px solid #e2e8f0; font-family:inherit;
}
.toolbar .date-quick button:last-child { border-right:none; }
.toolbar .date-quick button:hover { background:var(--primary-light); color:var(--primary); }
.toolbar .date-quick button.active { background:var(--primary); color:#fff; }
.toolbar select {
  padding:8px 28px 8px 10px;
  border:1.5px solid #e2e8f0;
  border-radius:8px;
  font-size:12px;
  outline:none;
  min-width:120px;
  background-color:#f8fafc;
  transition:border-color .2s, box-shadow .2s, background-color .2s;
}
.toolbar select:hover { border-color:#cbd5e1; background-color:#fff; }
.toolbar select:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(99,102,241,.1); background-color:#fff; }
.toolbar .spacer { flex:1; }

/* ====== Modals ====== */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:1000; padding:20px; }
#modalVisit.modal-overlay { z-index:1100; }
.modal { background:#fff; border-radius:10px; box-shadow:var(--shadow-md); width:100%; max-height:85vh; display:flex; flex-direction:column; overflow:hidden; }
.modal.modal-sm { max-width:400px; }
.modal.modal-md { max-width:560px; }
.modal.modal-lg { max-width:960px; }
.modal-header { padding:12px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.modal-header h3 { font-size:14px; font-weight:600; }
.modal-close { background:none; border:none; font-size:18px; color:var(--text-muted); cursor:pointer; padding:4px; border-radius:4px; }
.modal-close:hover { color:var(--text); background:var(--bg); }
.modal-body { padding:16px; overflow-y:auto; flex:1; min-height:0; }
.modal-footer { padding:10px 16px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; flex-shrink:0; }

/* ====== Tabs ====== */
.tabs { display:flex; gap:0; border-bottom:2px solid var(--border); margin-bottom:16px; }
.tab { padding:8px 16px; cursor:pointer; font-size:12px; font-weight:500; color:var(--text-secondary); border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .2s; background:none; border-top:none; border-left:none; border-right:none; }
.tab:hover { color:var(--text); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }
.tab-content { display:block; }
.tab-content.hidden { display:none; }

/* ====== Contact sections ====== */
.contact-section { margin-bottom:12px; padding:12px; background:var(--bg); border:1px solid var(--border); border-radius:8px; }
.contact-section.hidden { display:none; }
.contact-section .contact-header { margin-bottom:8px; }
.contact-section .contact-header h5 { font-size:12px; font-weight:600; color:var(--primary); }

/* ====== Bank card table ====== */
.bank-card-table { margin-bottom:12px; }
.bank-card-actions { display:flex; gap:8px; margin-top:8px; }

/* ====== Toast ====== */
#toast-container { position:fixed; top:16px; right:16px; z-index:9999; }
.toast { padding:10px 16px; border-radius:6px; color:#fff; font-size:12px; margin-bottom:6px; box-shadow:var(--shadow-md); animation:slideIn .3s ease; display:flex; align-items:center; gap:6px; }
.toast.success { background:var(--success); }
.toast.error { background:var(--danger); }
.toast.warning { background:var(--warning); }
.toast.info { background:var(--info); }
@keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* ====== Pagination ====== */
.pagination { display:flex; justify-content:center; gap:3px; margin-top:12px; }
.pagination button { width:30px; height:30px; border:1px solid var(--border); background:#fff; border-radius:5px; cursor:pointer; font-size:12px; transition:all .2s; }
.pagination button:hover { border-color:var(--primary); color:var(--primary); }
.pagination button.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.pagination button:disabled { opacity:.4; cursor:not-allowed; }
.pagination .pager-nav { width:auto; padding:0 10px; }
.pagination .pager-dots { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; font-size:12px; color:var(--text-muted); }
.pagination .pager-info { display:inline-flex; align-items:center; margin-left:8px; font-size:11px; color:var(--text-muted); white-space:nowrap; }

/* ====== Import/Export ====== */
.drop-zone { border:2px dashed var(--border); border-radius:var(--radius); padding:32px; text-align:center; cursor:pointer; transition:all .2s; }
.drop-zone:hover, .drop-zone.dragover { border-color:var(--primary); background:var(--primary-light); }
.drop-zone i { font-size:36px; color:var(--text-muted); margin-bottom:10px; }
.drop-zone p { color:var(--text-secondary); font-size:12px; }

/* ====== Alert ====== */
.alert { padding:10px 14px; border-radius:var(--radius); font-size:12px; margin-bottom:14px; }
.alert-info { background:var(--info-light); color:#1e40af; }
.alert-warning { background:var(--warning-light); color:#92400e; }
.alert-danger { background:var(--danger-light); color:#991b1b; }

/* ====== Field Tags ====== */
.field-tags { display:flex; flex-wrap:wrap; gap:4px; }
#sysColToggles.field-tags { flex-wrap:nowrap; overflow-x:auto; }
#sysColToggles.field-tags label { white-space:nowrap; flex-shrink:0; }

/* ====== Detail Modal ====== */
.detail-section { margin-bottom:16px; }
.detail-section h5 { font-size:13px; font-weight:600; margin-bottom:8px; padding-bottom:4px; border-bottom:1px solid var(--border); }
.detail-section h5 i { margin-right:4px; color:var(--primary); }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; font-size:12px; }
.detail-grid dt { color:var(--text-secondary); }
.detail-grid dd { font-weight:500; }
.detail-grid .full { grid-column:1/-1; }

/* 客户详情 Tab 导航 */
.detail-tabs { display:flex; gap:0; background:var(--bg); border-bottom:1px solid var(--border); padding:0 8px; position:sticky; top:0; z-index:5; }
.detail-tab { padding:10px 16px; font-size:12px; border:none; background:transparent; cursor:pointer; color:var(--text-secondary); border-bottom:2px solid transparent; transition:all .15s; }
.detail-tab:hover { color:var(--text); background:rgba(0,0,0,.03); }
.detail-tab.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }

/* 客户详情头部 */
.detail-header { display:flex; align-items:center; gap:16px; margin-bottom:20px; padding:16px; background:var(--bg); border-radius:8px; }
.detail-avatar { width:48px; height:48px; background:var(--primary); border-radius:12px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:22px; flex-shrink:0; }
.detail-title { flex:1; }
.detail-title h3 { font-size:18px; font-weight:700; margin:0; }
.detail-title span { color:var(--text-secondary); font-size:12px; }
.detail-profit { text-align:right; }
.detail-profit div { font-size:20px; font-weight:700; color:var(--primary); }
.detail-profit span { font-size:11px; color:var(--text-secondary); }

/* 详情双列 */
.detail-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.detail-card { background:#fff; border:1px solid var(--border); border-radius:8px; padding:14px; }
.detail-card h5 { font-size:13px; font-weight:600; margin-bottom:10px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.detail-card h5 i { margin-right:4px; }
.detail-row { display:flex; padding:4px 0; font-size:12px; }
.detail-label { color:var(--text-secondary); width:60px; flex-shrink:0; }
.detail-counts { font-size:11px; color:var(--text-secondary); margin-top:8px; }

/* 财务摘要三栏 */
.finance-summary { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; margin-bottom:12px; }
.finance-item { text-align:center; padding:10px; border-radius:6px; }
.finance-item div { font-size:16px; font-weight:700; }
.finance-item span { font-size:10px; color:var(--text-secondary); }
.finance-item.income { background:#f0fdf4; }
.finance-item.income div { color:#16a34a; }
.finance-item.cost { background:#fef2f2; }
.finance-item.cost div { color:#dc2626; }
.finance-item.profit { background:#eef2ff; }
.finance-item.profit div { color:#4f46e5; }

/* 跟进提醒 */
.reminder-item { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); }
.reminder-item small { color:var(--text-muted); }

/* ====== Log Table ====== */
.log-action-create { color:#10b981; }
.log-action-update { color:#3b82f6; }
.log-action-delete { color:#ef4444; }
.log-target { font-size:10px; color:var(--text-muted); }

/* ====== Payment Product ====== */
.product-select-row { display:flex; gap:10px; align-items:end; }
.product-select-row .form-group { flex:1; }

/* ====== Notification Bell ====== */
.btn-bell { position:relative; width:32px; height:32px; padding:0; justify-content:center; border-radius:6px; background:transparent; border:1.5px solid var(--border); color:var(--text-secondary); font-size:14px; cursor:pointer; transition:all .2s; }
.btn-bell:hover { background:var(--bg); color:var(--text); border-color:var(--primary); }
.bell-badge { position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px; background:var(--danger); color:#fff; font-size:9px; font-weight:700; border-radius:10px; display:flex; align-items:center; justify-content:center; line-height:1; }

/* ====== Notification Panel ====== */
.notification-panel { position:fixed; top:52px; right:16px; width:360px; max-height:70vh; background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:0 10px 40px rgba(0,0,0,.15); display:flex; flex-direction:column; z-index:999; }
.notif-header { padding:10px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.notif-header h4 { font-size:13px; font-weight:600; }
.notif-header h4 i { color:var(--primary); margin-right:4px; }
.notif-close { background:none; border:none; font-size:18px; color:var(--text-muted); cursor:pointer; }
.notif-close:hover { color:var(--text); }
.notif-body { padding:8px 0; overflow-y:auto; flex:1; }
.notif-group { margin-bottom:4px; }
.notif-group-title { padding:6px 14px; font-size:11px; font-weight:600; color:var(--text-secondary); text-transform:uppercase; letter-spacing:.5px; }
.notif-item { display:flex; align-items:flex-start; padding:8px 14px; border-bottom:1px solid #f1f5f9; transition:background .15s; }
.notif-item:hover { background:#f8fafc; }
.notif-item.strong { border-left:3px solid var(--danger); background:#fef2f2; }
.notif-item-content { flex:1; min-width:0; }
.notif-item-content strong { display:block; font-size:12px; color:var(--text); }
.notif-item-content span { display:block; font-size:11px; color:var(--text-secondary); margin-top:1px; }
.notif-item-content small { display:block; font-size:10px; color:var(--text-muted); margin-top:2px; }
.notif-dismiss { flex-shrink:0; width:20px; height:20px; border:none; background:transparent; color:var(--text-muted); cursor:pointer; font-size:14px; border-radius:4px; margin-left:8px; line-height:1; }
.notif-dismiss:hover { background:var(--border); color:var(--danger); }

/* ====== License Badge ====== */
.license-badge { display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:6px;font-size:11px;font-weight:600;background:var(--success-light);color:#065f46;white-space:nowrap; }

/* ====== System Info Button ====== */
.btn-system-info { position:relative; width:32px; height:32px; padding:0; justify-content:center; border-radius:6px; background:transparent; border:1.5px solid var(--border); color:var(--text-secondary); font-size:14px; cursor:pointer; transition:all .2s; }
.btn-system-info:hover { background:var(--bg); color:var(--primary); border-color:var(--primary); }

/* ====== System Info Panel ====== */
.system-info-panel { position:fixed; top:52px; right:64px; width:340px; background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:0 10px 40px rgba(0,0,0,.15); z-index:999; }
.sysinfo-header { padding:10px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.sysinfo-header h4 { font-size:13px; font-weight:600; }
.sysinfo-header h4 i { color:var(--primary); margin-right:4px; }
.sysinfo-close { background:none; border:none; font-size:18px; color:var(--text-muted); cursor:pointer; }
.sysinfo-close:hover { color:var(--text); }
.sysinfo-body { padding:16px 18px; }
.sysinfo-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid #f1f5f9; font-size:12px; }
.sysinfo-row:last-child { border-bottom:none; }
.sysinfo-row .label { color:var(--text-secondary); }
.sysinfo-row .value { font-weight:500; color:var(--text); text-align:right; }
.sysinfo-row .value.highlight { color:var(--primary); font-weight:600; }
.sysinfo-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.sysinfo-badge.online { background:#d1fae5; color:#065f46; }
.sysinfo-badge.users { background:#eef2ff; color:var(--primary); }
.sysinfo-announce { margin-top:10px; padding:10px 12px; background:#fef3c7; border-radius:8px; font-size:11px; color:#92400e; line-height:1.5; }
.sysinfo-announce i { margin-right:4px; }

/* ====== 跟进阶段进度条 ====== */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #e5e7eb;
}
.progress-value {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ====== Cell Styles ====== */
.cell-name { max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell-name a:hover { text-decoration:underline !important; }
.cell-ellipsis { max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell-actions { white-space:nowrap; }
.cell-actions .btn { margin:1px; }

/* 商机行状态样式 */
.opp-row-won { background:linear-gradient(90deg, rgba(34,197,94,0.08) 0px, rgba(34,197,94,0.08) 4px, transparent 4px); }
.opp-row-won td { color:var(--text-muted); }
.opp-row-won td:first-child { color:var(--text-color); }
.opp-row-lost { background:linear-gradient(90deg, rgba(156,163,175,0.12) 0px, rgba(156,163,175,0.12) 4px, transparent 4px); }
.opp-row-lost td { color:var(--text-muted); opacity:0.7; }
.opp-row-lost td:first-child { color:var(--text-muted); }

/* ====== Row Colors ====== */
.row-birthday td { background:#fef9e7; }
.row-visit td { background:#e8f4fd; }
.row-visit-due td { background:#d1fae5; }
.row-important td { background:#fde8e8; }
.row-strong td { background:#f3e8ff; }

/* ====== Todo Items ====== */
.todo-week-grid { display:grid; grid-template-columns:repeat(7, 1fr); gap:8px; }
.todo-day-card { background:var(--card-bg); border-radius:10px; box-shadow:var(--shadow); overflow:hidden; display:flex; flex-direction:column; height:220px; transition:transform .2s, box-shadow .2s; cursor:pointer; }
.todo-day-card:hover { transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.1); }
.todo-day-today { box-shadow:0 0 0 2px var(--primary), 0 4px 12px rgba(79,70,229,.15); }
.todo-day-head { padding:8px 8px 6px; text-align:center; border-bottom:1px solid var(--border); display:flex; align-items:center; flex-wrap:wrap; gap:4px; }
.todo-day-lunar { font-size:9px; color:#c2410c; margin-left:auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:50%; }
.todo-color-dot { display:inline-block; width:10px; height:10px; border-radius:50%; border:1px dashed #d4d4d4; cursor:pointer; flex-shrink:0; margin-left:2px; transition:all .15s; }
.todo-color-dot.active { border-color:var(--primary); background:var(--primary-light); }
.todo-color-dot:hover { border-color:var(--primary); transform:scale(1.3); }

/* ====== 文档工具箱 ====== */
.dt-cat-title { font-size:13px; font-weight:600; color:var(--text); padding:12px 0 4px; margin:0; display:flex; align-items:center; gap:6px; border-bottom:1px solid var(--border); margin-bottom:8px; }
.dt-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(155px, 1fr)); gap:8px; margin-bottom:16px; }
.dt-card { background:var(--card-bg); border:1px solid var(--border); border-radius:8px; padding:12px; cursor:pointer; transition:all .15s; display:flex; flex-direction:column; align-items:center; text-align:center; gap:4px; }
.dt-card:hover { border-color:var(--primary); box-shadow:0 2px 8px rgba(0,0,0,.08); transform:translateY(-1px); }
.dt-card-icon { font-size:20px; color:var(--primary); margin-bottom:2px; }
.dt-card-name { font-size:12px; font-weight:600; color:var(--text); }
.dt-card-desc { font-size:10px; color:var(--text-muted); }
.dt-dropzone { border:2px dashed var(--border); border-radius:10px; padding:30px 20px; text-align:center; transition:all .2s; background:var(--bg); }
.dt-dropzone.dt-dragover { border-color:var(--primary); background:var(--primary-light); }
.dt-filelist { margin-top:10px; display:flex; flex-direction:column; gap:4px; }
.dt-file-item { display:flex; align-items:center; justify-content:space-between; padding:6px 10px; background:var(--bg); border-radius:6px; font-size:12px; }
.dt-file-rm { background:none; border:none; color:var(--danger); cursor:pointer; font-size:16px; padding:0 4px; line-height:1; }

/* ====== 图片处理 ====== */
.im-dropzone { border:2px dashed var(--border); border-radius:10px; padding:36px 20px; text-align:center; transition:all .2s; background:var(--bg); cursor:pointer; margin-top:12px; }
.im-dropzone:hover { border-color:var(--primary); background:var(--primary-light); }
.im-dropzone.drag-over { border-color:var(--primary); background:var(--primary-light); }
.im-placeholder { color:var(--text-muted); font-size:13px; }
.im-input { width:100%; padding:6px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; }
.im-select { width:100%; padding:6px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; background-color:#fff; }
.im-range { width:100%; accent-color:var(--primary); }
.im-color { width:36px; height:28px; border:1px solid var(--border); border-radius:4px; cursor:pointer; padding:2px; }

/* 工作区布局 */
.im-workspace { display:flex; gap:18px; align-items:flex-start; margin-top:12px; }
.im-preview-area { flex:1; min-width:0; }
.im-preview-panels { display:flex; align-items:flex-start; gap:14px; }
.im-preview-card { flex:1; background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; min-width:0; border:1px solid var(--border); }
.im-preview-label { padding:8px 14px; font-size:11px; font-weight:600; color:var(--text-secondary); background:var(--bg); border-bottom:1px solid var(--border); text-transform:uppercase; letter-spacing:.5px; }
.im-preview-img-wrap { display:flex; align-items:center; justify-content:center; min-height:180px; background:repeating-conic-gradient(#e2e8f0 0% 25%, transparent 0% 50%) 0 0 / 16px 16px; padding:12px; }
.im-preview-img-wrap img, .im-preview-img-wrap canvas { max-width:100%; max-height:340px; object-fit:contain; display:block; }
.im-preview-info { padding:6px 14px; font-size:11px; color:var(--text-muted); border-top:1px solid var(--border); line-height:1.6; }
.im-preview-info.highlight { color:var(--success); font-weight:600; }
.im-preview-info .save-badge { display:inline-block; padding:1px 7px; border-radius:8px; font-size:10px; font-weight:600; margin-left:6px; }
.im-preview-info .save-badge.green { background:var(--success-light); color:var(--success); }
.im-preview-info .save-badge.red { background:var(--danger-light); color:var(--danger); }

/* QR 码模式：预览区收窄，设置面板加宽 */
.im-qr-mode .im-preview-area { flex:0 0 320px; }
.im-qr-mode .im-settings-panel { width:380px; }
.im-qr-mode .im-preview-img-wrap { min-height:120px; }
.im-qr-mode .im-preview-img-wrap img, .im-qr-mode .im-preview-img-wrap canvas { max-height:260px; }
.im-preview-arrow { display:flex; align-items:center; padding-top:36px; color:var(--primary); flex-shrink:0; }

/* 右侧设置面板 */
.im-settings-panel { width:280px; flex-shrink:0; background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; position:sticky; top:60px; max-height:calc(100vh - 100px); overflow-y:auto; border:1px solid var(--border); }
.im-settings-title { font-size:14px; font-weight:700; color:var(--text); padding-bottom:12px; margin-bottom:14px; border-bottom:2px solid var(--primary); }
.im-setting-group { margin-bottom:15px; }
.im-setting-label { display:flex; align-items:center; justify-content:space-between; font-size:12px; font-weight:500; margin-bottom:5px; color:var(--text-secondary); }
.im-setting-label .im-val { color:var(--primary); font-weight:700; }
.im-tool-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:14px; padding-top:14px; border-top:1px solid var(--border); }
.im-tool-actions .btn { font-size:11px; padding:7px 8px; justify-content:center; }
.im-tool-actions .btn-full { grid-column:1/-1; }
.im-hint { font-size:11px; color:var(--text-muted); margin-top:4px; }

/* 分段切换按钮 */
.im-seg { display:flex; border:1px solid var(--border); border-radius:6px; overflow:hidden; }
.im-seg-btn { flex:1; padding:6px 8px; font-size:11px; background:var(--card-bg); color:var(--text-secondary); border:none; cursor:pointer; transition:all .15s; font-family:inherit; }
.im-seg-btn + .im-seg-btn { border-left:1px solid var(--border); }
.im-seg-btn.active { background:var(--primary); color:#fff; }
.im-seg-btn:hover:not(.active) { background:var(--bg); }

/* 裁剪弹窗 */
.im-crop-wrap { position:relative; display:inline-block; overflow:auto; cursor:crosshair; user-select:none; -webkit-user-select:none; line-height:0; max-width:100%; max-height:60vh; }
.im-crop-wrap canvas { display:block; }
.im-crop-mask { position:absolute; inset:0; pointer-events:none; }
.im-crop-box { position:absolute; border:2px solid var(--primary); box-shadow:0 0 0 9999px rgba(15,23,42,.45); cursor:move; pointer-events:auto; }
.im-crop-handle { position:absolute; width:12px; height:12px; border:2px solid #fff; background:var(--primary); border-radius:3px; }
.im-crop-handle.nw { top:-6px; left:-6px; cursor:nw-resize; }
.im-crop-handle.ne { top:-6px; right:-6px; cursor:ne-resize; }
.im-crop-handle.sw { bottom:-6px; left:-6px; cursor:sw-resize; }
.im-crop-handle.se { bottom:-6px; right:-6px; cursor:se-resize; }
.im-crop-info { font-size:12px; color:var(--text-muted); margin:10px 0; text-align:center; }
.crop-actions { display:flex; gap:8px; justify-content:center; margin-top:8px; }

/* 水印弹窗 */
.im-wm-preview { position:relative; margin-bottom:14px; background:repeating-conic-gradient(#e2e8f0 0% 25%, transparent 0% 50%) 0 0 / 14px 14px; border-radius:8px; overflow:hidden; min-height:160px; display:flex; align-items:center; justify-content:center; }
.im-wm-preview canvas { display:block; max-width:100%; max-height:280px; }
.setting-check { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-secondary); cursor:pointer; }

/* 响应式 */
@media (max-width:900px) {
  .im-workspace { flex-direction:column; }
  .im-settings-panel { width:100%; position:static; max-height:none; }
  .im-preview-panels { flex-direction:column; }
  .im-preview-arrow { transform:rotate(90deg); padding-top:0; justify-content:center; }
}

/* ====== AI 抠图批量缩略图 ====== */
.im-batch-thumbs { display:flex; gap:6px; flex-wrap:wrap; margin-top:4px; max-height:160px; overflow-y:auto; }
.im-batch-thumb { width:48px; height:48px; border-radius:6px; overflow:hidden; border:2px solid transparent; cursor:pointer; flex-shrink:0; position:relative; background:repeating-conic-gradient(#e2e8f0 0% 25%, transparent 0% 50%) 0 0 / 8px 8px; }
.im-batch-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.im-batch-thumb:hover { border-color:var(--primary); }
.im-batch-thumb-active { border-color:var(--primary) !important; box-shadow:0 0 0 2px var(--primary-light); }
.im-batch-badge { position:absolute; top:2px; right:2px; width:14px; height:14px; border-radius:50%; background:var(--success); color:#fff; font-size:9px; display:flex; align-items:center; justify-content:center; line-height:1; }
.bg-preset-item { border:2px solid transparent !important; transition:border-color .2s; }
.bg-preset-item.active { border-color:var(--primary) !important; }
.bg-preset-item:hover { border-color:var(--border) !important; }
.bg-preset-item.active:hover { border-color:var(--primary) !important; }

.todo-day-num { display:block; font-size:22px; font-weight:700; color:var(--text); line-height:1; }
.todo-day-today .todo-day-num { color:var(--primary); }
.todo-day-week { display:block; font-size:10px; color:var(--text-muted); margin-top:2px; }
.todo-day-today .todo-day-week { color:var(--primary); font-weight:600; }
.todo-day-count { display:inline-block; margin-top:3px; font-size:9px; background:var(--bg); color:var(--text-muted); padding:1px 6px; border-radius:8px; }
.todo-day-today .todo-day-count { background:var(--primary-light); color:var(--primary); }
.todo-day-body { flex:1; overflow:hidden; padding:6px; }
.todo-empty { text-align:center; color:var(--text-muted); font-size:11px; padding:8px; }
.todo-search-empty { text-align:center; padding:30px; color:var(--text-muted); }
.todo-search-empty i { font-size:32px; display:block; margin-bottom:8px; opacity:.4; }
.todo-search-empty p { font-size:12px; }
.todo-row { display:flex; align-items:flex-start; gap:6px; padding:6px 4px; border-radius:6px; transition:background .15s; font-size:11px; }
.todo-row:hover { background:#f8fafc; }
.todo-row.done { opacity:.55; }
.todo-row input[type="checkbox"] { margin-top:2px; flex-shrink:0; accent-color:var(--primary); cursor:pointer; }
.todo-pri { width:6px; height:6px; border-radius:50%; background:#94a3b8; margin-top:5px; flex-shrink:0; }
.todo-pri.high { background:var(--danger); }
.todo-pri.low { background:#94a3b8; }
.todo-row-text { flex:1; min-width:0; }
.todo-row-title { display:block; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.todo-row.done .todo-row-title { text-decoration:line-through; color:var(--text-muted); }
.todo-row-desc { display:block; font-size:10px; color:var(--text-muted); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.todo-row-date { display:block; font-size:10px; color:var(--text-muted); margin-top:1px; }
.todo-row-actions { display:flex; gap:1px; opacity:0; transition:opacity .15s; flex-shrink:0; }
.todo-row:hover .todo-row-actions { opacity:1; }
.todo-row-actions button { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:2px 4px; border-radius:3px; font-size:10px; }
.todo-row-actions button:hover { color:var(--primary); background:var(--bg); }
.todo-row-actions button:last-child:hover { color:var(--danger); }

/* ====== Form Section (通用弹窗分区) ====== */
.form-section, .pay-section { background:var(--bg); border-radius:8px; padding:14px; margin-bottom:14px; }
.form-section-title, .pay-section-title { font-size:12px; font-weight:600; color:var(--text-secondary); margin-bottom:10px; text-transform:uppercase; letter-spacing:.5px; }
.form-section-title i, .pay-section-title i { margin-right:4px; }

/* ====== Search Dropdown ====== */
.search-dropdown { position:absolute; top:100%; left:0; right:0; background:#fff; border:1px solid var(--border); border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.1); z-index:100; max-height:200px; overflow-y:auto; }
.search-item { padding:6px 10px; cursor:pointer; font-size:12px; border-bottom:1px solid #f1f5f9; }
.search-item:hover { background:var(--primary-light); }

/* ====== Radar chart score table ====== */
.radar-tag { display:inline-flex; align-items:center; padding:3px 10px; font-size:11px; border-radius:14px; cursor:pointer; border:1.5px solid var(--border); background:#fff; color:var(--text-secondary); transition:all .15s; white-space:nowrap; }
.radar-tag:hover { border-color:var(--primary); color:var(--primary); }
.radar-tag.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.radar-score-table { width:100%; border-collapse:collapse; font-size:12px; }
.radar-score-table th { background:var(--bg); padding:7px 8px; text-align:left; font-weight:600; color:var(--text); border-bottom:2px solid var(--border); white-space:nowrap; }
.radar-score-table td { padding:6px 8px; border-bottom:1px solid #f1f5f9; color:var(--text-secondary); vertical-align:middle; }
.radar-score-table tr:hover td { background:#fafbff; }
.radar-score-bar { height:5px; border-radius:3px; background:#e2e8f0; margin-top:3px; overflow:hidden; }
.radar-score-bar-fill { height:5px; border-radius:3px; transition:width .4s ease; }
.drop-zone-hover { border-color:var(--primary) !important; background:#f5f3ff !important; }
.hide-scrollbar::-webkit-scrollbar { display:none; }

/* ====== Responsive ====== */
@media (max-width:1024px) {
  .stat-grid { grid-template-columns:repeat(3, 1fr); }
  #finReportStats { grid-template-columns:repeat(3, 1fr); }
  .grid-2 { grid-template-columns:1fr; }
  .dash-donuts-row { grid-template-columns:1fr; }
  .dash-lines-row { grid-template-columns:1fr; }
  .dash-info-row { grid-template-columns:repeat(2,1fr); }
  .todo-week-grid { grid-template-columns:repeat(4, 1fr); }
  .content { max-width:100%; }
}

.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:99; }
.sidebar-overlay.visible { display:block; }

@media (max-width:768px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .main-content { margin-left:0; }
  .topbar .btn-menu-toggle { display:block; }
  .stat-grid { grid-template-columns:repeat(2, 1fr); }
  #finReportStats { grid-template-columns:repeat(2, 1fr); }
  .grid-2 { grid-template-columns:1fr; }
  .dash-donuts-row { grid-template-columns:1fr; }
  .dash-donut-panel .chart-donut-lg { height:320px; }
  .dash-lines-row { grid-template-columns:1fr; }
  .dash-info-row { grid-template-columns:1fr; }
  .todo-week-grid { grid-template-columns:repeat(2, 1fr); }
  .form-row { grid-template-columns:1fr; }
  .toolbar { flex-direction:column; align-items:stretch; }
  .toolbar input[type="text"], .toolbar select, .toolbar input[type="date"] { width:100% !important; min-width:0; }
  .toolbar .btn { width:100%; }
  #licenseBadge { display:none; }
  body.no-scroll { overflow:hidden; }
  .tabs { overflow-x:auto; }
  .content { padding:14px; max-width:100%; }

  /* ====== 移动端表格卡片化（4 张核心表：客户/产品/订单/商机） ====== */
  #custTable, #ordTable, #oppTable, #prodTable,
  #custTable tbody, #ordTable tbody, #oppTable tbody, #prodTable tbody { display:block; }
  #custTable thead, #ordTable thead, #oppTable thead, #prodTable thead { display:none; }
  #custTable tbody tr, #ordTable tbody tr, #oppTable tbody tr, #prodTable tbody tr {
    display:block; background:#fff; border-radius:8px; box-shadow:0 1px 4px rgba(0,0,0,.08);
    margin-bottom:10px; padding:12px;
  }
  #custTable tbody tr:hover, #ordTable tbody tr:hover, #oppTable tbody tr:hover, #prodTable tbody tr:hover { background:#fff; }
  /* 行色类从 td 背景转移到卡片背景（客户表） */
  #custTable tbody tr.row-important { background:#fde8e8; }
  #custTable tbody tr.row-birthday { background:#fef9e7; }
  #custTable tbody tr.row-visit { background:#e8f4fd; }
  #custTable tbody tr.row-visit-due { background:#d1fae5; }
  #custTable tbody tr.row-strong { background:#f3e8ff; }
  #custTable tbody td, #ordTable tbody td, #oppTable tbody td, #prodTable tbody td {
    display:flex; justify-content:space-between; align-items:center; gap:12px;
    padding:6px 0; border-bottom:1px solid #f0f0f0; text-align:left; background:transparent;
    min-width:0; word-break:break-word;
  }
  #custTable tbody td::before, #ordTable tbody td::before, #oppTable tbody td::before, #prodTable tbody td::before {
    content:attr(data-label); color:#888; font-size:12px; flex-shrink:0;
  }
  /* 值区多元素（图标+文本等）紧凑靠右 */
  #custTable tbody td > *, #ordTable tbody td > *, #oppTable tbody td > *, #prodTable tbody td > * { margin-left:auto; }
  /* 无 data-label 的 td（空态行/加载行）：不生成空标签、内容居中 */
  #custTable tbody td:not([data-label])::before, #ordTable tbody td:not([data-label])::before,
  #oppTable tbody td:not([data-label])::before, #prodTable tbody td:not([data-label])::before { display:none; }
  #custTable tbody td:not([data-label]), #ordTable tbody td:not([data-label]),
  #oppTable tbody td:not([data-label]), #prodTable tbody td:not([data-label]) { justify-content:center; }
  /* 省略号列改为换行 */
  #custTable .cell-ellipsis, #ordTable .cell-ellipsis, #oppTable .cell-ellipsis, #prodTable .cell-ellipsis {
    max-width:none; white-space:normal; overflow:visible; text-overflow:clip;
  }
  /* 操作行独立成行、底部右对齐 */
  #custTable .cell-actions, #ordTable .cell-actions, #oppTable .cell-actions, #prodTable .cell-actions {
    display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; border-bottom:none; padding-top:8px;
  }
  #custTable .cell-actions::before, #ordTable .cell-actions::before, #oppTable .cell-actions::before, #prodTable .cell-actions::before { display:none; }

  /* ====== 移动端触控目标 ≥44px ====== */
  .btn, .btn-sm { min-height:44px; }
  .tabs .tab { min-height:44px; display:flex; align-items:center; }
  .modal-close { width:44px; height:44px; }
  .pagination button { width:44px; height:44px; }
  .pagination .pager-nav { width:auto; padding:0 14px; }
  .toolbar .date-quick button { min-height:44px; }
  .sidebar-nav .nav-item { min-height:44px; }
  .sidebar-footer .btn-logout { min-height:44px; }
  .topbar .btn-icon { min-width:44px; min-height:44px; }

  /* ====== 移动端输入：防 iOS 自动缩放 + 触控高度 ====== */
  .modal input[type="text"], .modal input[type="number"], .modal input[type="date"], .modal select, .modal textarea,
  .toolbar input, .toolbar select { font-size:16px !important; min-height:44px; }

  /* ====== 移动端弹窗：底部贴边弹出 + 安全区 ====== */
  .modal-overlay { align-items:flex-end; padding:0; }
  .modal-overlay .modal { max-height:90vh; max-width:100%; width:100%; margin:0; border-radius:12px 12px 0 0; }
  .modal-footer { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }

  /* ====== 移动端 Toast：底部居中 + 上滑入场 ====== */
  #toast-container { top:auto; bottom:calc(32px + env(safe-area-inset-bottom)); left:16px; right:16px;
    display:flex; flex-direction:column; align-items:center; }
  .toast { animation:toastUp .3s ease; max-width:100%; }
  @keyframes toastUp { from { transform:translateY(16px); opacity:0; } to { transform:translateY(0); opacity:1; } }

  /* ====== 移动端字体与间距：正文16px + 呼吸感 ====== */
  body { font-size:16px; line-height:1.6; }
  .card { padding:16px; }
  .card-header { margin:-16px -16px 0; }
  .toolbar { gap:12px; margin-bottom:16px; }

  /* ====== 移动端卡片精简：隐藏非关键列 + 标题行加粗 ====== */
  #custTable tbody td[data-mobile-hide], #ordTable tbody td[data-mobile-hide],
  #oppTable tbody td[data-mobile-hide], #prodTable tbody td[data-mobile-hide] { display:none; }
  #custTable tbody td[data-label="客户名称"], #ordTable tbody td[data-label="订单编号"],
  #oppTable tbody td[data-label="商机名称"], #prodTable tbody td[data-label="名称"] { font-size:15px; font-weight:600; }
  #custTable tbody td[data-label="客户名称"]::before, #ordTable tbody td[data-label="订单编号"]::before,
  #oppTable tbody td[data-label="商机名称"]::before, #prodTable tbody td[data-label="名称"]::before { font-weight:400; }
}

@media (max-width:480px) {
  .stat-grid { grid-template-columns:1fr; }
  #finReportStats { grid-template-columns:1fr; }
  .content { padding:10px; }
  .modal { margin:8px; border-radius:8px; }
  #licenseOverlay > div { padding:28px 20px !important; }
}

/* 合同文件上传区 */
.ct-drop-zone:hover { border-color:var(--primary) !important; background:#f8faff; }

/* 电子表格全屏 */
#sheetEditPanel:fullscreen { background:#fff; padding:8px; }
#sheetEditPanel:fullscreen #sheetContainer { height:calc(100vh - 62px); border-radius:0; }
#sheetEditPanel:-webkit-full-screen { background:#fff; padding:8px; }
#sheetEditPanel:-webkit-full-screen #sheetContainer { height:calc(100vh - 62px); border-radius:0; }

/* ====== 点击反馈特效（分层） ====== */

/* 第四层：移动端去掉默认点击高亮（全局，登录页同样生效） */
* { -webkit-tap-highlight-color: transparent; }

/* 第一层：真正的按钮——物理下压感（scale+亮度+阴影压缩）。
   过渡列表在用户方案基础上扩展 background/color/border/opacity，
   避免覆盖 .btn 原有 transition:all .2s 导致 hover 渐变瞬跳 */
body:not(.login-page) button,
body:not(.login-page) .btn,
body:not(.login-page) input[type="submit"],
body:not(.login-page) input[type="button"] {
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease,
              filter 0.15s ease,
              background-color .2s ease,
              color .2s ease,
              border-color .2s ease,
              opacity .2s ease;
  transform-origin: center;
  touch-action: manipulation;
  will-change: transform;
}

/* 按下效果：缩放 + 变暗 + 阴影压缩 */
body:not(.login-page) button:not(:disabled):active,
body:not(.login-page) .btn:not(:disabled):active,
body:not(.login-page) input[type="submit"]:not(:disabled):active,
body:not(.login-page) input[type="button"]:not(:disabled):active {
  transform: scale(0.95);
  filter: brightness(0.92);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
}

/* 按钮内文字/图标不跟着抖动 */
body:not(.login-page) button:active *,
body:not(.login-page) .btn:active *,
body:not(.login-page) input[type="submit"]:active *,
body:not(.login-page) input[type="button"]:active * {
  transform: scale(1);
  filter: brightness(1);
}

/* 第二层：非按钮的 data-action 触发器（表格行内图标、菜单项）——不变形，只变色。
   transition 放在基础规则上（而非 :active），按下与松开都有 0.1s 过渡，避免松开瞬跳 */
body:not(.login-page) [data-action]:not(.btn):not(button) {
  transition: filter 0.1s ease, opacity 0.1s ease;
}

body:not(.login-page) [data-action]:not(.btn):not(button):active {
  transform: scale(1) !important; /* 锁定尺寸，绝不抖动 */
  filter: brightness(0.75) saturate(1.2);
  opacity: 0.8;
}

/* 第三层：登录页隔离——以上规则全部以 body:not(.login-page) 限定；
   LOGIN_HTML 的登录页（body.login-page）同样加载 style.css，但完全不受影响 */
