/* v74 统一字号体系：与 base.html 内联令牌一致，作为外部样式表的定义/fallback */
:root {
    --fs-xs: 0.8rem;     /* 12.8px 极小辅助文字/角标 */
    --fs-sm: 0.9rem;     /* 14.4px 次级正文、表格正文、说明 */
    --fs-base: 1rem;     /* 16px 正文基准 */
    --fs-md: 1.1rem;     /* 17.6px 强调正文 */
    --fs-lg: 1.2rem;     /* 19.2px 小标题 */
    --fs-xl: 1.5rem;     /* 24px 区块标题 */
    --fs-2xl: 2rem;      /* 32px 页面大标题 */
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* v82: 页面底色与标题色。想回到旧的紫渐变，只改这两行即可 */
    --pms-page-bg: #eef1f9;
    --pms-title-fg: #24283b;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.6;
    /* v82: 原为 135deg 高饱和紫渐变。卡片之间 12~32px 的缝隙露出紫底，
       视觉上像白色面板被切成碎片；页面底部内容不足时整片紫色又像没加载完。
       改为浅灰底，品牌紫保留在导航、表头、按钮与标题装饰上。 */
    background: var(--pms-page-bg, #eef1f9);
    min-height: 100vh;
}

/* 导航栏样式 */
.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.navbar-brand {
    font-size: var(--fs-xl);
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

/* 主容器 - 扩大到填满页面 */
.container {
    max-width: 95% !important;
    width: 95% !important;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* 页面标题 */
.page-title {
    font-size: var(--fs-2xl);
    color: var(--pms-title-fg, #24283b);
    margin-bottom: 1.25rem;
    text-align: center;
    letter-spacing: 0.01em;
}

/* 统计卡片网格 - 扩展宽度 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    margin-bottom: 1rem;
    width: 100%;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-number {
    font-size: var(--fs-2xl);
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: var(--fs-sm);
}

/* 卡片样式 - 扩大宽度 */
.card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100% !important;
}

.card h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: var(--fs-xl);
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
}

/* 项目列表容器 - 扩大 */
.project-list-container {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
}

/* 表格样式 - 扩大宽度 */
.table-container {
    width: 100%;
    overflow: visible;
}

.project-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.project-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.project-table thead th {
    color: white;
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: var(--fs-xs);
    white-space: nowrap;
    position: relative;
    overflow: visible;
}

.project-table tbody tr {
    border-bottom: 0.5px solid #f0f0f0;
    transition: background-color 0.3s;
}

.project-table tbody tr:hover {
    background-color: #f8f9ff;
}

.project-table td {
    padding: 0.6rem 0.5rem;
    color: #333;
    font-size: var(--fs-sm);
    white-space: nowrap;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: var(--fs-base);
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: var(--fs-base);
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 状态徽章 */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: 20px;
    text-align: center;
}

/* Flash 消息 */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* 空状态 */
/* v82: 原 4rem 上下内边距，空状态下整块卡片被撑到 250px 高，
   详情页里像内容没加载出来 */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: #999;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 1rem;
}

/* 页面头部 */
.page-header {
    margin-bottom: 2rem;
    width: 100%;
}

.page-header h1 {
    color: var(--pms-title-fg, #24283b);
    font-size: var(--fs-2xl);
    margin-bottom: 1rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 95% !important;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .container {
        max-width: 100% !important;
        padding: 0 0.5rem 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .project-table {
        font-size: var(--fs-sm);
    }
    
    .project-table th,
    .project-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* 进度条 */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.6s ease;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================
   v83 移动端兜底（≤768px）
   不改变桌面观感，只在窄屏收紧字号与间距、并保证表格不撑破页面
   ========================================================== */
@media (max-width: 768px) {
    .page-header { margin-bottom: 1rem; }
    .page-header h1 { font-size: var(--fs-xl); }
    .btn { padding: 0.45rem 0.7rem; }
    .btn-sm { padding: 0.3rem 0.5rem; }
    /* 表格一律限制在容器内滚动，禁止把页面拉宽 */
    .table-container,
    .table-responsive,
    .table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .project-table th,
    .project-table td { padding: 0.35rem 0.4rem; }
    /* 详情页/表单页常见的两列栅格在窄屏一律单列 */
    .form-row,
    .form-grid { grid-template-columns: 1fr !important; }
    .empty-state { padding: 1.8rem 1rem; }
    /* 分页按钮手指友好 */
    .pagination .btn { min-width: 2.4rem; }
}

/* ============ v92: 消息中心 ============ */
.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    margin-right: 0.4rem;
    color: #667eea;
    font-size: 1.02rem;
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.2s ease;
}
.nav-bell:hover { background: #eef0fb; }
.nav-bell .nav-dot {
    position: absolute;
    top: -1px;
    right: -4px;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.notice-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #eef0f4;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.notice-item:last-child { border-bottom: none; }
.notice-item:hover { background: #f8f9ff; }
.notice-item.unread { background: #f4f6ff; }
.notice-item.unread:hover { background: #eef1ff; }
.notice-dot {
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 50%;
    background: #e74c3c;
}
.notice-dot.off { background: transparent; }
.notice-title { display: block; font-size: 0.95rem; font-weight: 700; color: #1f2937; }
.notice-title.read { font-weight: 500; color: #4b5563; }
.notice-body { display: block; margin-top: 0.2rem; color: #6b7280; font-size: 0.88rem; line-height: 1.5; }
.notice-meta { display: block; margin-top: 0.3rem; color: #9aa1ad; font-size: 0.76rem; }
