/* ============================================
   客户管理系统 - 主样式
   现代化科技风格
   ============================================ */

/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: rgba(99, 102, 241, 0.08);
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-body: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;
    --bg-modal: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #475569;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-width: 240px;
    --header-height: 60px;

    --transition: all 0.2s ease;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 30%, #0f172a 60%, #042f2e 100%);
    overflow: hidden;
}

.login-overlay[data-theme="light"] {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 30%, #f0f9ff 60%, #d1fae5 100%);
}

#loginParticles {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 44px 40px 36px;
    margin: 20px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 20px;
    box-shadow:
        0 25px 80px rgba(0,0,0,0.5),
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 1px 0 rgba(255,255,255,0.08) inset;
    animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(99,102,241,0.15);
    box-shadow:
        0 25px 80px rgba(99,102,241,0.12),
        0 0 0 1px rgba(99,102,241,0.08) inset,
        0 1px 0 rgba(255,255,255,0.6) inset;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 14px;
    box-shadow: 0 6px 24px rgba(99,102,241,0.45);
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-logo h2 {
    color: #f1f5f9;
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

[data-theme="light"] .login-logo h2 {
    color: #1e293b;
}

.login-subtitle {
    color: rgba(148,163,184,0.8);
    font-size: 14px;
    margin: 0;
}

[data-theme="light"] .login-subtitle {
    color: #64748b;
}

/* ===== 励志一言 ===== */
.login-quote {
    text-align: center;
    margin: 0 0 28px;
    padding: 14px 18px;
    background: rgba(99,102,241,0.08);
    border-left: 3px solid rgba(99,102,241,0.5);
    border-radius: 0 10px 10px 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.5s ease;
}

[data-theme="light"] .login-quote {
    background: rgba(99,102,241,0.06);
    border-left-color: rgba(99,102,241,0.35);
}

.quote-mark {
    font-size: 22px;
    font-weight: 700;
    color: rgba(99,102,241,0.4);
    font-family: Georgia, serif;
    line-height: 1;
    flex-shrink: 0;
}

.quote-text {
    color: rgba(203,213,225,0.9);
    font-size: 13.5px;
    line-height: 1.7;
    font-style: italic;
    transition: opacity 0.3s ease;
}

[data-theme="light"] .quote-text {
    color: #475569;
}

/* ===== 输入框组 ===== */
.login-input-group {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

.login-card .form-group {
    margin-bottom: 18px;
}

.login-card .form-label {
    display: none;
}

.login-card .form-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(15,23,42,0.4);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

[data-theme="light"] .login-card .form-input {
    background: rgba(255,255,255,0.8);
    border-color: rgba(99,102,241,0.15);
    color: #1e293b;
}

.login-card .form-input::placeholder {
    color: rgba(100,116,139,0.6);
}

[data-theme="light"] .login-card .form-input::placeholder {
    color: #94a3b8;
}

.login-card .form-input:focus {
    border-color: rgba(99,102,241,0.6);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: rgba(15,23,42,0.55);
}

[data-theme="light"] .login-card .form-input:focus {
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    background: rgba(255,255,255,0.95);
}

.login-error {
    padding: 10px 14px;
    margin-bottom: 14px;
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 13px;
}

[data-theme="light"] .login-error {
    background: rgba(239,68,68,0.08);
    color: #dc2626;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 4px;
}

.login-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #6366f1, #06b6d4) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99,102,241,0.35);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(99,102,241,0.45);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}

/* ===== 登录底部 ===== */
.login-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(100,116,139,0.5);
    font-size: 12px;
}

[data-theme="light"] .login-footer {
    color: #94a3b8;
}

/* ===== 登录页响应式 ===== */
@media (max-width: 480px) {
    .login-card {
        margin: 16px;
        padding: 32px 24px 28px;
        border-radius: 16px;
    }
    .logo-lg { width: 50px; height: 50px; font-size: 22px; }
    .login-logo h2 { font-size: 20px; }
    .quote-text { font-size: 12.5px; }
}
}

/* ============================================
   USER MENU (Header)
   ============================================ */
.user-menu {
    position: relative;
    margin-left: 12px;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.user-menu-btn:hover {
    background: var(--primary-bg);
    border-color: var(--border-color);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.user-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-arrow {
    font-size: 10px;
    opacity: 0.6;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 6px;
    z-index: 200;
}

.user-dropdown.active {
    display: block;
    animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--primary-bg);
    color: var(--text-primary);
}

.dropdown-item-danger:hover {
    background: rgba(239,68,68,0.1);
    color: var(--danger, #ef4444);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ============================================
   LIGHT THEME (亮色主题)
   ============================================ */
[data-theme="light"] {
    --primary-bg: rgba(99, 102, 241, 0.06);

    --bg-body: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f1f5f9;
    --bg-modal: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.12);
}

/* Theme transition */
body, .sidebar, .header, .card, .stat-card, .modal,
.form-input, .form-select, .form-textarea, .search-box input,
.pagination-btns button, .btn, .toolbar,
thead th, tbody td, .nav-item, .modal-overlay {
    transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Theme toggle button */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--border-color);
    border: 1px solid var(--border-light);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.theme-toggle .toggle-track {
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 11px;
    color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="light"] .theme-toggle .toggle-track {
    transform: translateX(20px);
}
.theme-toggle .toggle-track .icon-moon { display: inline; }
.theme-toggle .toggle-track .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .toggle-track .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .toggle-track .icon-sun { display: inline; }

/* Light theme badge adjustments */
[data-theme="light"] .badge-pending { background: rgba(245,158,11,0.12); color: #d97706; }
[data-theme="light"] .badge-contract_returned { background: rgba(139,92,246,0.12); color: #7c3aed; }
[data-theme="light"] .badge-awaiting_shipment { background: rgba(59,130,246,0.12); color: #2563eb; }
[data-theme="light"] .badge-completed, [data-theme="light"] .badge-delivered, [data-theme="light"] .badge-paid { background: rgba(16,185,129,0.12); color: #059669; }
[data-theme="light"] .badge-cancelled, [data-theme="light"] .badge-returned, [data-theme="light"] .badge-refunded { background: rgba(239,68,68,0.12); color: #dc2626; }
[data-theme="light"] .badge-shipped { background: rgba(6,182,212,0.12); color: #0891b2; }
[data-theme="light"] .badge-in_transit { background: rgba(99,102,241,0.12); color: #4f46e5; }
[data-theme="light"] .badge-partial { background: rgba(168,85,247,0.12); color: #7c3aed; }

/* Light theme scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track { background: #f1f5f9; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Light theme key-row */
[data-theme="light"] .key-row { background: rgba(99,102,241,0.04) !important; }

/* Light theme stat card text */
[data-theme="light"] .stat-label { color: var(--text-muted); }

/* Light theme stats tab adjustments */
[data-theme="light"] .stats-tab:hover {
    background: rgba(0,0,0,0.04);
}
[data-theme="light"] .stats-tab.active {
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}
.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: bold; color: white;
    box-shadow: var(--shadow-glow);
}
.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-group-title {
    padding: 8px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 13px;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary-light);
    border-left-color: var(--primary);
}
.nav-item .icon { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-left .menu-toggle {
    display: none;
    background: none; border: none; color: var(--text-primary);
    font-size: 20px; cursor: pointer; padding: 4px;
}
.header-left .breadcrumb { font-size: 14px; color: var(--text-secondary); }
.header-left .breadcrumb span { color: var(--text-primary); font-weight: 500; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-right .time-display { color: var(--text-muted); font-size: 12px; }

/* Page Content */
.page-content { flex: 1; padding: 24px; }
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.card-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* Stat Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.blue::before { background: linear-gradient(90deg, var(--info), var(--primary)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), var(--accent)); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--warning), #fb923c); }
.stat-card.red::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.cyan::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-value.blue { color: var(--info); }
.stat-value.green { color: var(--success); }
.stat-value.orange { color: var(--warning); }
.stat-value.red { color: var(--danger); }
.stat-value.cyan { color: var(--accent); }
.stat-value.purple { color: var(--primary-light); }
.stat-change { font-size: 12px; color: var(--text-muted); }

/* Stats Page - 胶囊式 Tab 导航 */
.stats-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 5px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.stats-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.25s ease;
    white-space: nowrap;
    user-select: none;
    position: relative;
}
.stats-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}
.stats-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.stats-tab-icon {
    font-size: 15px;
    line-height: 1;
}
/* 移动端适配 */
@media (max-width: 768px) {
    .stats-tabs {
        gap: 4px;
        padding: 4px;
        border-radius: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .stats-tabs::-webkit-scrollbar { display: none; }
    .stats-tab {
        flex: 0 0 auto;
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 6px;
    }
}
@media (max-width: 480px) {
    .stats-tab span:not(.stats-tab-icon) { display: none; }
    .stats-tab { flex: 1; padding: 10px 12px; }
}

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
}
tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:hover td { color: var(--text-primary); }

/* Stars */
.stars { color: var(--warning); letter-spacing: 1px; }
.stars .empty { color: var(--text-muted); }
.clickable-stars { display: inline-flex; gap: 2px; }
.clickable-stars .star-btn { transition: transform 0.15s, color 0.15s; }
.clickable-stars .star-btn:hover { transform: scale(1.2); }
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th:hover { color: var(--primary-light); }

/* Status Badges */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-pending { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-contract_returned { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-awaiting_shipment { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-completed, .badge-delivered, .badge-paid { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-cancelled, .badge-returned, .badge-refunded { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-shipped { background: rgba(6,182,212,0.15); color: #22d3ee; }
.badge-in_transit { background: rgba(99,102,241,0.15); color: #818cf8; }
.badge-partial { background: rgba(168,85,247,0.15); color: #c084fc; }

/* Key Customer Badge */
.key-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99,102,241,0.15);
    color: var(--primary-light);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: var(--shadow-glow); }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
    padding: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    font-size: inherit;
    line-height: 1;
}
.btn-icon span { font-size: 11px; }
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.15); color: var(--danger); }
.action-btns .btn-icon { padding: 4px 6px; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Star Rating */
.star-rating { display: flex; gap: 4px; }
.star-rating .star {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}
.star-rating .star.active, .star-rating .star:hover { color: var(--warning); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}
.modal-lg { max-width: 800px; }

/* 交易详情Tab */
.txn-tab {
    padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all .2s; font-weight: 500;
}
.txn-tab:hover { color: var(--text-primary); }
.txn-tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* 产品补全弹框 */
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}
.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .form-select, .filter-bar .form-input {
    width: auto;
    min-width: 140px;
    padding: 7px 10px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.pagination-info { font-size: 12px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 4px; }
.pagination-btns button {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}
.pagination-btns button:hover { background: var(--bg-card-hover); }
.pagination-btns button.active { background: var(--primary); border-color: var(--primary); color: white; }
.pagination-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Grid Layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Mindmap Container */
.mindmap-container {
    width: 100%;
    min-height: 500px;
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; }
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 13px;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
}
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Chart Container */
.chart-container { position: relative; width: 100%; height: 300px; }
.chart-container canvas { width: 100% !important; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.file-upload:hover { border-color: var(--primary); background: var(--primary-bg); }
.file-upload input[type="file"] { display: none; }
.file-upload .upload-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
.file-upload p { color: var(--text-muted); font-size: 13px; }

/* Detail View */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { }
.detail-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.detail-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 16px; gap: 0; }
.tab {
    padding: 10px 20px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* Action buttons in table */
.action-btns { display: flex; gap: 4px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Key customer highlight */
.key-row { background: rgba(99,102,241,0.05) !important; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .header-left .menu-toggle { display: block; }
    .page-content { padding: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .form-row { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .modal { max-width: 100%; margin: 10px; max-height: 90vh; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .card-header { flex-direction: column; align-items: flex-start; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 20px; }
    .tabs { overflow-x: auto; }
    .tab { padding: 8px 14px; white-space: nowrap; }
}

/* Print */
@media print {
    .sidebar, .header, .toolbar, .pagination, .modal-overlay { display: none !important; }
    .main-content { margin-left: 0; }
    .page-content { padding: 0; }
}

/* ============================================================
   MINDMAP - 企业关系思维导图
   ============================================================ */

/* 全屏遮罩 */
.mm-overlay {
    z-index: 1100 !important;
    align-items: stretch !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(6px);
}

/* 弹窗主体 */
.mm-modal {
    display: flex;
    flex-direction: column;
    width: 96vw;
    height: 92vh;
    max-width: 1400px;
    max-height: 92vh;
    margin: auto;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

/* 头部工具栏 */
.mm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.mm-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mm-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mm-icon { font-size: 20px; }

.mm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-badge {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 头部按钮 */
.mm-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
    line-height: 1.4;
}
.mm-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.mm-btn-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
}
.mm-btn-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* 画布容器 */
.mm-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 25% 25%, rgba(99,102,241,0.04) 0%, transparent 60%),
        radial-gradient(circle at 75% 75%, rgba(6,182,212,0.03) 0%, transparent 60%),
        var(--bg-base);
    cursor: default;
    user-select: none;
}

/* 网格背景点 */
.mm-canvas-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0.3;
    pointer-events: none;
}

/* SVG主体 */
.mm-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 节点hover效果 */
.mm-node:hover .mm-node-circle {
    filter: brightness(1.15) drop-shadow(0 0 8px currentColor);
    transition: filter 0.15s;
}

/* 连线hover效果 */
.mm-edge:hover .mm-edge-path {
    stroke-width: 3.5 !important;
    opacity: 1 !important;
}

/* 缩放控制按钮 */
.mm-zoom-ctrl {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}
.mm-zoom-ctrl button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mm-zoom-ctrl button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 图例 */
.mm-legend {
    position: absolute;
    bottom: 24px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-secondary);
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.mm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mm-legend-node {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.mm-legend-node.center  { background: #6366f1; }
.mm-legend-node.key     { background: #f59e0b; }
.mm-legend-node.normal  { background: var(--border-color); border: 1px solid var(--text-muted); }
.mm-tip { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* 连线颜色预设 */
.mm-color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.mm-color-dot:hover {
    transform: scale(1.2);
    border-color: rgba(255,255,255,0.5);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .mm-modal {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
    .mm-overlay { padding: 0 !important; }
    .mm-header { padding: 10px 14px; }
    .mm-title { font-size: 14px; }
    .mm-btn { padding: 5px 10px; font-size: 11px; }
    .mm-legend { display: none; }
    .mm-badge { display: none; }
}

/* ============================================================
   右键菜单 & 公司画像节点样式
   ============================================================ */

/* 右键菜单项 */
.ctx-item {
    padding: 9px 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.ctx-item:hover { background: var(--bg-card-hover); }
.ctx-item.ctx-danger { color: var(--danger, #ef4444); }
.ctx-item.ctx-danger:hover { background: rgba(239,68,68,0.1); }

/* 画像节点悬停 */
.cp-node rect { transition: stroke-width 0.15s, opacity 0.15s; }
.cp-node:hover > rect:nth-of-type(2) {
    stroke-width: 2.5 !important;
    filter: url(#mm-shadow) brightness(1.18);
}
.cp-node:hover > rect:first-of-type {
    opacity: 0.22 !important;
}

/* 节点tooltip气泡（通过title实现原生tooltip） */
.cp-node { cursor: pointer; }

/* ========== 产品管理模块 ========== */
.prod-mgmt-layout {
    display: flex;
    gap: 16px;
    height: calc(100vh - 80px);
    padding: 0;
}
.prod-tree-panel {
    width: 260px;
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.prod-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 14px 10px;
}
.prod-tree-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
}
.prod-tree-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.15s;
    user-select: none;
}
.prod-tree-item:hover { background: rgba(99,102,241,0.08); color: var(--text-primary); }
.prod-tree-item.active { background: rgba(99,102,241,0.15); color: var(--primary-light); font-weight: 600; }
.prod-tree-item .tree-expand { width: 18px; text-align: center; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.prod-tree-item .tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-tree-item .tree-count { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.prod-tree-item .tree-actions { display: none; gap: 2px; flex-shrink: 0; }
.prod-tree-item:hover .tree-actions { display: flex; }
.prod-tree-children { padding-left: 16px; }
.prod-tree-item.collapsed > .tree-expand { transform: rotate(0deg); }
.prod-tree-item.collapsed > .tree-expand::after { content: '▶'; }
.prod-tree-item:not(.collapsed) > .tree-expand::after { content: '▼'; }
.prod-tree-item.collapsed + .prod-tree-children { display: none; }
.prod-list-panel {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.prod-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 10px;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.prod-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.prod-list-body .table-wrapper { border-radius: 0; }
.prod-list-body table th { position: sticky; top: 0; z-index: 1; }

/* 导入预览表格 */
#pm-import-table th, #pm-import-table td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}
#pm-import-table th {
    background: rgba(99,102,241,0.1);
    color: var(--primary-light);
    font-size: 12px;
}
#pm-import-table td { font-size: 12px; color: var(--text-secondary); }

/* 自定义属性配置 */
.pm-cf-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.pm-cf-row label {
    font-size: 13px;
    color: var(--text-muted);
    width: 60px;
    flex-shrink: 0;
}
.pm-cf-row input {
    flex: 1;
}

/* ==========================================
   报价自动补全下拉
   ========================================== */
.quo-ac-drop {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    max-width: 380px;
    background: var(--card-bg, #1e2638);
    border: 1px solid var(--border, #334155);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 9999;
    max-height: 220px;
    overflow-y: auto;
}
.quo-ac-item {
    padding: 7px 12px;
    font-size: 13px;
    color: var(--text, #e2e8f0);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}
.quo-ac-item:first-child { border-radius: 8px 8px 0 0; }
.quo-ac-item:last-child  { border-radius: 0 0 8px 8px; }
.quo-ac-item:hover {
    background: rgba(59,130,246,0.18);
    color: var(--primary-light, #93c5fd);
}

/* 报价管理表格紧凑布局 */
#quo-section-body .table-wrapper { overflow-x: hidden; }
#quo-section-body table { font-size: 12px; }
#quo-section-body thead th { padding: 7px 8px; font-size: 11px; }
#quo-section-body tbody td { padding: 6px 8px; }
#quo-section-body .form-input { padding: 5px 7px; font-size: 12px; }
