/* ==========================================================================
   客户管理系统 - 现代后台 UI (v30 - 最终完美版)
   ========================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;

    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;

    --bg: #f4f4f5;
    --surface: #ffffff;
    --text-1: #18181b;
    --text-2: #3f3f46;
    --text-3: #71717a;
    --text-4: #a1a1aa;
    --border: #e4e4e7;
    --border-2: #d4d4d8;

    --side-bg: #18181b;
    --side-hover: #27272a;
    --side-active: #2563eb;
    --side-text: #a1a1aa;
    --side-text-hover: #ffffff;

    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;

    --sh-xs: 0 1px 2px rgba(0,0,0,.04);
    --sh-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06);
    --sh-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.06);

    --side-w: 232px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text-2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

a { text-decoration: none; color: inherit; cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }


/* ==========================================================================
   登录页
   ========================================================================== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #1e40af 100%); padding: 24px; }
.login-box { background: #fff; border-radius: 16px; padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,.35); }
.login-box h2 { font-size: 26px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; text-align: center; letter-spacing: -.5px; }
.login-box .sub { font-size: 14px; color: var(--text-3); text-align: center; margin-bottom: 32px; }
.login-box .fg { margin-bottom: 18px; }
.login-box label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 8px; font-weight: 600; }
.login-box input { width: 100%; border: 1.5px solid var(--border-2); border-radius: 8px; padding: 13px 16px; font-size: 15px; color: var(--text-1); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.login-box input::placeholder { color: var(--text-4); }
.login-box input:hover { border-color: #9ca3af; }
.login-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.login-box .btn { width: 100%; justify-content: center; padding: 14px; font-size: 16px; font-weight: 600; margin-top: 8px; }
.login-box .hint { margin-top: 24px; font-size: 13px; color: var(--text-3); text-align: center; padding-top: 20px; border-top: 1px solid #f3f4f6; }


/* ==========================================================================
   布局
   ========================================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { font-size: 16px; font-weight: 700; color: #fff; padding: 22px 20px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #27272a; letter-spacing: -.2px; }
.sidebar .logo span { font-size: 20px; }
.sidebar nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px; color: var(--side-text); font-size: 14px; font-weight: 500; transition: all .15s; cursor: pointer; user-select: none; }
.nav-item:hover { background: var(--side-hover); color: var(--side-text-hover); }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.nav-item i { font-style: normal; font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 24px 32px 48px; max-width: 1720px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 16px; }
.topbar h1 { font-size: 22px; font-weight: 700; color: var(--text-1); letter-spacing: -.3px; }
.user-info { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; box-shadow: 0 4px 10px rgba(37,99,235,.28); }
.logout { color: var(--danger); font-size: 13.5px; padding: 6px 12px; border-radius: 6px; transition: background .15s; cursor: pointer; font-weight: 600; margin-left: 4px; }
.logout:hover { background: var(--danger-bg); }
.content { flex: 1; min-width: 0; }

/* 用户菜单下拉 */
.user-menu-wrap { position: relative; cursor: pointer; user-select: none; }
.user-menu-wrap .user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border-radius: 10px; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15,23,42,.12), 0 2px 8px rgba(15,23,42,.06); min-width: 180px; padding: 6px; z-index: 200; display: none; text-align: left; }
.user-menu-wrap .user-dropdown.show { display: block; animation: dropdownIn .15s ease; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.user-menu-wrap .user-dropdown .item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; font-weight: 500; white-space: nowrap; }
.user-menu-wrap .user-dropdown .item:hover { background: var(--primary-light); color: var(--primary); }
.user-menu-wrap .user-dropdown .item.danger { color: var(--danger); }
.user-menu-wrap .user-dropdown .item.danger:hover { background: var(--danger-bg); color: var(--danger); }
.user-menu-wrap .user-dropdown .divider { height: 1px; background: var(--border); margin: 4px 8px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 500; border-left: 4px solid; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: var(--success-bg); color: var(--success-text); border-color: #22c55e; }
.flash-error { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger); }


/* ==========================================================================
   通用组件
   ========================================================================== */
/* 卡片 */
.card { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); padding: 24px 28px; box-shadow: var(--sh-xs); margin-bottom: 18px; }
.card h3 { font-size: 16px; font-weight: 700; color: var(--text-1); margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; letter-spacing: -.2px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 20px 22px; border: 1px solid var(--border); box-shadow: var(--sh-xs); transition: all .2s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat .label { font-size: 13px; color: var(--text-3); margin-bottom: 10px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 700; color: var(--text-1); line-height: 1.15; letter-spacing: -.8px; }
.stat.warn .value { color: #ea580c; }
.stat.danger .value { color: var(--danger); }
.stat.blue .value { color: var(--primary); }
.stat .sub { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }

/* 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.search-box { flex: 0 1 260px; min-width: 180px; max-width: 320px; display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--border-2); border-radius: var(--r-md); padding: 9px 14px; gap: 8px; transition: border-color .15s, box-shadow .15s; height: 40px; }
.search-box:hover { border-color: #9ca3af; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.search-box span { color: var(--text-3); font-size: 15px; flex-shrink: 0; }
.search-box input { border: none; outline: none; flex: 1; background: transparent; font-size: 14px; color: var(--text-1); min-width: 0; height: 100%; }
.search-box input::placeholder { color: var(--text-4); }

/* 按钮 */
.btn { border: none; border-radius: var(--r-md); padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s; white-space: nowrap; line-height: 1.5; height: 40px; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.2); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 10px rgba(37,99,235,.3); }
.btn-outline { background: #fff; border: 1.5px solid var(--border-2); color: var(--text-2); }
.btn-outline:hover { background: #fafafa; border-color: #9ca3af; color: var(--text-1); }
.btn-danger { background: #fff; color: var(--danger); border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 13px; height: 32px; border-radius: var(--r-sm); gap: 4px; }

/* 日期筛选 */
.date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border-2); border-radius: var(--r-md); padding: 4px 10px; height: 40px; flex: 0 0 auto; }
.date-range .date-icon { font-size: 14px; color: var(--text-3); flex-shrink: 0; }
.date-range input[type="date"] { border: none; outline: none; background: transparent; font-size: 13.5px; color: var(--text-1); padding: 4px 4px; height: 30px; font-family: inherit; cursor: pointer; min-width: 120px; }
.date-range input[type="date"]:focus { color: var(--primary); }
.date-range .sep { color: var(--text-3); font-size: 13px; margin: 0 2px; }
.date-range .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.date-range .quick-date { display: flex; gap: 3px; padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--border); }
.date-range .quick-date .btn-sm { height: 28px; padding: 0 8px; font-size: 12.5px; background: transparent; border: none; color: var(--text-2); }
.date-range .quick-date .btn-sm:hover { background: var(--primary-light); color: var(--primary); }
.date-filter-block { margin-bottom: 22px; }
.date-range .quick-date .btn-sm.btn-primary { background: var(--primary) !important; color: #ffffff !important; border-color: var(--primary) !important; }

/* 表格 */
.table-wrap { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--sh-xs); }
.table-wrap table { width: 100%; min-width: 780px; border-collapse: collapse; border-spacing: 0; table-layout: auto; }
.table-wrap thead th,
.table-wrap tbody td { padding: 10px 18px; font-size: 14px; line-height: 1.5; text-align: left; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border); box-sizing: border-box; height: 48px; }
.table-wrap thead th { background: #f8f9fb; color: #52525b; font-weight: 600; letter-spacing: 0; text-transform: none; border-bottom: 1.5px solid var(--border-2); user-select: none; height: 44px; }
.table-wrap tbody td { background: #ffffff; color: var(--text-1); font-weight: 400; }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: #fafbfc; }

/* 表格操作列 */
.table-wrap thead th:last-child,
.table-wrap tbody td:last-child {
    width: auto;
    min-width: 130px;
    text-align: center !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    white-space: nowrap;
    overflow: visible;
}
.table-wrap tbody td:last-child .btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    height: auto !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--primary) !important;
    box-shadow: none !important;
    margin-left: 0 !important;
    line-height: 1.4;
    border-radius: 0 !important;
    transition: color .15s;
    display: inline-block !important;
}
.table-wrap tbody td:last-child .btn:hover { color: var(--primary-hover) !important; text-decoration: underline; background: transparent !important; }
.table-wrap tbody td:last-child .btn.btn-danger { color: var(--danger) !important; }
.table-wrap tbody td:last-child .btn.btn-danger:hover { color: #b91c1c !important; background: transparent !important; }
.table-wrap tbody td:last-child .btn + .btn::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 12px;
    background: var(--border-2);
    margin: 0 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.table-wrap td a { color: var(--primary); font-weight: 500; transition: color .15s; }
.table-wrap td a:hover { color: var(--primary-hover); text-decoration: underline; }
.table-wrap td strong { font-weight: 600; color: var(--text-1); }
.table-wrap td .sub,
.table-wrap td small,
.table-wrap td div[style*="font-size:12px"],
.table-wrap td div[style*="font-size: 12px"] { color: var(--text-3) !important; font-size: 12.5px !important; }
.table-wrap td .btn-sm { padding: 5px 11px; font-size: 13px; height: 32px; border-radius: 8px; }

/* 表格汇总行 */
.table-wrap tfoot.table-summary td { background: #eff6ff !important; border-top: 2px solid var(--primary-border) !important; border-bottom: none !important; padding: 16px 18px !important; font-size: 14.5px !important; font-weight: 700 !important; color: #52525b !important; height: 56px !important; white-space: nowrap; vertical-align: middle; text-align: left; line-height: 1.5; }
.table-wrap tfoot.table-summary tr:hover td { background: #eff6ff !important; }
.table-wrap tfoot.table-summary td:last-child { width: auto !important; min-width: 130px !important; text-align: center !important; }
.table-wrap tfoot.table-summary .sum-num { color: #1d4ed8 !important; font-size: 15px !important; font-weight: 800 !important; }
.sum-mobile { background: #eff6ff !important; border-color: var(--primary-border) !important; border-width: 1.5px !important; }
.sum-mobile .sum-label { color: #52525b !important; font-weight: 700 !important; }
.sum-mobile .sum-val   { color: #1d4ed8 !important; font-weight: 800 !important; font-size: 15px !important; }

/* 徽章 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; letter-spacing: .1px; }
.badge-green { background: var(--success-bg); color: var(--success-text); }
.badge-amber { background: var(--warning-bg); color: var(--warning-text); }
.badge-red   { background: var(--danger-bg);  color: var(--danger-text); }
.badge-gray  { background: #f4f4f5;            color: var(--text-2); }
.badge-blue  { background: var(--primary-light); color: #1e40af; }

/* 表单 */
.card form { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 24px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.form-group label { display: block; font-size: 13.5px; color: var(--text-2); margin-bottom: 7px; font-weight: 600; text-align: left; line-height: 1.5; }
.form-group label span { color: var(--danger); margin-left: 2px; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; border: 1.5px solid var(--border-2); border-radius: var(--r-md); padding: 10px 14px; font-size: 14.5px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; color: var(--text-1); line-height: 1.5; height: 42px; }
.form-group textarea { height: auto; min-height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.6; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-4); }
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: #9ca3af; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.form-group select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2371717a' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; cursor: pointer; }
.form-group input[type="file"] { padding: 8px 12px; height: auto; min-height: 42px; cursor: pointer; font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; }
.form-group input[type="file"]::file-selector-button { background: #f4f4f5; color: var(--text-2); border: 1px solid var(--border-2); padding: 6px 12px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; margin-right: 12px; cursor: pointer; transition: all .15s; font-family: inherit; }
.form-group input[type="file"]::file-selector-button:hover { background: #e4e4e7; border-color: #9ca3af; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-actions .btn { min-width: 100px; height: 42px; padding: 10px 22px; font-size: 14.5px; }

/* 可搜索下拉 */
.ssd { position: relative; width: 100%; }
.ssd-input { width: 100%; border: 1.5px solid var(--border-2); border-radius: var(--r-md); padding: 10px 36px 10px 14px; font-size: 14.5px; background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2371717a' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right 14px center; outline: none; transition: border-color .15s, box-shadow .15s; color: var(--text-1); line-height: 1.5; height: 42px; cursor: text; }
.ssd-input::placeholder { color: var(--text-4); }
.ssd-input:hover { border-color: #9ca3af; }
.ssd-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.ssd-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(15,23,42,.12), 0 2px 8px rgba(15,23,42,.06); max-height: 280px; overflow-y: auto; z-index: 100; padding: 4px; }
.ssd-option { padding: 10px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 14.5px; color: var(--text-1); transition: background .1s; line-height: 1.5; }
.ssd-option:hover,
.ssd-option.highlight { background: var(--primary-light); color: var(--primary); }
.ssd-option.selected { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; align-items: center; }
.page-btn { min-width: 36px; height: 36px; border-radius: var(--r-sm); border: 1.5px solid var(--border-2); background: #fff; cursor: pointer; font-size: 13.5px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; font-weight: 600; transition: all .15s; }
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 加载 & 空状态 */
.loading { text-align: center; padding: 56px 20px; color: var(--text-3); font-size: 14px; }
.loading::before { content: ''; display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin-right: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading:has(*)::before,
.loading:not(:empty)::before { display: none !important; }
.loading:has(*),
.loading:not(:empty) { text-align: left !important; padding: 0 !important; color: inherit !important; font-size: inherit !important; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 14px; }


/* ==========================================================================
   移动端卡片与导航
   ========================================================================== */
.mobile-list { display: none; }
.m-card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; margin-bottom: 12px; border: 1px solid var(--border); box-shadow: var(--sh-xs); }
.m-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.m-title { font-weight: 700; font-size: 15.5px; color: var(--text-1); letter-spacing: -.2px; }
.m-sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.m-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: var(--text-1); gap: 14px; }
.m-row .m-label { color: var(--text-3); flex-shrink: 0; }
.m-row .m-val { text-align: right; word-break: break-all; font-weight: 500; }
.m-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.m-actions .btn { flex: 1; }

/* 底部导航 */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 100; box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.bn-item { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); padding: 6px 0; cursor: pointer; font-weight: 500; transition: color .15s; }
.bn-item i { display: block; font-size: 20px; font-style: normal; margin-bottom: 2px; }
.bn-item.active { color: var(--primary); font-weight: 700; }


/* ==========================================================================
   弹窗与详情 (全局默认配置：PC居中带遮罩)
   ========================================================================== */
/* 弹窗遮罩（半透明黑，阻止点击穿透） */
.modal-mask { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(15, 23, 42, 0.45) !important; 
    z-index: 1000; 
    display: flex; align-items: flex-start; justify-content: center; 
    padding: 20px; 
    overflow-y: auto; 
}

.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 780px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 12px 32px rgba(15, 23, 42, .18), 0 32px 80px rgba(15, 23, 42, .24); animation: modalBoxIn .24s cubic-bezier(.16, 1, .3, 1); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 40px); margin: auto; }
@keyframes modalBoxIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-1); letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; border: none; padding: 0; }
.modal-close { width: 34px; height: 34px; border: none; background: transparent; border-radius: 8px; color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.modal-close:hover { background: #f4f4f5; color: var(--text-1); }
.modal-body { padding: 26px; overflow-y: auto; flex: 1; }
.modal-body .form-grid { gap: 18px 22px; }
.modal-body .form-actions { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); position: sticky; bottom: -26px; background: #fff; margin-left: -26px; margin-right: -26px; padding-left: 26px; padding-right: 26px; padding-bottom: 20px; }

/* 弹窗头部操作按钮（最大化/关闭） */
.modal-header-actions { display: flex; align-items: center; gap: 4px; }
.modal-max { width: 34px; height: 34px; border: none; background: transparent; border-radius: 8px; color: var(--text-3); font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.modal-max:hover { background: #f4f4f5; color: var(--text-1); }

/* 弹窗最大化 */
.modal-box.maximized { max-width: calc(100vw - 20px) !important; width: calc(100vw - 20px) !important; max-height: calc(100vh - 20px) !important; height: calc(100vh - 20px) !important; }
.modal-box.maximized .modal-body { max-height: none; height: auto; flex: 1; }
.modal-mask.maximized-mask { padding: 10px !important; align-items: stretch !important; }
.modal-box.maximized .form-actions { position: static !important; margin-top: 20px !important; }

/* 客户/产品详情面板 */
.customer-detail-panel { background: #fff; border-radius: var(--r-lg); border: 1px solid var(--border); padding: 22px 26px; margin-bottom: 18px; box-shadow: var(--sh-xs); }
.customer-detail-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.customer-detail-hero h2 { font-size: 21px; font-weight: 700; color: var(--text-1); letter-spacing: -.3px; margin-bottom: 0; line-height: 1.3; }
.customer-detail-hero .meta { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.customer-detail-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 32px; }
.customer-detail-info .item { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.customer-detail-info .item.full { grid-column: 1 / -1; }
.customer-detail-info .item label { display: block; flex-shrink: 0; min-width: 100px; font-size: 13px; color: var(--text-3); font-weight: 500; letter-spacing: .1px; margin-bottom: 0; }
.customer-detail-info .item .val { flex: 1; min-width: 0; font-size: 14.5px; color: var(--text-1); font-weight: 500; line-height: 1.6; word-break: break-word; }


/* ==========================================================================
   ★ PC端详情弹窗高度加大 & 排版
   ========================================================================== */
.detail-view { display: flex; flex-direction: column; gap: 10px; }

/* Hero 区 */
.detail-hero { background: linear-gradient(135deg, #f0f9ff 0%, #dbeafe 100%); border: 1px solid #bfdbfe; border-radius: 12px; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 68px; }
.detail-hero .hero-main { flex: 1; min-width: 0; }
.detail-hero .hero-title { font-size: 17px; font-weight: 800; color: #0c4a6e; line-height: 1.35; margin-bottom: 2px; word-break: break-word; }
.detail-hero .hero-sub { font-size: 13px; color: #0369a1; font-weight: 500; word-break: break-word; line-height: 1.4; }
.detail-hero .hero-tags { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 280px; }
.detail-hero .hero-tags .badge { font-size: 11px; padding: 2px 8px; }

/* KPI 指标卡 */
.detail-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.detail-kpi-item { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; text-align: center; box-shadow: var(--sh-xs); display: flex; flex-direction: column; justify-content: center; min-height: 42px; transition: all .15s; }
.detail-kpi-item:hover { border-color: var(--border-2); }
.detail-kpi-item .kpi-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 2px; }
.detail-kpi-item .kpi-value { font-size: 14px; font-weight: 700; color: var(--text-1); line-height: 1.3; word-break: break-word; }
.detail-kpi-item.primary { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border-color: #bfdbfe; }
.detail-kpi-item.primary .kpi-label { color: #1e40af; }
.detail-kpi-item.primary .kpi-value { color: var(--primary); font-size: 16px; font-weight: 800; }
.detail-kpi-item.success { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: #bbf7d0; }
.detail-kpi-item.success .kpi-label { color: #166534; }
.detail-kpi-item.success .kpi-value { color: #15803d; font-size: 16px; font-weight: 800; }

/* 两列信息区 */
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.detail-body .detail-section.full { grid-column: 1 / -1; }

/* 信息分组卡片 */
.detail-section { background: #fff; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.detail-section-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 8px 14px; background: #fafbfc; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.detail-section-body { padding: 2px 14px 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 6px 0; gap: 16px; font-size: 13.5px; line-height: 1.5; border-bottom: 1px solid #f4f4f5; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-3); flex-shrink: 0; font-weight: 500; }
.detail-row .v { color: var(--text-1); font-weight: 500; text-align: right; word-break: break-word; min-width: 0; flex: 1; }

/* 备注 & 附件 */
.detail-remark { font-size: 13.5px; line-height: 1.6; color: var(--text-1); padding: 4px 0; word-break: break-word; }
.detail-atts { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 0; }
.detail-att { display: inline-flex; align-items: center; gap: 5px; background: #eff6ff; padding: 3px 9px; border-radius: 5px; font-size: 11.5px; color: var(--primary); border: 1px solid #bfdbfe; }
.detail-att:hover { background: var(--primary); color: #fff; }

/* ★ PC端专属：详情弹窗几乎撑满高度 */
@media (min-width: 901px) {
    .modal-mask.detail-mask {
        padding: 10px 20px !important; 
    }
    .modal-mask.detail-mask .modal-box {
        max-height: calc(100vh - 20px) !important;
    }
    .modal-mask.detail-mask .modal-body {
        padding: 16px 20px !important;
    }
}


/* ==========================================================================
   响应式 —— 平板及小窗口优化 (601px - 900px)
   ========================================================================== */
@media (max-width: 900px) {
    html { font-size: 14px; }
    .sidebar { display: none; }
    .main { padding: 12px 12px 80px; }
    .topbar { margin-bottom: 12px; gap: 8px; }
    .topbar h1 { font-size: 17px; letter-spacing: -.2px; }
    .hide-mobile { display: none; }
    .user-info { font-size: 12.5px; gap: 6px; }
    .avatar { width: 30px; height: 30px; font-size: 13px; }
    .logout { padding: 3px 8px; font-size: 12.5px; }

    /* 统计卡片 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
    .stat { padding: 14px 16px; border-radius: 12px; }
    .stat .value { font-size: 24px; letter-spacing: -.5px; }
    .stat .label { font-size: 13px; margin-bottom: 8px; gap: 4px; }
    .stat .sub { font-size: 11.5px; margin-top: 4px; }
    
    /* 切换卡片/表格 */
    .table-wrap { display: none; }
    .mobile-list { display: block; }
    .bottom-nav { display: flex; }

    /* 工具条 */
    .toolbar { gap: 6px; margin-bottom: 8px; }
    .toolbar .btn { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 7px; gap: 3px; }

    /* 搜索框 */
    .search-box { flex: 1 1 100%; max-width: 100%; min-width: 0; order: -1; padding: 6px 10px; height: 34px; border-radius: 8px; }
    .search-box span { font-size: 13px; }
    .search-box input { font-size: 13px; }

    /* 日期筛选 */
    .date-range { width: 100%; height: auto; padding: 6px 8px; gap: 4px; flex-wrap: wrap; border-radius: 8px; }
    .date-range .date-icon { display: none; }
    .date-range input[type="date"] { flex: 1 1 0; width: 0; min-width: 0; font-size: 13px; padding: 0; height: 32px; text-align: center; }
    .date-range .sep { font-size: 12px; margin: 0; } 
    .date-range .btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
    .date-range .quick-date { width: 100%; padding-left: 0; margin-left: 0; border-left: none; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; justify-content: space-between; gap: 6px; }
    .date-range .quick-date .btn-sm { flex: 1; padding: 0 4px; border: 1px solid var(--border-2); background: #fff; font-size: 13px; height: 28px; border-radius: 6px; }
    
    /* 通用按钮 */
    .btn { padding: 6px 12px; font-size: 12.5px; height: 34px; border-radius: 8px; gap: 4px; }
    .btn-sm { padding: 4px 8px; font-size: 12px; height: 28px; border-radius: 6px; }

    /* 卡片 */
    .card { padding: 14px 12px; border-radius: 10px; margin-bottom: 10px; }
    .card h3 { font-size: 14px; margin-bottom: 12px; padding-bottom: 8px; }

    /* 移动端卡片 */
    .m-card { padding: 14px; border-radius: 10px; margin-bottom: 10px; }
    .m-header { margin-bottom: 8px; }
    .m-title { font-size: 14px; }
    .m-sub { font-size: 11.5px; margin-top: 2px; }
    .m-row { padding: 3px 0; font-size: 12.5px; gap: 10px; }
    .m-actions { gap: 6px; margin-top: 10px; padding-top: 10px; }
    .m-actions .btn { height: 30px; padding: 0 8px; font-size: 12.5px; border-radius: 7px; font-weight: 500; gap: 0; }

    /* 徽章 */
    .badge { font-size: 10px; padding: 2px 7px; }

    /* 表单 */
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-group label { font-size: 12.5px; margin-bottom: 5px; }
    .form-group input, .form-group select, .form-group textarea { font-size: 14px; padding: 9px 12px; height: 40px; border-radius: 8px; }
    .form-group textarea { height: auto; min-height: 76px; }
    .form-actions { flex-direction: column-reverse; gap: 8px; margin-top: 18px; padding-top: 14px; }
    .form-actions .btn { width: 100%; height: 42px; font-size: 14px; }

    /* 弹窗基础 (平板/小窗：依然保持居中和遮罩) */
    .modal-mask { padding: 12px; align-items: center; background: rgba(15, 23, 42, 0.45) !important; }
    .modal-box { max-width: 100%; max-height: 96vh; border-radius: 16px; animation: modalBoxInMobile .28s cubic-bezier(.16, 1, .3, 1); margin: auto; }
    @keyframes modalBoxInMobile { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
    .modal-header { padding: 14px 16px; }
    .modal-header h3 { font-size: 15px; }
    .modal-body { padding: 16px; }
    .modal-body .form-actions { bottom: -16px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; padding-bottom: 12px; margin-top: 18px; padding-top: 12px; }

    /* ★ 详情弹窗：保持弹窗特性（带圆角、居中、可滑动） */
    .modal-mask.detail-mask { padding: 12px; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45) !important; }
    .modal-mask.detail-mask .modal-box { max-width: 100%; max-height: 96vh; border-radius: 16px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); animation: modalBoxInMobile .28s cubic-bezier(.16, 1, .3, 1); }
    
    .modal-mask.detail-mask .modal-header { padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fff; border-radius: 16px 16px 0 0; }
    .modal-mask.detail-mask .modal-header h3 { font-size: 15px; }
    .modal-mask.detail-mask .modal-close { width: 28px; height: 28px; font-size: 18px; }
    
    .modal-mask.detail-mask .modal-body { padding: 14px; background: #f4f4f5; }
    
    .modal-mask.detail-mask .form-actions { position: sticky; bottom: -14px; margin: 14px -14px -14px; padding: 10px 14px; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(0,0,0,.04); flex-direction: row; gap: 10px; border-radius: 0 0 16px 16px; }
    .modal-mask.detail-mask .form-actions .btn { flex: 1; height: 36px; font-size: 14px; }

    /* ★ 移动端详情极紧凑样式 */
    .detail-view { gap: 8px !important; }
    
    /* Hero */
    .detail-hero { padding: 12px 14px !important; border-radius: 10px !important; gap: 6px !important; min-height: auto !important; flex-direction: column !important; align-items: flex-start !important; }
    .detail-hero .hero-title { font-size: 15px !important; }
    .detail-hero .hero-sub { font-size: 12px !important; margin-bottom: 4px !important; }
    .detail-hero .hero-tags { justify-content: flex-start !important; max-width: 100% !important; }
    .detail-hero .hero-tags .badge { font-size: 10px !important; padding: 1px 6px !important; }

    /* KPI 进一步压扁、字体调小 */
    .detail-kpi-grid { gap: 6px !important; grid-template-columns: repeat(2, 1fr) !important; }
    .detail-kpi-item { padding: 6px 4px !important; min-height: 40px !important; border-radius: 8px !important; }
    .detail-kpi-item .kpi-label { font-size: 10px !important; margin-bottom: 1px !important; }
    .detail-kpi-item .kpi-value { font-size: 12px !important; }
    .detail-kpi-item.primary .kpi-value, .detail-kpi-item.success .kpi-value { font-size: 13px !important; }

    /* Info Cards */
    .detail-body { grid-template-columns: 1fr !important; gap: 8px !important; }
    .detail-section { border-radius: 10px !important; }
    .detail-section-title { font-size: 12px !important; padding: 8px 12px !important; }
    .detail-section-body { padding: 0 12px 4px !important; }
    .detail-row { padding: 6px 0 !important; font-size: 13px !important; }

    /* 底部按钮 */
    .modal-mask.detail-mask .form-actions { margin-top: 10px !important; padding-top: 10px !important; }

    .modal-max { display: none !important; }

    /* 客户详情 */
    .customer-detail-panel { padding: 14px; margin-bottom: 12px; }
    .customer-detail-hero { flex-direction: column; align-items: stretch; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; }
    .customer-detail-hero h2 { font-size: 16px; }
    .customer-detail-hero .btn { width: 100%; justify-content: center; height: 32px; font-size: 12.5px; }
    .customer-detail-info { grid-template-columns: 1fr; gap: 8px 0; }
    .customer-detail-info .item.full { grid-column: 1 / -1; }
    .customer-detail-info .item { gap: 8px; }
    .customer-detail-info .item label { min-width: 78px; font-size: 12px; }
    .customer-detail-info .item .val { font-size: 13px; line-height: 1.5; }

    /* 用户菜单、下拉、分页、导航 */
    .user-menu-wrap .user-dropdown { right: 0; min-width: 150px; }
    .user-menu-wrap .user-dropdown .item { padding: 10px 12px; font-size: 13.5px; }
    .ssd-input { font-size: 13.5px; padding: 9px 32px 9px 12px; height: 40px; }
    .ssd-panel { max-height: 220px; }
    .ssd-option { padding: 9px 12px; font-size: 13.5px; }
    .pagination { gap: 4px; margin-top: 14px; }
    .page-btn { min-width: 32px; height: 32px; font-size: 12.5px; padding: 0 8px; border-radius: 6px; }
    .bn-item { font-size: 10px; padding: 4px 0; }
    .bn-item i { font-size: 18px; margin-bottom: 1px; }
    .login-box { padding: 28px 20px; border-radius: 12px; }
    .login-box h2 { font-size: 20px; }
    .login-box .sub { font-size: 12.5px; margin-bottom: 22px; }
    .login-box label { font-size: 13px; }
    .login-box input { padding: 11px 14px; font-size: 14px; }
    .login-box .btn { padding: 12px; font-size: 15px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat .value { font-size: 18px; }
    .topbar h1 { font-size: 16px; }
    .customer-detail-info { grid-template-columns: 1fr; }
}


/* ★ 真正的手机端详情弹窗强制全屏（600px 以下） */
@media (max-width: 600px) {
    .modal-mask.detail-mask { padding: 0; align-items: stretch; justify-content: stretch; background: #f4f4f5 !important; background-color: #f4f4f5 !important; }
    .modal-mask.detail-mask .modal-box { max-width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; box-shadow: none; animation: detailSlideIn .28s cubic-bezier(.16, 1, .3, 1); }
    @keyframes detailSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
    
    .modal-mask.detail-mask .modal-header { padding: 8px 14px; border-radius: 0; }
    .modal-mask.detail-mask .modal-body { padding: 12px; }
    .modal-mask.detail-mask .form-actions { position: sticky; bottom: 0; margin: 12px -12px -12px; padding: 10px 12px; border-radius: 0; }
}


/* ★ 移动端产品详情强制3列 */
@media (max-width: 900px) {
    .product-kpi-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    /* 3列时字太小可以稍微紧凑一点 */
    .product-kpi-grid .detail-kpi-item {
        padding: 6px 2px !important;
    }
    .product-kpi-grid .kpi-value {
        font-size: 12px !important;
    }
    .product-kpi-grid .detail-kpi-item.primary .kpi-value {
        font-size: 13px !important;
    }
}