/* ===== 全局重置与字体 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fb;
    color: #1e293b;
    line-height: 1.4;
    font-size: 14px;
}

/* ===== 登录页面专用 ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 380px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: -0.5px;
}

.login-container .form-group {
    margin-bottom: 1.2rem;
}

.login-container label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #334155;
    font-size: 0.9rem;
}

.login-container input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: white;
}

.login-container input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.login-container button {
    width: 100%;
    padding: 0.7rem;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.login-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

/* ===== 全宽顶部栏 ===== */
.top-bar {
    background: white;
    padding: 0.6rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border-bottom: 1px solid #e2e8f0;
    width: 100%;
    position: relative;
    z-index: 10;
    height: 50px;
}

.top-bar .site-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.top-bar .user-info span {
    color: #334155;
    font-weight: 500;
    font-size: 0.9rem;
}

.top-bar .user-info a {
    color: #4361ee;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background: #eef2ff;
    transition: all 0.2s;
}

.top-bar .user-info a:hover {
    background: #4361ee;
    color: white;
}

/* ===== 主布局 ===== */
.wrapper {
    display: flex;
    min-height: calc(100vh - 50px); /* 减去顶部栏高度 */
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: #1e293b;
    color: #f1f5f9;
    box-shadow: 4px 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.sidebar .nav {
    flex: 1;
    padding: 1rem 0;
    list-style: none;
    overflow-y: auto;
}

.sidebar .nav li {
    margin: 0;
}

.sidebar .nav li a {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar .nav li a:hover {
    background: #334155;
    color: white;
    border-left-color: #4361ee;
}

.sidebar .nav li.has-children > a {
    justify-content: space-between;
}

.sidebar .nav .subnav {
    list-style: none;
    background: #0f172a;
    padding: 0.3rem 0;
    margin: 0;
    display: none;
}

.sidebar .nav li.open .subnav {
    display: block;
}

.sidebar .nav .subnav a {
    padding-left: 2rem;
    font-size: 0.85rem;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f7fb;
    overflow: hidden;
}

.content {
    padding: 1.2rem 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.footer {
    background: white;
    padding: 0.6rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: #64748b;
    font-size: 0.8rem;
}

/* ===== 卡片式内容区域 ===== */
.dashboard, .content > h1 + * {
    background: white;
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    border: 1px solid #eef2f6;
}

/* ===== 表格样式 ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    margin: 1rem 0;
    font-size: 0.9rem;
}

.table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #eef2f6;
    color: #334155;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 紧凑表格辅助类 */
.table-compact th,
.table-compact td {
    padding: 0.4rem 0.8rem;
}

/* 状态徽章 */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.badge-success {
    background: #e6f7e6;
    color: #0b5e0b;
}

.badge-danger {
    background: #fee9e7;
    color: #b91c1c;
}

.badge-warning {
    background: #fff3d6;
    color: #b45b0b;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-primary {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* 复选框组（用于角色列表等） */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
    margin: 0;
    padding: 0.2rem 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4361ee;
    cursor: pointer;
}

/* 单个复选框 */
.form-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 0.4rem;
    vertical-align: middle;
    accent-color: #4361ee;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.btn-primary {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(67, 97, 238, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.btn-success {
    background: #10b981;
    color: white;
    border: none;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-info {
    background: #3b82f6;
    color: white;
    border: none;
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

.btn-edit {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-default {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-default:hover {
    background: #e2e8f0;
}

/* 按钮组 */
.form-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    align-items: center;
}

/* 警告/提示框 */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    font-weight: 500;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}

.alert-success {
    background: #e6f7e6;
    color: #0b5e0b;
    border-left-color: #10b981;
}

.alert-danger {
    background: #fee9e7;
    color: #b91c1c;
    border-left-color: #ef4444;
}

.alert-warning {
    background: #fff3d6;
    color: #b45b0b;
    border-left-color: #f59e0b;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border-left-color: #3b82f6;
}

/* ===== 任务看板卡片 ===== */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.task-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    border: 1px solid #eef2f6;
    transition: all 0.2s;
}

.task-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #d1d9e6;
}

.task-card .badge {
    font-size: 0.7rem;
}

.task-card h3 {
    margin: 0.6rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.task-card h3 a {
    color: #1e293b;
    text-decoration: none;
}

.task-card h3 a:hover {
    color: #4361ee;
}

.task-card p {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

/* ===== 统计图表容器 ===== */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    border: 1px solid #eef2f6;
    margin-bottom: 1rem;
}

.chart-container h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #1e293b;
    font-weight: 600;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    margin: 1rem 0;
}

.pagination .btn {
    min-width: 32px;
    text-align: center;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .wrapper {
        flex-direction: column;
    }
    .main-content {
        width: 100%;
    }
    .top-bar .site-title {
        font-size: 1rem;
    }
    .checkbox-group {
        grid-template-columns: 1fr 1fr;
    }
    .form-actions {
        flex-wrap: wrap;
    }
}