/* ==========================================================================
   目录 (Table of Contents)
   1. 全局变量与基础设置 (Variables & Reset)
   2. 布局框架 (Layout Wrapper & Main Content)
   3. 侧边栏 (Sidebar - 包含折叠逻辑)
   4. 顶部导航栏 (Navbar & User Dropdown)
   5. 基础组件 (Buttons, Forms, Switch, Badge)
   6. 卡片系统 (Cards, Stats, Charts)
   7. 表格与分页 (Tables & Pagination)
   8. 模态框与弹窗 (Modals, Custom Dialog)
   9. 全局功能组件 (Toast, Spotlight, Skeleton)
   10. 业务模块：用户详情抽屉 (User Drawer)
   11. 业务模块：费率配置 (Fee Standards List & Editor)
   12. 业务模块：项目预览与日志 (Project Preview, Logs)
   13. 业务模块：系统设置 (Settings Page)
   14. 响应式适配 (Responsive - Mobile & Tablet)
   15. 细节优化补丁 (Detail Patches) 
   16. 终极暗黑模式适配 (Dark Mode Overrides)
   ========================================================================== */

/* ==========================================================================
   1. 全局变量与基础设置
   ========================================================================== */
/* ==========================================================================
   1. 全局变量与主题 (Variables & Themes)
   ========================================================================== */
:root {
    /* --- 亮色模式 (保持不变) --- */
    --bg-body: #f0f2f5;
    --bg-sidebar: #2c3e50;
    --bg-sidebar-darker: #22303f;
    --bg-card: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --bg-header: #ffffff;
    --bg-modal: #ffffff;
    --bg-input: #ffffff;
    --text-main: #333333;
    --text-secondary: #64748b;
    --text-sidebar: #ecf0f1;
    --text-sidebar-muted: #aeb9c2;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --hover-bg: rgba(0,0,0,0.05);
    --active-item-bg: rgba(255, 255, 255, 0.1);
    --primary-light: #eff6ff;
    
    /* 功能色 */
    --primary-color: #3498db;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --danger-color: #e74c3c;
    --info-color: #17a2b8;
    
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --backdrop-blur: blur(12px);
}

/* --- 暗黑模式 (优化后的深蓝灰色系) --- */
[data-theme="dark"] {
    /* 核心背景：使用冷色调深灰，比纯黑更护眼 */
    --bg-body: #0f172a;        /* 页面底色：极深蓝灰 */
    --bg-sidebar: #1e293b;     /* 侧边栏：深蓝灰 */
    --bg-sidebar-darker: #020617; /* 侧边栏深色区 */
    --bg-card: #1e293b;        /* 卡片/弹窗：与侧边栏一致，形成层级 */
    --bg-header: #1e293b;      /* 顶部栏 */
    --bg-input: #334155;       /* 输入框：比卡片略亮，便于识别 */
    --bg-modal: #1e293b;

    /* 文字系统：提高对比度 */
    --text-main: #f1f5f9;      /* 主文字：近乎白 */
    --text-secondary: #94a3b8; /* 次要文字：冷灰 */
    --text-sidebar: #f8fafc;
    --text-sidebar-muted: #64748b;
    --text-placeholder: #64748b;

    /* 边框与交互 */
    --border-color: #334155;   /* 边框：中等深度的蓝灰 */
    --hover-bg: rgba(255, 255, 255, 0.08); /* 悬停高亮 */
    
    /* 功能色微调：在暗色背景下更明亮 */
    --primary-color: #38bdf8;  /* 天蓝色，比亮模式更亮 */
    --primary-light: rgba(56, 189, 248, 0.15); /* 主色背景淡化 */
    --active-item-bg: rgba(56, 189, 248, 0.15);
    
    /* 阴影：改为深色扩散投影 */
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: 'Segoe UI', 'Microsoft YaHei', Tahoma, Geneva, Verdana, sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    font-size: 14px; 
    line-height: 1.5;
    transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: var(--primary-color); }
ul { list-style: none; padding: 0; margin: 0; }

/* 滚动条美化 */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   2. 布局框架
   ========================================================================== */
.admin-wrapper { 
    display: flex; 
    width: 100%; 
    min-height: 100vh; 
}

.content { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

.main-content-area { 
    padding: 20px; 
    flex-grow: 1; 
    overflow-y: auto; 
}

.view-section { display: none; animation: fadeIn 0.3s ease-out; }
.view-section.active { display: block; }

/* ==========================================================================
   3. 侧边栏 (Sidebar)
   ========================================================================== */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    transition: all 0.3s;
    position: sticky; 
    top: 0;           
    height: 100vh;    
    display: flex;    
    flex-direction: column; 
    z-index: 1000;    
    overflow: hidden; 
    flex-shrink: 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 25px 20px;
    background: var(--bg-sidebar-darker);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar ul.components { 
    padding: 10px 0; 
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none; 
}
.sidebar ul.components::-webkit-scrollbar { width: 4px; }
.sidebar ul.components::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 2px; }

.sidebar ul li a {
    padding: 15px 25px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    color: var(--text-sidebar-muted);
    border-left: 4px solid transparent;
    transition: all 0.2s ease-in-out;
}

.sidebar ul li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar ul li a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar ul li.active a {
    color: #fff;
    background: var(--active-item-bg);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    background: var(--bg-sidebar-darker);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.back-home {
    color: var(--text-sidebar-muted) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

.back-home:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

/* 折叠状态 */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-header h3 { font-size: 0; }
.sidebar.collapsed .sidebar-header h3 i { font-size: 1.5rem; display: block; }
.sidebar.collapsed ul li a span { display: none; }
.sidebar.collapsed ul li a { padding: 15px 23px; justify-content: center; }
.sidebar.collapsed ul li a i { margin-right: 0; }
.sidebar.collapsed .back-home span { display: none; }
.sidebar.collapsed .back-home { justify-content: center; padding: 10px 0; }

/* ==========================================================================
   4. 顶部导航栏 (Navbar)
   ========================================================================== */
.navbar {
    padding: 0 20px;
    height: 60px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.navbar-left { display: flex; align-items: center; gap: 15px; }
.navbar-left h4 { margin: 0; font-weight: 600; font-size: 1.1rem; }

.user-info { 
    font-weight: 600; 
    cursor: pointer; 
    position: relative; 
    display: flex;
    align-items: center;
    gap: 8px;
    height: 60px;
}
.user-info:hover .dropdown-menu { display: block; }

.dropdown-menu {
    display: none; 
    position: absolute; 
    right: 0; 
    top: 55px; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color);
    border-radius: 4px; 
    padding: 5px 0; 
    min-width: 140px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
}
.dropdown-menu a { display: block; padding: 10px 20px; color: var(--text-main); }
.dropdown-menu a:hover { background: var(--hover-bg); color: var(--primary-color); }

/* 暗黑模式开关 */
.theme-switch-wrapper { display: flex; align-items: center; margin-right: 20px; }
.theme-switch { position: relative; width: 48px; height: 24px; display: inline-block; }
.theme-switch input { display:none; }
.theme-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.theme-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .theme-slider { background-color: var(--primary-color); }
input:checked + .theme-slider:before { transform: translateX(24px); }
.theme-icon { margin-left: 10px; color: var(--text-secondary); }

/* ==========================================================================
   5. 基础组件 (Buttons, Forms, etc.)
   ========================================================================== */
/* Buttons */
.btn { 
    padding: 8px 16px; 
    border: none; 
    border-radius: 8px;
    cursor: pointer; 
    font-size: 13px; 
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
    color: #fff; 
}
.btn:active { transform: scale(0.96); }
.btn i { margin-right: 5px; }

.btn-primary { background: #005A9C; }
.btn-primary:hover { background: #004a82; box-shadow: 0 4px 12px rgba(0, 90, 156, 0.3); }
.btn-success { background: var(--success-color); }
.btn-danger { background-color: #e74c3c; color: #fff; box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3); }
.btn-info { background: var(--info-color); color: #fff; font-weight: normal; opacity: 0.9; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-warning {
    background-color: #f1c40f !important; 
    color: #2c3e50 !important; 
    border: 1px solid #e0b80d !important;
    font-weight: 600; 
    box-shadow: 0 2px 5px rgba(241, 196, 15, 0.3);
}
.btn-warning:hover {
    background-color: #d4ac0d !important;
    color: #1a252f !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(241, 196, 15, 0.4);
}

/* 轮廓按钮 (实色增强版 - 快捷维护区) */
.settings-sidebar .btn-sm, 
.view-dashboard .btn-outline-info,
.view-dashboard .btn-outline-secondary,
.view-dashboard .btn-outline-danger {
    border: none !important;
    color: #fff !important;
    font-weight: 600;
    margin-bottom: 5px;
    justify-content: flex-start;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.btn-outline-info { background-color: #3498db !important; }
.btn-outline-info:hover { background-color: #2980b9 !important; transform: translateY(-1px); }
.btn-outline-secondary { background-color: #95a5a6 !important; }
.btn-outline-secondary:hover { background-color: #7f8c8d !important; transform: translateY(-1px); }
.btn-outline-danger { background-color: #e74c3c !important; }
.btn-outline-danger:hover { background-color: #c0392b !important; transform: translateY(-1px); }

.btn-group { display: flex; justify-content: center; gap: 5px; white-space: nowrap; }
.btn-icon { border: none; background: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
.btn-icon:hover { background: #f0f0f0; }
.btn-add-row { width: 100%; padding: 8px; border: 1px dashed #dcdfe6; background: #fff; color: #606266; cursor: pointer; border-radius: 4px; margin-bottom: 15px; transition: 0.2s; }
.btn-add-row:hover { border-color: var(--primary-color); color: var(--primary-color); background: #f0f9ff; }
.btn-xs { border: none; background: transparent; color: #64748b; font-size: 12px; padding: 4px 10px; border-radius: 4px; cursor: pointer; transition: all 0.2s; font-weight: 500; }
.btn-xs:hover { color: var(--primary-color); }
.btn-xs.active { background: #fff; color: var(--primary-color); box-shadow: 0 1px 2px rgba(0,0,0,0.1); font-weight: 600; }

/* Forms */
.form-control { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; background: var(--bg-body); color: var(--text-main); }
.form-control:focus { border-color: var(--primary-color); outline: none; }
.form-control:disabled { background-color: #f3f4f6; cursor: not-allowed; opacity: 0.6; }

.search-bar { position: relative; max-width: 300px; width: 100%; }
.search-bar::before {
    content: "\f002"; font-family: "Font Awesome 5 Free"; font-weight: 900;
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #aaa; pointer-events: none;
}
.search-bar input {
    width: 100%; padding: 8px 15px 8px 35px;
    border: 1px solid var(--border-color); border-radius: 20px;
    background-color: var(--bg-body); color: var(--text-main);
    font-size: 0.9rem; transition: all 0.3s ease; outline: none;
}
.search-bar input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15); }

/* Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; margin-right: 8px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e9ecef; transition: .3s; border-radius: 22px; border: 1px solid #d1d5db;
}
.slider:before {
    position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 2px;
    background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: var(--success-color); border-color: var(--success-color); }
input:checked + .slider:before { transform: translateX(20px); }
input:disabled + .slider { background-color: #f3f4f6; cursor: not-allowed; opacity: 0.6; }
.switch.small { transform: scale(0.8); margin-right: -5px; }

.status-switch-wrapper { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.status-text { font-size: 0.75rem; font-weight: 600; min-width: 30px; text-align: left; }

/* Filter Toolbar */
.filter-toolbar { padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid var(--border-color); display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.filter-item { display: flex; align-items: center; }

/* ==========================================================================
   6. 卡片系统 (Cards, Stats, Charts)
   ========================================================================== */
.card { 
    background: var(--bg-card); 
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: 16px;
    border: var(--glass-border);
    box-shadow: var(--shadow);
    margin-bottom: 20px; 
    overflow: hidden; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    border-radius: 16px 16px 0 0;
    color: var(--text-main);
    font-weight: 600; font-size: 1rem;
}
.header-title { display: flex; align-items: center; gap: 10px; color: var(--text-main); font-weight: 600; }
.header-title i, .card-header i { font-size: 1.1rem; color: var(--primary-color); width: 20px; text-align: center; }
.card-body { padding: 20px; position: relative; }

/* Stats */
.stats-cards { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; margin-bottom: 20px; 
}
.stat-card { color: #fff; border: none; margin-bottom: 0; }
.stat-card .card-body { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { font-size: 2.5rem; opacity: 0.8; }
.stat-text { text-align: right; }
.stat-text h5 { margin: 0; font-size: 0.9rem; opacity: 0.9; font-weight: normal; }
.stat-text h3 { margin: 5px 0 0; font-size: 2rem; font-weight: bold; }

.stat-card.blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-card.green { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.stat-card.orange { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.stat-card.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }

.pulse-red { animation: pulse-red-shadow 2s infinite; border: 1px solid #e74c3c !important; }
@keyframes pulse-red-shadow {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.chart-container { height: auto; min-height: 380px; }
.mini-stat-card { background: var(--bg-body); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-color); text-align: center; }
.mini-stat-card .label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.mini-stat-card .value { font-size: 1.1rem; font-weight: bold; color: var(--primary-color); }
.mini-stat-card .value small { font-size: 0.7rem; font-weight: normal; }

.insight-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--bg-body); border-radius: 8px; font-size: 0.9rem; }

/* Geo Map Ranks */
.geo-item { display: flex; align-items: center; margin-bottom: 15px; padding: 8px; border-radius: 8px; transition: background 0.2s; }
.geo-item:hover { background-color: var(--hover-bg); }
.geo-rank { width: 24px; height: 24px; border-radius: 50%; background-color: #e2e8f0; color: #4a5568; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; margin-right: 12px; flex-shrink: 0; }
.geo-item:nth-child(1) .geo-rank { background-color: #FFD700; color: #fff; box-shadow: 0 2px 5px rgba(255, 215, 0, 0.4); }
.geo-item:nth-child(2) .geo-rank { background-color: #C0C0C0; color: #fff; }
.geo-item:nth-child(3) .geo-rank { background-color: #CD7F32; color: #fff; }

/* ==========================================================================
   7. 表格与分页 (Tables & Pagination)
   ========================================================================== */
.table-responsive { overflow-x: auto; margin-bottom: 15px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }

.table th, .table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle !important;
    border-color: var(--border-color) !important;
    word-wrap: break-word;
    word-break: break-all;
}

.table th {
    background: var(--hover-bg);
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    user-select: none;
}

.table tr:hover { background-color: var(--hover-bg); }
#users-table tbody tr { cursor: pointer; transition: 0.1s; }
#users-table tbody tr:active { background: var(--hover-bg); }

/* Column adjustments */
#users-table td:nth-child(2) { text-align: center !important; font-weight: 600; }
#users-table td:nth-child(4) { padding-left: 4px !important; padding-right: 4px !important; }
#users-table td:nth-child(5) { font-size: 0.85rem; }
#users-table td:nth-child(8) { white-space: nowrap; font-size: 0.8rem; color: #64748b; }

#all-projects-table th, #all-projects-table td,
#login-logs-table th, #login-logs-table td,
#activity-logs-table th, #activity-logs-table td { text-align: center !important; }
#activity-logs-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 12px 8px !important; }
.activity-row:hover { background-color: rgba(52, 152, 219, 0.05) !important; }
.activity-row:active { background-color: rgba(52, 152, 219, 0.1) !important; }

.info-tag { display: block; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.2; }
.real-name-text { color: var(--primary-color); font-weight: 500; }

.resizer {
    position: absolute; top: 0; right: 0; width: 5px; height: 100%;
    cursor: col-resize; user-select: none; z-index: 1;
}
.resizer:hover, .resizing { border-right: 2px solid var(--primary-color); }

.pagination-container { display: flex; justify-content: center; margin-top: 20px; }
.pagination-list { display: flex; gap: 5px; list-style: none; }
.pagination-list li {
    padding: 6px 12px; border: 1px solid var(--border-color); border-radius: 4px;
    cursor: pointer; background: var(--bg-card); transition: 0.2s;
}
.pagination-list li:hover { border-color: var(--primary-color); color: var(--primary-color); }
.pagination-list li.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.pagination-list li.disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   8. 模态框与弹窗 (Modals, Custom Dialog)
   ========================================================================== */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; 
    z-index: 2000; backdrop-filter: blur(2px); 
}
.modal-overlay.show { display: flex; }

.modal-dialog { 
    background: var(--bg-card); width: 600px; max-width: 90%; 
    border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    overflow: hidden; animation: slideDown 0.3s; 
    display: flex; flex-direction: column; max-height: 85vh; 
}

.modal-header { 
    padding: 15px 20px; border-bottom: 1px solid var(--border-color); 
    display: flex; justify-content: space-between; align-items: center; 
    background: var(--hover-bg); 
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { 
    padding: 15px 20px; border-top: 1px solid var(--border-color); 
    display: flex; justify-content: flex-end; gap: 10px; 
    background: var(--hover-bg); 
}
.close-modal { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }

/* Custom Dialog */
#custom-dialog-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-overlay); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.custom-dialog-box {
    background: var(--bg-modal); color: var(--text-main);
    width: 90%; max-width: 420px; padding: 30px;
    border-radius: 16px; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.custom-dialog-box h3 { margin-top: 0; color: var(--text-main); font-size: 1.25rem; }
.custom-dialog-box p { color: var(--text-secondary); line-height: 1.6; }

/* ==========================================================================
   9. 全局功能组件 (Toast, Spotlight, Skeleton)
   ========================================================================== */
/* Toast */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #333; color: #fff; padding: 12px 20px; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); animation: slideInRight 0.3s; display: flex; align-items: center; gap: 10px; min-width: 280px; }
.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--danger-color); }

/* Spotlight */
.spotlight-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
    z-index: 5000; display: none; align-items: flex-start; justify-content: center;
    padding-top: 10vh;
}
.spotlight-overlay.active { display: flex; animation: fadeIn 0.2s; }
.spotlight-content {
    background: var(--bg-card); width: 600px; max-width: 90%;
    border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    overflow: hidden; border: 1px solid var(--border-color);
}
.spotlight-search-box { display: flex; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border-color); }
.spotlight-search-box i { color: var(--primary-color); font-size: 1.2rem; margin-right: 15px; }
.spotlight-search-box input { border: none; background: transparent; color: var(--text-main); font-size: 1.1rem; width: 100%; outline: none; }
.spotlight-results { max-height: 400px; overflow-y: auto; padding: 10px 0; }
.spotlight-item { padding: 12px 20px; display: flex; align-items: center; gap: 15px; cursor: pointer; transition: 0.2s; }
.spotlight-item:hover, .spotlight-item.selected { background: var(--hover-bg); }
.spotlight-footer { padding: 10px 20px; background: var(--hover-bg); font-size: 0.8rem; color: var(--text-secondary); border-top: 1px solid var(--border-color); }

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite linear;
    border-radius: 4px; color: transparent !important; user-select: none;
    display: inline-block; height: 16px; width: 100%; opacity: 0.7;
}
.skeleton-text { height: 16px; width: 80%; }

/* ==========================================================================
   10. 业务模块：用户详情抽屉 (User Drawer)
   ========================================================================== */
.drawer-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 4000; pointer-events: none;
}
.drawer-overlay {
    position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.3);
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.drawer-content {
    position: absolute; right: -500px; top: 0; width: 450px; height: 100%;
    background: #f8fafc; box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.7, 0, 0.3, 1);
    pointer-events: auto; display: flex; flex-direction: column;
}
.drawer-wrapper.show .drawer-overlay { opacity: 1; pointer-events: auto; }
.drawer-wrapper.show .drawer-content { transform: translateX(-500px); }

.drawer-header { padding: 10px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.close-drawer { background: #f1f5f9; border: none; width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #64748b; font-size: 1rem; transition: 0.2s; }
.drawer-body { padding: 25px; overflow-y: auto; flex-grow: 1; }

.drawer-profile-header {
    background: #ffffff; margin: -25px -25px 15px -25px; padding: 20px 25px; 
    display: flex; align-items: center; gap: 15px; border-bottom: 1px solid #f1f5f9;
    position: relative; overflow: hidden;
}
.drawer-profile-header::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--primary-color), #60a5fa); }
.drawer-avatar-wrapper {
    position: relative; width: 54px; height: 54px; background: var(--primary-light);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(0, 90, 156, 0.1); flex-shrink: 0;
}
.drawer-avatar-wrapper i { font-size: 1.8rem; color: var(--primary-color); }
.drawer-header-info h3 { margin: 0; font-size: 1.15rem; color: #1e293b; font-weight: 700; }
.role-badge { background: #f1f5f9; color: #64748b; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; border: 1px solid #e2e8f0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-item { padding: 10px; border-radius: 10px; border-left: 4px solid var(--primary-color); background: #f1f5f9; }
.stat-item .label { font-size: 0.75rem; color: #64748b; margin-bottom: 4px; }
.stat-item .num { font-size: 1.1rem; font-weight: 800; color: #1e293b; }
.stat-item .num small { font-size: 0.7rem; color: #94a3b8; margin-left: 2px; }

.drawer-card { background: #ffffff; border-radius: 12px; padding: 12px 15px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); border: 1px solid #e2e8f0; }
.info-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-key { width: 80px; color: #94a3b8; flex-shrink: 0; }
.info-val { flex: 1; color: #334155; font-weight: 500; word-break: break-all; min-height: 1.5em; display: flex; align-items: center; }

/* Inline Edit */
.editable-cell-wrapper { display: flex; flex-direction: column; align-items: center; }
.editable-row { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all 0.2s; min-height: 24px; max-width: 100%; box-sizing: border-box; }
.editable-row + .editable-row { margin-top: 4px; }
.editable-row:hover { background-color: #f1f5f9; }
.editable-row:has(input) { justify-content: flex-start !important; width: 100%; }
.editable-row .icon { color: #94a3b8; font-size: 0.9rem; margin-right: 8px; flex-shrink: 0; }
.editable-row .value { font-size: 0.9rem; color: #334155; text-align: left; line-height: 1.4; }
.editable-row .edit-icon { font-size: 0.75rem; color: var(--primary-color); opacity: 0; transition: opacity 0.2s; margin-left: 5px; }
.editable-row:hover .edit-icon { opacity: 1; }
.inline-edit-input { width: 100%; min-width: 220px; border: 1px solid var(--primary-color); border-radius: 4px; padding: 3px 8px; font-size: 0.9rem; outline: none; box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.1); background: #fff; margin: -3px 0; transition: all 0.2s; }
.drawer-edit-input { width: 100% !important; border: none; border-bottom: 2px solid var(--primary-color) !important; background: rgba(52, 152, 219, 0.05) !important; padding: 2px 5px !important; font-size: 0.9rem !important; outline: none !important; box-shadow: none !important; margin: -3px 0 !important; color: #333 !important; min-width: unset !important; }
.editable-drawer-field { cursor: text; transition: background 0.2s, padding 0.2s; border-radius: 4px; padding: 2px 6px; margin-left: -6px; }
.editable-drawer-field:hover { background-color: #f1f5f9; color: var(--primary-color); }
.edit-saving { color: #94a3b8 !important; background: transparent !important; cursor: wait !important; }
.placeholder-gray { color: #cbd5e1 !important; font-style: italic; }

/* Timeline */
.modern-timeline { position: relative; padding-left: 25px; }
.modern-timeline::before { content: ''; position: absolute; left: 7px; top: 5px; bottom: 5px; width: 2px; background: #e2e8f0; }
.timeline-step { position: relative; padding-bottom: 15px; }
.timeline-step::after { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; background: white; border: 2px solid var(--primary-color); border-radius: 50%; z-index: 1; }
.step-content { font-size: 0.85rem; }
.step-title { font-weight: 600; color: #1e293b; }
.step-time { color: #94a3b8; font-size: 0.75rem; }

/* ==========================================================================
   11. 业务模块：费率配置 (Fee Standards List & Editor)
   ========================================================================== */
/* 左侧标准列表 */
.standards-sidebar {
    flex: 1; border-right: 1px solid var(--border-color); display: flex; 
    flex-direction: column; background: #f8f9fa; height: 100%;
    min-width: 320px; max-width: 350px;
}
.standards-header-fixed { background: #fff; padding: 12px; border-bottom: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.03); z-index: 10; }
.standards-search-wrapper { position: relative; margin-bottom: 8px; }
.standards-search-wrapper input { background: #f0f2f5; border: none; padding: 10px 12px 10px 35px; font-size: 0.85rem; width: 100%; border-radius: 6px; transition: all 0.3s; }
.standards-search-wrapper input:focus { background: #fff; border: 1px solid var(--primary-color); box-shadow: 0 0 0 2px rgba(0,90,156,0.1); outline: none; }
.standards-search-wrapper .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #999; font-size: 0.9rem; }

.filter-tags-wrapper { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filter-tags-wrapper::-webkit-scrollbar { display: none; }
.filter-tag { font-size: 12px; padding: 4px 10px; background: #edf2f7; color: #64748b; border-radius: 12px; cursor: pointer; white-space: nowrap; transition: all 0.2s; user-select: none; }
.filter-tag:hover { background: #e2e8f0; color: #334155; }
.filter-tag.active { background: var(--primary-color); color: #fff; box-shadow: 0 2px 5px rgba(0,90,156,0.3); }

.standards-list-container { flex: 1; overflow-y: auto; padding: 10px; }
.standards-group { margin-bottom: 10px; background: #fff; border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
.standards-group:first-child { border-top: none; }
.group-header { padding: 10px 15px; font-size: 0.85rem; font-weight: 700; color: #475569; background: #fff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 5; }
.group-header:hover { background: #f8fafc; }
.group-header i { transition: transform 0.3s; transform: rotate(0deg); color: #cbd5e1; }
.standards-group.collapsed .group-body { display: none; }
.standards-group.collapsed .group-header i { transform: rotate(-90deg); }
.group-body { padding: 5px 10px 10px 10px; }

.standard-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; margin-bottom: 6px; background: #fff;
    border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
}
.standard-item:hover { border-color: var(--primary-color); transform: none; }
.standard-item.active { background: #eff6ff; border-color: var(--primary-color); box-shadow: 0 2px 8px rgba(0,90,156,0.15); }
.standard-info { flex: 1; overflow: hidden; padding-right: 10px; }
.std-name { 
    font-size: 0.85rem; margin-bottom: 3px; color: #1e293b; 
    line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; 
    -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; 
}
.standard-item.active .std-name { color: var(--primary-color); }
.std-code { font-size: 0.7rem; color: #94a3b8; background: transparent; padding: 0; font-family: Consolas, monospace; }

/* 右侧编辑器区域 */
.rule-block { background: #f8f9fa; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e9ecef; }
.rule-title { font-weight: bold; margin-bottom: 10px; display: flex; justify-content: space-between; }
.json-textarea { width: 100%; min-height: 150px; font-family: Consolas, monospace; font-size: 0.9rem; border: 1px solid #ced4da; border-radius: 4px; padding: 10px; }

.editor-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; background: #fff; font-size: 13px; }
.editor-table th, .editor-table td { border: 1px solid #dfe6ec; padding: 8px; text-align: center; vertical-align: middle; }
.editor-table th { background-color: #f8f9fa; color: #606266; font-weight: 600; }
.editor-input { width: 100%; border: 1px solid transparent; padding: 6px; border-radius: 4px; transition: all 0.2s; background: transparent; text-align: center; }
.editor-input:not([type="number"]) { text-align: left; }
.editor-table td:first-child .editor-input[type="number"] { text-align: center; }
.editor-input:focus { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 2px rgba(0, 90, 156, 0.1); outline: none; }
.editor-input:hover { background: #fdfdfd; border-color: #e0e0e0; }
.btn-add-row { width: 100%; padding: 8px; border: 1px dashed #dcdfe6; background: #fff; color: #606266; cursor: pointer; border-radius: 4px; margin-bottom: 15px; transition: 0.2s; }
.btn-add-row:hover { border-color: var(--primary-color); color: var(--primary-color); background: #f0f9ff; }
.btn-icon { border: none; background: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
.btn-icon:hover { background: #f0f0f0; }

/* Empty State */
.empty-state-wrapper { display: flex; height: 100%; min-height: 500px; align-items: center; justify-content: center; background: #fff; background-image: radial-gradient(#f1f5f9 1px, transparent 1px); background-size: 20px 20px; }
.empty-state-content { text-align: center; max-width: 400px; padding: 40px; animation: fadeInUp 0.6s ease-out; }
.empty-icon-box { position: relative; width: 80px; height: 80px; margin: 0 auto 25px; }
.empty-icon-box .main-icon { font-size: 60px; color: #cbd5e1; }
.empty-icon-box .sub-icon { position: absolute; bottom: -5px; right: -10px; font-size: 30px; color: var(--primary-color); background: #fff; border-radius: 50%; padding: 2px; }
.spin-slow { animation: spin 10s linear infinite; }
.empty-desc { color: #64748b; font-size: 0.95rem; line-height: 1.6; margin-bottom: 30px; }
.empty-tips { background: #f8fafc; border: 1px dashed #e2e8f0; border-radius: 8px; padding: 15px; text-align: left; }
.tip-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.85rem; color: #64748b; }
.tip-item i { color: var(--primary-color); width: 16px; text-align: center; opacity: 0.7; }

/* Sandbox */
.sandbox-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px; margin-bottom: 20px; border-left: 4px solid var(--info-color); }
.sandbox-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 600; color: #475569; }
.sandbox-body { display: flex; align-items: center; gap: 20px; }
.sandbox-input-group { display: flex; gap: 10px; flex: 1; }
.sandbox-result { background: #fff; padding: 6px 15px; border-radius: 4px; border: 1px solid #ddd; min-width: 150px; text-align: right; }
.sandbox-result .label { font-size: 0.85rem; color: #64748b; }
.sandbox-result .value { font-size: 1.1rem; font-weight: bold; color: var(--primary-color); }
.sandbox-result .unit { font-size: 0.85rem; color: #94a3b8; margin-left: 4px; }
.sandbox-log { margin-top: 10px; font-size: 0.8rem; color: #64748b; background: #fff; padding: 8px; border-radius: 4px; border: 1px dashed #cbd5e1; display: none; }

/* ==========================================================================
   12. 业务模块：项目预览与日志 (Project Preview, Logs)
   ========================================================================== */
.project-meta-card { background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.03); overflow: hidden; }
.meta-header { background: #f8fafc; padding: 10px 15px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; font-weight: 600; color: #475569; display: flex; align-items: center; gap: 8px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 15px; }
.meta-item { display: flex; flex-direction: column; gap: 4px; }
.meta-item .label { font-size: 0.75rem; color: #94a3b8; }
.meta-item .value { font-size: 0.95rem; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-item .value.num { font-family: 'Consolas', monospace; font-weight: 700; }
.text-primary { color: var(--primary-color) !important; }

.section-divider { display: flex; align-items: center; margin: 15px 0; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.divider-text { padding: 0 10px; font-size: 0.85rem; color: #94a3b8; font-weight: 600; }

.preview-container { max-height: 500px; overflow-y: auto; padding: 5px; padding-bottom: 60px; }
.fee-card { background-color: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); border-left: 3px solid var(--primary-color); border-radius: 6px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); transition: transform 0.2s; }
.fee-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.fee-card-header { display: flex; align-items: center; padding: 12px 15px; border-bottom: 1px dashed #f1f5f9; }
.fee-index { width: 24px; height: 24px; background: #f1f5f9; color: #64748b; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: bold; margin-right: 10px; }
.fee-title { flex: 1; font-weight: 600; color: #334155; font-size: 0.95rem; }
.fee-amount { font-size: 1rem; font-weight: 700; color: var(--success-color); }
.fee-amount small { font-size: 0.7rem; color: #94a3b8; font-weight: normal; }
.fee-card-body { padding: 10px 15px; }

.tag-row { margin-bottom: 8px; display: flex; gap: 6px; }
.tag { padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; }
.tag-id { background: #e0f2fe; color: #0369a1; }
.tag-discount { background: #fef3c7; color: #d97706; }

details.fee-details summary { list-style: none; cursor: pointer; color: var(--primary-color); font-size: 0.8rem; user-select: none; transition: 0.2s; }
details.fee-details summary:hover { text-decoration: underline; }
details.fee-details[open] summary { margin-bottom: 10px; color: #64748b; }
.detail-content { background: #f8fafc; padding: 10px; border-radius: 6px; border: 1px solid #f1f5f9; }
.trace-box { font-family: 'Consolas', monospace; font-size: 0.8rem; color: #475569; white-space: pre-wrap; margin-bottom: 10px; }
.official-doc { border-top: 1px dashed #cbd5e1; padding-top: 8px; }
.doc-title { font-size: 0.75rem; font-weight: bold; color: #94a3b8; margin-bottom: 5px; }

.preview-footer { margin-top: 15px; padding: 15px; background: linear-gradient(to right, #f8fafc, #f1f5f9); border-radius: 8px; border: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.footer-note { font-size: 0.75rem; color: #94a3b8; }
.footer-total { display: flex; align-items: baseline; gap: 10px; }
.global-discount { font-size: 0.8rem; color: #d97706; background: #fffbeb; padding: 2px 6px; border-radius: 4px; border: 1px solid #fcd34d; }
.footer-total span { font-size: 0.9rem; color: #475569; }
.footer-total b { font-size: 1.4rem; color: var(--primary-color); }
/* ==========================================================================
   日志审计模块专项修复 (Tab & Toolbar)
   ========================================================================== */

/* 1. Tab 标签页容器 */
.tabs { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 0; 
}

/* 2. Tab 按钮基础样式（修复图片中看起来像普通按钮的问题） */
.tab-btn { 
    background: #f8f9fa; 
    border: 1px solid var(--border-color); 
    padding: 8px 18px; 
    border-radius: 6px; 
    cursor: pointer; 
    color: var(--text-secondary); 
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.tab-btn:hover {
    background: #eef2f7;
    color: var(--primary-color);
}

/* 选中状态 */
.tab-btn.active { 
    background: var(--primary-color); 
    color: #fff; 
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
}

/* 3. 标签内容区显示控制（核心修复：防止两个表格同时显示） */
.tab-content { 
    display: none; /* 默认隐藏所有 */
    width: 100%;
}

.tab-content.active { 
    display: block; /* 仅显示激活的 */
    animation: fadeIn 0.3s ease-out; 
}

/* 4. 顶部动作栏对齐 (筛选下拉框 + 导出按钮) */
.log-actions { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

/* 统一动作栏内的控件高度 */
.log-actions .form-control {
    height: 34px;
    padding: 4px 12px;
    font-size: 13px;
    width: auto;
    min-width: 120px;
}

#btn-export-logs {
    height: 34px;
    padding: 0 15px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 5. 针对日志表格的行高优化 */
#login-logs-table td, 
#activity-logs-table td {
    padding: 15px 8px !important; /* 适当增加间距，让界面更透气 */
    font-size: 13px;
}

/* 修复图片中表格 header 出现在底部的视觉错误 */
.table-responsive {
    margin-top: 10px;
    background: #fff;
    border-radius: 8px;
}

/* 6. 暗黑模式下的专项适配 */
[data-theme="dark"] .tab-btn {
    background: #2d303a;
    border-color: #3f444e;
    color: #94a3b8;
}

[data-theme="dark"] .tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
/* 公告 Toast */
.announcement-toast {
    position: fixed !important; top: 30px !important; right: 30px !important; width: 340px !important; z-index: 99999 !important;
    background: #ffffff !important; color: #333333 !important; border-left: 5px solid #005A9C !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15) !important; padding: 20px !important; border-radius: 12px !important;
    display: flex !important; gap: 15px; animation: toastSlideIn 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.announcement-toast-title { font-weight: bold; color: #333; margin-bottom: 5px; font-size: 0.95rem; }
.announcement-toast-body { color: #666; font-size: 0.85rem; line-height: 1.5; }
.announcement-toast i { color: #005A9C !important; font-size: 1.4rem !important; margin-top: 2px; }
.announcement-toast.fade-out { opacity: 0; transform: translateX(50px); transition: all 0.5s ease; }

/* ==========================================================================
   13. 业务模块：系统设置 (Settings Page)
   ========================================================================== */
.settings-container { display: grid; grid-template-columns: 2fr 1fr; gap: 25px; align-items: start; }
.settings-main .card:nth-child(1) { border-left: 4px solid var(--primary-color); }
.settings-main .card:nth-child(2) { border-left: 4px solid var(--success-color); }
.settings-sidebar .card:nth-child(1) { border-left: 4px solid var(--warning-color); }
.settings-sidebar .card:nth-child(2) { border-left: 4px solid var(--info-color); }

.setting-row { display: flex; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--border-color); }
.setting-row:last-child { border-bottom: none; }
.setting-label { flex: 0 0 140px; font-size: 0.95rem; color: var(--text-main); font-weight: 500; }
.setting-control { flex: 1; }
.setting-control input[type="text"], .setting-control input[type="password"], .setting-control textarea { width: 100%; border-radius: 6px; }

.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 12px 10px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.info-table tr:last-child td { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value { text-align: right; font-weight: 600; color: var(--text-main); }

#announcement-preview-box { border: 1px solid var(--border-color); box-shadow: none !important; min-height: 100px; background: #fff; pointer-events: none; }
.announcement-toast-content { flex: 1; }

/* ==========================================================================
   14. 响应式适配 (Responsive)
   ========================================================================== */
@media (max-width: 1200px) {
    .charts-row { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 1100px) {
    .settings-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; height: 100%; z-index: 2000; transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .stats-cards { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr !important; }
    
    /* 移动端表格卡片化 */
    .table-responsive table, .table-responsive thead, .table-responsive tbody, .table-responsive th, .table-responsive td, .table-responsive tr { display: block; }
    .table-responsive thead tr { position: absolute; top: -9999px; left: -9999px; }
    .table-responsive tr { background: #fff; border-radius: 12px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); padding: 10px; }
    .table-responsive td { border: none; border-bottom: 1px solid #f0f0f0; position: relative; padding-left: 40% !important; text-align: right !important; min-height: 40px; display: flex; align-items: center; justify-content: flex-end; }
    .table-responsive td:last-child { border-bottom: none; justify-content: center; padding-left: 0 !important; margin-top: 10px; }
    .table-responsive td:before { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); width: 35%; white-space: nowrap; font-weight: bold; color: #666; text-align: left; content: attr(data-label); }
}

/* 动画 */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastSlideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ==========================================================================
   15. 细节优化补丁 (Detail Patches) - IP 空状态 & 表格居中
   ========================================================================== */

/* 1. IP 黑名单空状态美化 (Empty State for IP Blacklist) */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background-color: #f8fafc; /* 浅灰底色 */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px); /* 点阵纹理 */
    background-size: 16px 16px;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    text-align: center;
    min-height: 120px;
}

.empty-state-container i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #cbd5e1; /* 图标颜色更淡，不抢眼 */
}

.empty-state-container p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 暗黑模式适配 */
[data-theme="dark"] .empty-state-container {
    background-color: #162032 !important;
    background-image: radial-gradient(#334155 1px, transparent 1px) !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
[data-theme="dark"] .empty-state-container i {
    color: #475569 !important;
}

/* 2. 费率配置表格强制居中 (Fee Editor Table Center Alignment) */
.editor-table th,
.editor-table td {
    text-align: center !important; /* 强制所有单元格居中 */
    vertical-align: middle !important;
}

/* 针对输入框也强制居中 */
.editor-input {
    text-align: center !important;
}

/* 如果第一列原本设计为左对齐（例如名称列），可以特例保留，
   但在您的截图中看起来是纯数值，所以全部居中更整齐。
   如果未来需要第一列左对齐，请取消注释下面这行： */
/* .editor-table td:first-child .editor-input[type="text"] { text-align: left !important; } */

/* ==========================================================================
   16. 终极暗黑模式适配 (Dark Mode Overrides) - V12.0 Final Polish
   修复目标：费率配置页左侧列表背景色与文字颜色冲突问题。
   ========================================================================== */
[data-theme="dark"] {
    
    /* --- 核心色盘 --- */
    --bg-body: #0f172a;        /* L1: 页面底色 */
    --bg-card: #1e293b;        /* L2: 卡片底色 */
    --bg-input: #334155;       /* L3: 输入框底色 */
    --border-color: #334155;   /* 边框颜色 */
    --text-main: #f1f5f9;      /* 亮白文字 */
    --text-secondary: #94a3b8; /* 浅灰文字 */
    --primary-color: #38bdf8;  /* 主色调 */
    --hover-bg: rgba(56, 189, 248, 0.15); 

    /* =========================================================
       A. 费率配置页左侧列表专项修复 (Fix: 截图左侧问题)
       ========================================================= */

    /* 1. 分组容器去白 */
    .standards-group, 
    .standards-group .group-body {
        background-color: transparent !important;
        border-color: transparent !important;
    }

    /* 2. 分组标题 */
    .group-header {
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        color: var(--text-main) !important;
        margin-bottom: 5px;
        border-radius: 6px;
    }
    .group-header:hover {
        background-color: var(--hover-bg) !important;
    }

    /* 3. 列表项 (Fix: 选中态背景过亮导致文字看不清) */
    .standard-item {
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: none !important;
    }
    
    /* 悬停态：微亮蓝 */
    .standard-item:hover {
        background-color: rgba(56, 189, 248, 0.1) !important;
        border-color: var(--primary-color) !important;
    }
    
    /* 选中态：深蓝底 + 亮蓝边框 (确保文字可见) */
    .standard-item.active {
        background-color: rgba(15, 23, 42, 0.8) !important; /* 深色底 */
        border: 1px solid var(--primary-color) !important;
        box-shadow: 0 0 0 1px var(--primary-color) !important; /* 增加光晕 */
    }

    /* 4. 列表文字强制颜色 */
    .std-name { 
        color: #ffffff !important; 
        font-weight: 500 !important;
    }
    .std-code { 
        color: #94a3b8 !important; 
    }
    
    /* 选中时的文字高亮 */
    .standard-item.active .std-name {
        color: var(--primary-color) !important;
    }

    /* =========================================================
       B. 之前已修复的模块 (保留以防回退)
       ========================================================= */

    /* 1. 用户列表行内编辑 */
    .editable-row .value { color: #ffffff !important; font-weight: 500 !important; }
    .editable-row .icon { color: var(--text-secondary) !important; }
    .placeholder-gray { color: #64748b !important; font-style: italic; }

    /* 2. 抽屉与弹窗文字 */
    .drawer-header-info h3, .step-title, .fee-title { color: #ffffff !important; }
    .info-key, .label, .step-time, .fee-amount small { color: var(--text-secondary) !important; }
    .info-val, .value, .num, .footer-total span { color: #ffffff !important; }

    /* 3. 项目预览弹窗去白 */
    .project-meta-card, .fee-card { background-color: var(--bg-card) !important; border-color: var(--border-color) !important; }
    .meta-header { background-color: #162032 !important; border-bottom: 1px solid var(--border-color) !important; color: #ffffff !important; }
    .preview-footer { background: #162032 !important; border-top: 1px solid var(--border-color) !important; color: #ffffff !important; }
    
    /* =========================================================
       C. 全局基础覆盖 (Global Base)
       ========================================================= */

    /* 页面与主容器 */
    body, .admin-wrapper, .content, .main-content-area, .standards-sidebar { 
        background-color: var(--bg-body) !important; 
        color: var(--text-main) !important;
    }

    /* 卡片与弹窗 */
    .card, .modal-content, .modal-dialog, 
    .drawer-content, .drawer-card,
    .project-card, .settings-main .card, .settings-sidebar .card,
    .spotlight-content, .custom-dialog-box {
        background-color: var(--bg-card) !important;
        border-color: var(--border-color) !important;
        color: var(--text-main) !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
    }

    /* 头部与吸顶元素 */
    .navbar, .card-header, .modal-header, .drawer-header,
    .standards-header-fixed, .project-card-header,
    .drawer-profile-header, .filter-toolbar, .log-actions {
        background-color: var(--bg-card) !important;
        border-bottom: 1px solid var(--border-color) !important;
        color: var(--text-main) !important;
    }

    /* 底部固定栏 */
    .modal-footer, .sidebar-footer, #projects-modal-footer, .spotlight-footer {
        background-color: #162032 !important;
        border-top: 1px solid var(--border-color) !important;
    }

    /* 内部组件背景 */
    .stat-item, .detail-content, .empty-tips, .rule-block, 
    .sandbox-panel, .composite-fields-container {
        background-color: #162032 !important;
        border-color: var(--border-color) !important;
        color: var(--text-main) !important;
    }

    /* =========================================================
       D. 表单、表格与交互
       ========================================================= */

    /* 输入框统一 */
    .form-control, select, textarea, 
    .search-bar input, .standards-search-wrapper input, .spotlight-search-box input,
    .editor-input, .inline-edit-input, .drawer-edit-input,
    #raw-announcement-text, #ip-blacklist-container,
    .sandbox-result, .sandbox-log {
        background-color: var(--bg-input) !important;
        color: var(--text-main) !important;
        border: 1px solid var(--border-color) !important;
    }
    
    /* 下拉选项 */
    option { background-color: var(--bg-card) !important; color: var(--text-main) !important; }

    /* 禁用状态 */
    .form-control:disabled, input:disabled, select:disabled {
        background-color: rgba(255, 255, 255, 0.05) !important;
        color: var(--text-secondary) !important;
        border-color: transparent !important;
    }

    /* 表格 */
    .table-responsive { background-color: transparent !important; border: 1px solid var(--border-color) !important; }
    .table, .editor-table { background-color: transparent !important; }
    .table thead th, .editor-table th {
        background-color: #111827 !important;
        color: var(--text-secondary) !important;
        border-color: var(--border-color) !important;
    }
    .table td, .editor-table td { border-color: var(--border-color) !important; color: var(--text-main) !important; }
    .table tbody tr:hover, .activity-row:hover { background-color: var(--hover-bg) !important; }

    /* 按钮 */
    .btn-secondary, .btn-xs, .close-drawer, .btn-add-row {
        background-color: transparent !important;
        border: 1px solid var(--text-secondary) !important;
        color: var(--text-secondary) !important;
    }
    .btn-secondary:hover, .btn-xs:hover, .close-drawer:hover, .btn-add-row:hover {
        background-color: var(--hover-bg) !important;
        color: var(--primary-color) !important;
        border-color: var(--primary-color) !important;
    }

    /* 标签 */
    .filter-tag, .tag {
        background-color: var(--bg-input) !important;
        color: var(--text-secondary) !important;
        border: 1px solid var(--border-color) !important;
    }
    .filter-tag.active {
        background-color: var(--primary-color) !important;
        color: #fff !important;
        border-color: var(--primary-color) !important;
    }

    /* =========================================================
       E. 暴力清除 JS 内联样式
       ========================================================= */
    div[style*="background:#fff"],
    div[style*="background: #fff"],
    div[style*="background-color:#fff"],
    div[style*="background-color: #fff"],
    div[style*="background:#f8f9fa"],
    div[style*="background: #f8f9fa"] {
        background-color: var(--bg-card) !important;
        background-image: none !important;
        color: var(--text-main) !important;
        border-color: var(--border-color) !important;
    }
    
    /* 修复空状态背景 */
    .empty-state-wrapper, #fee-rules-empty {
        background-color: var(--bg-body) !important;
        background-image: radial-gradient(#334155 1px, transparent 1px) !important;
        border: 1px dashed var(--border-color) !important;
        color: var(--text-secondary) !important;
    }
    .empty-icon-box .main-icon { color: #334155 !important; }

    /* 滚动条 */
    ::-webkit-scrollbar-track { background-color: var(--bg-body) !important; }
    ::-webkit-scrollbar-thumb { background-color: #475569 !important; border: 2px solid var(--bg-body) !important; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background-color: #64748b !important; }
}