/* ===== CSS Variables ===== */
:root {
    --primary: #4f8cff;
    --primary-dark: #3a6fd9;
    --primary-light: #e8f1ff;
    --primary-bg: #f0f5ff;
    --success: #34c759;
    --success-light: #e8f9ed;
    --warning: #ff9500;
    --warning-light: #fff5e6;
    --danger: #ff3b30;
    --danger-light: #ffeaea;
    --info: #5ac8fa;
    --info-light: #e6f7ff;
    --purple: #af52de;
    --purple-light: #f5ecff;

    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1e2330;
    --bg-sidebar-hover: #2a3040;
    --bg-sidebar-active: #4f8cff;

    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-sidebar: #a0aec0;
    --text-sidebar-active: #ffffff;

    --border-color: #e8eaed;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    --sidebar-width: 240px;
    --header-height: 56px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; outline: none; }

/* ===== Layout ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    z-index: 100;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-detail { display: none; }

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo i { font-size: 22px; color: var(--primary); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-group { margin-bottom: 8px; }
.nav-group-title {
    padding: 8px 20px 4px;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-sidebar);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #fff;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    position: relative;
}
.user-info { display: flex; align-items: center; gap: 10px; transition: background 0.2s; border-radius: 8px; padding: 4px; }
.user-info:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
    width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, #4f8cff, #6c5ce7);
}
.user-detail { color: #fff; flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.user-chevron { color: rgba(255,255,255,0.4); font-size: 10px; transition: transform 0.2s; }
.user-info:hover .user-chevron { color: rgba(255,255,255,0.8); }
.sidebar.collapsed .user-detail,
.sidebar.collapsed .user-chevron { display: none; }
.sidebar.collapsed .user-dropdown { left: 60px !important; right: auto !important; bottom: 0 !important; }

/* ===== 用户下拉菜单 ===== */
.user-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    z-index: 1000;
    overflow: hidden;
    animation: dropdownSlide 0.2s ease;
}
.user-dropdown.show { display: block; }
@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.user-dropdown-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; background: #f7f8fa; border-bottom: 1px solid #f0f0f0;
}
.user-dropdown-name { font-size: 14px; font-weight: 600; color: #1a1a2e; }
.user-dropdown-role { font-size: 12px; color: #8c8c8c; margin-top: 2px; }
.user-dropdown-body { padding: 6px 0; }
.user-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; cursor: pointer;
    font-size: 13px; color: #333; transition: background 0.15s;
}
.user-dropdown-item:hover { background: #f5f5f5; }
.user-dropdown-item i { width: 16px; text-align: center; color: #8c8c8c; }
.user-dropdown-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }
.user-dropdown-logout { color: #ff3b30; }
.user-dropdown-logout i { color: #ff3b30; }
.user-dropdown-logout:hover { background: #fff1f0; }

/* ===== Main Wrapper ===== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Top Header ===== */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.toggle-sidebar {
    font-size: 18px;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s;
}
.toggle-sidebar:hover { background: var(--bg-body); color: var(--text-primary); }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.breadcrumb i { font-size: 10px; }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 16px; }
.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border-radius: 20px;
    padding: 6px 14px;
    width: 240px;
    transition: all 0.2s;
}
.header-search:focus-within { box-shadow: 0 0 0 2px var(--primary-light); }
.header-search i { color: var(--text-tertiary); font-size: 13px; }
.header-search input { border: none; background: none; flex: 1; font-size: 13px; }

.header-btn {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s;
}
.header-btn:hover { background: var(--bg-body); color: var(--text-primary); }
.btn-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===== Content ===== */
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }

/* ===== Page Components ===== */
.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.page-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.card-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ===== Stat Cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-card-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.stat-card-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.green { background: var(--success-light); color: var(--success); }
.stat-card-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-card-icon.cyan { background: var(--info-light); color: var(--info); }

.stat-card-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-card-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-card-trend { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 8px; }
.stat-card-trend.up { color: var(--success); }
.stat-card-trend.down { color: var(--danger); }

/* ===== Inline Stat Strip (single row) ===== */
.stat-strip {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.stat-strip-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-right: 1px solid var(--border-color);
    transition: background 0.2s;
    position: relative;
}
.stat-strip-item:last-child { border-right: none; }
.stat-strip-item:hover { background: var(--bg-body); }
.stat-strip-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-strip-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-strip-icon.green { background: var(--success-light); color: var(--success); }
.stat-strip-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-strip-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-strip-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-strip-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-strip-info { flex: 1; min-width: 0; }
.stat-strip-value { font-size: 24px; font-weight: 700; line-height: 1.3; }
.stat-strip-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strip-trend { display: flex; align-items: center; gap: 3px; font-size: 11px; margin-top: 4px; }
.stat-strip-trend.up { color: var(--success); }
.stat-strip-trend.down { color: var(--danger); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-body);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--primary-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== Badges & Tags ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #f3f4f6; color: var(--text-secondary); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-cyan { background: var(--info-light); color: var(--info); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border-color); color: var(--text-primary); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: #fff; }
.btn-text { color: var(--primary); padding: 4px 8px; }
.btn-text:hover { background: var(--primary-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-primary); }
.form-label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    background: #fff;
    transition: all 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-static { padding: 8px 12px; background: var(--bg-secondary, #f5f7fa); border: 1px solid var(--border-color, #e4e7ed); border-radius: 6px; font-size: 14px; min-height: 36px; display: flex; align-items: center; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 160px; }

/* ===== Search Select Component ===== */
.search-select-wrapper { position: relative; width: 100%; }
.search-select-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 13px; background: #fff; transition: all 0.2s; box-sizing: border-box; }
.search-select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-select-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 9999;
    max-height: 260px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border-color); border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); margin-top: 2px;
}
.search-select-option { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
.search-select-option:hover { background: var(--primary-light); }
.search-select-option:last-child { border-bottom: none; }
.search-select-option-main { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-select-option-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.search-select-empty { padding: 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* ===== Approval Flow Configuration ===== */
.flow-node-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #f8faff; border: 1px solid #e0e8ff; border-radius: 8px; margin-bottom: 8px; position: relative; }
.flow-node-card .flow-node-index { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.flow-node-card .flow-node-info { flex: 1; }
.flow-node-card .flow-node-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.flow-node-card .flow-node-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.flow-node-arrow { text-align: center; color: var(--text-tertiary); margin: 4px 0; }
.flow-config-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.flow-config-item select, .flow-config-item input { flex: 1; }
/* ===== 审批流程节点卡片 ===== */
.flow-node-card { border: 1px solid var(--border-color, #e4e7ed); border-radius: 8px; padding: 12px; margin-bottom: 12px; background: var(--bg-card, #fff); }
.flow-node-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.flow-node-num { min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: var(--primary, #4080ff); color: #fff; border-radius: 50%; font-size: 12px; font-weight: 700; }
.flow-node-body { padding-left: 32px; }
.flow-node-row { display: flex; gap: 8px; align-items: center; }
/* ===== 部门负责人人员选择器 ===== */
.manager-picker { position: relative; }
.manager-picker-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050; background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e4e7ed); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 240px; overflow-y: auto; }
.manager-picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-color, #eef0f3); }
.manager-picker-item:last-child { border-bottom: none; }
.manager-picker-item:hover { background: #f5f8ff; }
.manager-picker-item .font-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manager-picker-empty { padding: 12px; text-align: center; color: var(--text-tertiary, #999); font-size: 13px; }
.flow-node-row .form-select { flex: 1; }
.multi-select-hint { font-size: 12px; color: var(--text-secondary, #86909c); margin-bottom: 4px; }
.checkbox-panel { max-height: 160px; overflow-y: auto; border: 1px solid var(--border-color, #e4e7ed); border-radius: 6px; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px; background: var(--bg-secondary, #f7f8fa); }
.checkbox-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; transition: background 0.15s; }
.checkbox-item:hover { background: var(--primary-light, #e8f3ff); }
.checkbox-item input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; margin: 0; }
.checkbox-item span:nth-child(2) { font-weight: 500; }

/* ===== Finance Merged View ===== */
.finance-project-group { margin-bottom: 16px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.finance-project-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #f0f5ff; cursor: pointer; }
.finance-project-header:hover { background: #e8efff; }
.finance-project-header .project-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.finance-project-header .project-summary { font-size: 12px; color: var(--text-tertiary); }
.finance-project-body { display: none; }
.finance-project-body.expanded { display: block; }
.finance-sub-table { margin: 0; }
.finance-sub-table th { background: #fafbfc; font-size: 12px; }
.finance-sub-table td { font-size: 13px; }

/* ===== Progress Bar ===== */
.progress { height: 8px; background: var(--bg-body); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-bar.blue { background: var(--primary); }
.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--warning); }
.progress-bar.red { background: var(--danger); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-color); margin-bottom: 16px; }
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--bg-body); }
.tab.active .tab-badge { background: var(--primary-light); color: var(--primary); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff;
    border-radius: var(--border-radius-lg);
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal.modal-lg { width: 800px; }
.modal.modal-xl { width: 1000px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { font-size: 18px; color: var(--text-tertiary); padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== Opportunity Search Dropdown ===== */
.opp-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    margin-top: 4px;
}
.opp-dropdown-loading,
.opp-dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary, #999);
    font-size: 14px;
}
.opp-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.opp-dropdown-item:last-child {
    border-bottom: none;
}
.opp-dropdown-item:hover {
    background: #f5f7fa;
}
.opp-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}
.opp-item-meta {
    font-size: 12px;
    color: #999;
}
.opp-selected {
    margin-top: 8px;
    align-items: center;
    gap: 6px;
}
.opp-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f4fd;
    color: #1890ff;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}
.opp-tag-close {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.opp-tag-close:hover {
    opacity: 1;
}

/* ===== Notification Panel ===== */
.notif-panel {
    position: fixed;
    top: var(--header-height);
    right: 24px;
    width: 360px;
    background: #fff;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 200;
    display: none;
}
.notif-panel.show { display: block; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.notif-panel-header a { font-size: 13px; color: var(--primary); }
.notif-panel-body { max-height: 400px; overflow-y: auto; }
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: var(--bg-body); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.notif-content { flex: 1; }
.notif-title { font-size: 13px; font-weight: 500; }
.notif-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ===== Chart Container ===== */
.chart-container { width: 100%; height: 300px; }
.chart-container-sm { width: 100%; height: 240px; }
.chart-container-lg { width: 100%; height: 380px; }

/* ===== Avatar ===== */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid #fff; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 4px; bottom: 4px;
    width: 2px;
    background: var(--border-color);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -28px; top: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--border-color);
}
.timeline-dot.blue { background: var(--primary); }
.timeline-dot.green { background: var(--success); }
.timeline-dot.orange { background: var(--warning); }
.timeline-dot.red { background: var(--danger); }
.timeline-dot.gray { background: var(--text-tertiary); }
.timeline-content { }
.timeline-title { font-size: 14px; font-weight: 500; }
.timeline-time { font-size: 12px; color: var(--text-tertiary); }
.timeline-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Alert/Warning Cards ===== */
.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    border: 1px solid;
}
.alert-card.blue { background: #f0f7ff; border-color: #cce0ff; }
.alert-card.orange { background: #fff8f0; border-color: #ffd9b3; }
.alert-card.red { background: #fff5f5; border-color: #ffb3b3; }
.alert-card.green { background: #f0fff4; border-color: #b3e6c4; }
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.alert-card.blue .alert-icon { color: var(--primary); }
.alert-card.orange .alert-icon { color: var(--warning); }
.alert-card.red .alert-icon { color: var(--danger); }
.alert-card.green .alert-icon { color: var(--success); }
.alert-body { flex: 1; }
.alert-title { font-size: 14px; font-weight: 600; }
.alert-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.alert-time { font-size: 12px; color: var(--text-tertiary); }

/* ===== Kanban Board ===== */
.kanban { display: flex; gap: 16px; overflow-x: auto; min-height: 400px; }
.kanban-column {
    flex: 1;
    min-width: 260px;
    background: var(--bg-body);
    border-radius: var(--border-radius-lg);
    padding: 12px;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 4px 4px;
}
.kanban-column-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kanban-count { font-size: 12px; color: var(--text-tertiary); }
.kanban-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kanban-card-meta-item { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }

/* ===== Search/Filter Section ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; }
.empty-state-text { font-size: 14px; }

/* ===== Misc ===== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text-secondary); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 600; }
.font-lg { font-size: 16px; }
.font-sm { font-size: 12px; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }

/* ===== Severity Indicators ===== */
.severity-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.severity-blue { background: #e6f0ff; color: #1965ff; }
.severity-orange { background: #fff3e0; color: #e65100; }
.severity-red { background: #ffebee; color: #c62828; }

/* ===== Toggle Switch ===== */
.toggle {
    position: relative;
    width: 40px; height: 22px;
    background: #d0d5dd;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle.active { background: var(--primary); }
.toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle.active::after { transform: translateX(18px); }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -240px; height: 100vh; }
    .sidebar.show { left: 0; }
    .stat-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
    .header-search { display: none; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ===== AI Assistant ===== */
.ai-fab {
    position: fixed; bottom: 32px; right: 32px; z-index: 999;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #4f8cff, #6c5ce7);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 24px; cursor: pointer; box-shadow: 0 4px 20px rgba(79,140,255,0.4);
    transition: all 0.3s;
}
.ai-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(79,140,255,0.5); }
.ai-fab-pulse {
    position: absolute; top: -2px; right: -2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #34c759; border: 2px solid #fff;
    animation: aiPulse 2s infinite;
}
@keyframes aiPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.ai-panel {
    position: fixed; bottom: 100px; right: 32px; z-index: 999;
    width: 420px; height: 600px; max-height: calc(100vh - 140px);
    background: #fff; border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    display: flex; flex-direction: column; overflow: hidden;
    transform: translateX(480px); opacity: 0;
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
.ai-panel.show { transform: translateX(0); opacity: 1; }

.ai-panel-header {
    padding: 16px 20px; background: linear-gradient(135deg, #4f8cff, #6c5ce7);
    color: #fff; display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.ai-panel-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.ai-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #34c759; margin-left: 4px; }
.ai-panel-actions { display: flex; gap: 4px; }
.ai-header-btn {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: rgba(255,255,255,0.15); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.ai-header-btn:hover { background: rgba(255,255,255,0.3); }

.ai-panel-body {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    background: #f7f8fa;
}
.ai-panel-body::-webkit-scrollbar { width: 4px; }
.ai-panel-body::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }

.ai-msg { display: flex; gap: 10px; max-width: 90%; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-avatar {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.ai-msg-bot .ai-msg-avatar { background: linear-gradient(135deg, #4f8cff, #6c5ce7); color: #fff; }
.ai-msg-user .ai-msg-avatar { background: #e8eaed; color: #6b7280; }
.ai-msg-content {
    padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.7;
    white-space: pre-wrap; word-break: break-word;
}
.ai-msg-bot .ai-msg-content { background: #fff; color: #1a1a2e; border: 1px solid #e8eaed; border-top-left-radius: 4px; }
.ai-msg-user .ai-msg-content { background: #4f8cff; color: #fff; border-top-right-radius: 4px; }
.ai-msg-content table { border-collapse: collapse; margin: 8px 0; font-size: 13px; width: 100%; }
.ai-msg-content th, .ai-msg-content td { border: 1px solid #e8eaed; padding: 6px 10px; text-align: left; }
.ai-msg-content th { background: #f0f5ff; font-weight: 600; }
.ai-msg-content b { color: #4f8cff; }

.ai-quick-actions {
    padding: 8px 12px; display: flex; gap: 8px; flex-wrap: wrap;
    border-top: 1px solid #e8eaed; background: #fff; flex-shrink: 0;
}
.ai-quick-btn {
    padding: 6px 12px; border-radius: 16px; border: 1px solid #e8eaed;
    background: #f7f8fa; color: #6b7280; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; gap: 4px; transition: all 0.2s; white-space: nowrap;
}
.ai-quick-btn:hover { border-color: #4f8cff; color: #4f8cff; background: #f0f5ff; }

.ai-panel-footer { padding: 12px 16px; border-top: 1px solid #e8eaed; background: #fff; flex-shrink: 0; }
.ai-input-wrapper { display: flex; gap: 8px; align-items: flex-end; }
.ai-input {
    flex: 1; border: 1px solid #e8eaed; border-radius: 12px;
    padding: 10px 14px; font-size: 14px; resize: none; max-height: 100px;
    font-family: inherit; outline: none; transition: border-color 0.2s;
}
.ai-input:focus { border-color: #4f8cff; }
.ai-send-btn {
    width: 40px; height: 40px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #4f8cff, #6c5ce7); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: all 0.2s; flex-shrink: 0;
}
.ai-send-btn:hover { transform: scale(1.05); }

.ai-typing { display: flex; gap: 4px; padding: 12px 16px; }
.ai-typing span {
    width: 8px; height: 8px; border-radius: 50%; background: #4f8cff;
    animation: aiTyping 1.4s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiTyping { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }

.ai-confirm-btns { display: flex; gap: 8px; margin-top: 10px; }
.ai-confirm-btn { padding: 6px 16px; border-radius: 8px; border: none; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.ai-confirm-btn.yes { background: #34c759; color: #fff; }
.ai-confirm-btn.no { background: #f3f4f6; color: #6b7280; }
.ai-confirm-btn:hover { opacity: 0.9; }

/* ===== 登录页面 ===== */
.login-page {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(79,140,255,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(108,92,231,0.1) 0%, transparent 50%);
    animation: loginBgFloat 20s ease-in-out infinite;
}
@keyframes loginBgFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 20px); }
}
.login-container {
    position: relative; z-index: 1;
    width: 400px; max-width: 90vw;
    background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
    border-radius: 20px; padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: loginFadeIn 0.5s ease;
}
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 24px; font-weight: 700; color: #1a1a2e; margin-bottom: 12px;
}
.login-logo i { color: #4f8cff; font-size: 28px; }
.login-header h1 { font-size: 20px; color: #1a1a2e; margin-bottom: 6px; font-weight: 600; }
.login-header p { font-size: 14px; color: #8c8c8c; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid #e8eaed; border-radius: 12px; padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field:focus-within {
    border-color: #4f8cff; box-shadow: 0 0 0 3px rgba(79,140,255,0.1);
}
.login-field i { color: #8c8c8c; font-size: 16px; }
.login-field input {
    flex: 1; border: none; outline: none;
    padding: 14px 0; font-size: 15px; background: transparent; color: #1a1a2e;
}
.login-error {
    color: #ff3b30; font-size: 13px; min-height: 18px;
    display: none; align-items: center; gap: 6px;
}
.login-error.show { display: flex; }
.login-btn {
    margin-top: 4px; padding: 14px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, #4f8cff, #6c5ce7); color: #fff;
    font-size: 16px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s; box-shadow: 0 4px 12px rgba(79,140,255,0.3);
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,140,255,0.4); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.login-hint {
    text-align: center; font-size: 12px; color: #8c8c8c; margin-top: 4px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.login-footer {
    position: relative; z-index: 1; margin-top: 24px;
    font-size: 12px; color: rgba(255,255,255,0.4);
}

/* ===== 分页组件样式 ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 8px;
}
.pagination-info {
    font-size: 13px;
    color: #999;
}
.pagination-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}
.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e8e8e8;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-btn:hover:not(:disabled):not(.active) {
    border-color: #4f8cff;
    color: #4f8cff;
}
.page-btn.active {
    background: #4f8cff;
    border-color: #4f8cff;
    color: #fff;
}
.page-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #f9f9f9;
}
.page-size-select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    outline: none;
}
.page-ellipsis {
    padding: 0 4px;
    color: #999;
    font-size: 13px;
}
