:root {
    /* --- 核心配色：亮色商务风 --- */
    --bg: #f0f2f5;           /* 页面整体背景：浅灰 */
    --panel: #ffffff;        /* 卡片背景：纯白 */
    --panel2: #f8fafc;       /* 次级面板背景 */
    
    --sidebar-bg: #001529;   /* 侧边栏背景：深邃蓝黑 (参考截图) */
    --sidebar-text: #a6adb4; /* 侧边栏文字：浅灰 */
    --sidebar-active: #1890ff; /* 侧边栏选中色：阿里蓝 */
    
    --text: #1f2937;         /* 主要文字：深灰黑 */
    --muted: #6b7280;        /* 辅助文字：中灰 */
    --line: #e5e7eb;         /* 分割线：极淡灰 */
    
    /* --- 功能色 --- */
    --accent: #1677ff;       /* 主题蓝 (更纯正) */
    --danger: #ff4d4f;       /* 错误红 */
    --ok: #52c41a;           /* 成功绿 */
    --warn: #faad14;         /* 警告黄 */
    
    /* --- 布局变量 --- */
    --radius: 8px;           /* 圆角：稍微调小一点更精致 */
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02); /* 柔和阴影 */
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); /* 纯色浅灰背景，去掉原本的渐变 */
    color: var(--text);
    line-height: 1.5;
}

.layout { display: flex; min-height: 100vh; }

/* --- 侧边栏美化 (深色) --- */
.sidebar {
    width: 250px; /* 稍微窄一点更精致 */
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
    z-index: 10;
    transition: width 0.3s;
}

.brand {
    padding: 20px 24px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
    color: #fff;
    background: rgba(255,255,255,0.02); /* 极淡的头部区分 */
}

.nav { padding: 12px 8px; }

.nav a, .nav .nav-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 6px; /* 略微方一点的圆角 */
    color: var(--sidebar-text);
    text-decoration: none;
    border: none;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav a:hover, .nav .nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08); /* 悬浮微微发亮 */
}

/* 选中状态：高亮蓝背景 */
.nav a.active, .nav .nav-item.active {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(22, 119, 255, 0.3);
}

.sidebar .spacer { flex: 1; }
.sidebar .bottom, .side-bottom {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* --- 主内容区域 --- */
.content, .main {
    flex: 1;
    padding: 24px;
    background: var(--bg);
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #111;
}

/* --- 卡片美化 (白底+阴影) --- */
.card {
    background: var(--panel);
    border: none; /* 去掉边框 */
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow); /* 加上阴影 */
    transition: box-shadow 0.3s;
    margin-bottom: 0; /* 让grid控制间距 */
}

.card:hover {
    box-shadow: var(--shadow-hover); /* 鼠标悬浮浮起效果 */
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0; /* 卡片内部极其淡的分割线 */
}

.card-title {
    font-weight: 600;
    font-size: 15px;
    color: #111;
}

/* --- 栅格系统 (保持不变) --- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

@media(max-width: 900px) {
    .sidebar { width: 64px; }
    .brand span, .nav a span, .sidebar .title, .sidebar .sub { display: none; }
    .content { padding: 16px; }
    .col-4, .col-6, .grid2, .grid3 { grid-column: span 12; grid-template-columns: 1fr; }
}

/* --- 表格美化 --- */
.table {
    width: 100%;
    border-collapse: collapse; /* 改为 collapse 更紧凑 */
    border-spacing: 0;
}

.table th {
    background: #fafafa;
    color: var(--muted);
    font-weight: 600;
    text-align: left;
    font-size: 13px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.table td {
    background: transparent;
    border-bottom: 1px solid #f0f0f0; /* 极细分割线 */
    padding: 14px 16px;
    color: var(--text);
    font-size: 14px;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; /* 鼠标悬停行变色 */ }

/* --- 徽标 (Badge) --- */
.badge, .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    border: 1px solid transparent;
    font-weight: 500;
}

.badge.ok, .pill.ok { background: #f6ffed; color: #52c41a; border-color: #b7eb8f; }
.badge.fail, .pill.danger { background: #fff2f0; color: #ff4d4f; border-color: #ffccc7; }
.badge.warn, .pill.warn { background: #fffbe6; color: #faad14; border-color: #ffe58f; }

/* --- 按钮 (Btn) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 2px 0 rgba(0,0,0,0.02);
}

.btn:hover { color: var(--accent); border-color: var(--accent); }

.btn.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 0 rgba(0,0,0,0.04);
}
.btn.primary:hover { background: #4096ff; border-color: #4096ff; }

.btn.danger {
    border-color: var(--danger);
    background: #fff;
    color: var(--danger);
}
.btn.danger:hover { background: var(--danger); color: #fff; }

.btn.small { padding: 4px 10px; font-size: 12px; }

/* --- 表单元素 --- */
.input, select, textarea, .textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
    font-size: 14px;
}

.input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

label, .label {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin: 0 0 8px;
    font-weight: 500;
}

.hint, .small { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* --- 警告框 (Alert) --- */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert.ok { background: #f6ffed; border-color: #b7eb8f; }
.alert.warn { background: #fffbe6; border-color: #ffe58f; }
.alert.danger { background: #fff2f0; border-color: #ffccc7; }

/* 兼容原有的小类名 */
.form-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.form-row .c6 { grid-column: span 6; }
.form-row .c12 { grid-column: span 12; }
.top-actions { display: flex; gap: 10px; }
.sidebar .logo { 
    background: rgba(255,255,255,0.1); 
    border: 1px solid rgba(255,255,255,0.2); 
    color: #fff;
    border-radius: 8px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
}
/* --- 左上角品牌区美化 --- */
.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06); /* 极淡的分割线 */
}

/* 渐变蓝色的 Logo 方块 */
.sidebar .logo-box {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1677ff 0%, #0050b3 100%);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(22, 119, 255, 0.2);
    flex-shrink: 0;
}

.sidebar .brand-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

.sidebar .app-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar .user-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 模拟在线状态的小绿点 */
.sidebar .user-status .dot {
    width: 6px;
    height: 6px;
    background: #52c41a;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(82, 196, 26, 0.4);
}

/* --- 底部退出按钮美化 --- */
.side-bottom {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 这里的按钮样式通过 CSS 独立定义，不依赖原来的 .btn 类 */
.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 77, 79, 0.15); /* 悬浮时淡红色背景 */
    border-color: rgba(255, 77, 79, 0.3);
    color: #ff4d4f; /* 文字变红 */
}
/* --- 核心布局修正：固定侧边栏 --- */

/* 1. 锁定整个网页，禁止 Body 滚动 */
body {
    height: 100vh;
    overflow: hidden; 
}

/* 2. 布局容器占满屏幕 */
.layout {
    height: 100vh; /* 强制占满视口高度 */
    overflow: hidden;
}

/* 3. 侧边栏：高度占满，如果菜单太长则内部滚动 */
.sidebar {
    height: 100%; 
    overflow-y: auto; 
    /* 隐藏侧边栏的滚动条 (Chrome/Safari) 保持美观 */
    scrollbar-width: none; 
}
.sidebar::-webkit-scrollbar { display: none; }

/* 4. 主内容区：高度占满，内部独立滚动 */
.main {
    height: 100%;
    overflow-y: auto; /* 关键：只有这里会滚动 */
    display: flex;
    flex-direction: column;
}

/* 优化：让内容区滚动条更好看一点 */
.main::-webkit-scrollbar { width: 6px; height: 6px; }
.main::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
.main::-webkit-scrollbar-track { background: transparent; }
/* ===============================
   仪表盘专用样式 (已精简优化版)
   =============================== */

/* 1. 欢迎卡片：渐变背景，大气 */
.welcome-card {
    background: linear-gradient(135deg, #001529 0%, #003a70 100%); /* 深邃蓝渐变 */
    color: #fff;
    padding: 32px;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px -5px rgba(0, 58, 112, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.welcome-text h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
}

.welcome-text p {
    margin: 0;
    opacity: 0.8;
    font-size: 14px;
}

.welcome-decoration {
    position: absolute;
    right: -10px;
    bottom: -20px;
    transform: rotate(-10deg);
    pointer-events: none;
}

/* 2. 核心布局修复：自动适应宽度 (Auto Fit) */
/* 这里的 grid-4 不再强制一行4个，而是根据宽度自动换行，防止挤压 */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* 3. 数据统计卡片 (Stat Card) - 最终美化版 */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    /* 柔和阴影 + 极淡边框 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0,0,0,0.02);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 悬停效果：微微上浮 */
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(0,0,0,0.05);
}

/* 图标容器：64x64正方形，禁止变形 */
.stat-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* 核心：防止被压扁 */
    font-size: 0;
}
.stat-icon-wrapper svg { width: 32px; height: 32px; }

/* 图标颜色变体 */
.is-blue    { background: rgba(22, 119, 255, 0.1); color: #1677ff; }
.is-indigo  { background: rgba(114, 46, 209, 0.1); color: #722ed1; }
.is-purple  { background: rgba(196, 29, 127, 0.1); color: #c41d7f; }
.is-emerald { background: rgba(82, 196, 26, 0.1);  color: #52c41a; }
.is-cyan    { background: rgba(19, 194, 194, 0.1); color: #13c2c2; }
.is-orange  { background: rgba(250, 173, 20, 0.1); color: #faad14; }
.is-gray    { background: rgba(0, 0, 0, 0.04);     color: #8c8c8c; }

/* 数据区域 */
.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* 防止文字溢出 */
}

/* 数字：大字体 */
.stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    color: #111827;
    margin-bottom: 4px;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
}

/* 标签：强制不换行 */
.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap; /* 核心：禁止换行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 4. 侧边栏品牌区修复 (对齐与布局) */
.sidebar .brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    padding: 24px 20px;
}

.sidebar .logo-box {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1677ff 0%, #0050b3 100%);
    color: #fff;
    font-weight: 800;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}

.sidebar .brand-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

/* 移动端简单适配 */
@media(max-width: 600px) {
    .welcome-card { padding: 20px; }
}
