/* ============================================
   星晟大数据管理系统 v5.0 - 主样式
   阳光活力风格 🌅
   ============================================ */

/* ⛔ 兜底加载：正常应由页面模板（base.html / login.html / register.html）
   在最前面用 <link> 引入 tokens.css；这里再兜一层，
   保证「模板缓存还没刷新」时变量也不会失效（否则整套界面会掉色掉边框）。 */
@import url("/static/css/tokens.css?v=1");

/* ============================================================
   全站的颜色 / 圆角 / 间距 / 字号 / 阴影 变量，已统一搬到
   static/css/tokens.css（2026-09-14 系统统一化·第 2 批「立尺子」）。

   ⛔ 本文件不再定义任何变量，只引用 var(--xxx)；要改配色请去 tokens.css。
   ⛔ tokens.css 必须在本文件**之前**加载
      （base.html / login.html / register.html 三处都已接好）。
   ============================================================ */

/* ==================== 全局重置 ==================== */
* { box-sizing: border-box; }
body {
    margin: 0;
    padding: 0;
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 登录页 ==================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--login-bg-grad);
    background-attachment: fixed;
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}
.login-card {
    background: var(--card);
    border-radius: 24px;
    padding: 48px 36px;
    box-shadow:
        0 4px 6px -1px rgba(8,145,178,0.08),
        0 20px 50px -12px rgba(8,145,178,0.12);
    text-align: center;
}
.login-logo .logo-icon-img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}
.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(8,145,178,0.35);
}
.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(8,145,178,0.45);
    color: white;
}
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }
.login-footer {
    margin-top: 24px;
    font-size: 15px;
}
.login-slogan {
    font-weight: 700;
    font-size: 16px;
    background: var(--slogan-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== 侧边导航 ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transition: width 0.3s ease;
}
.sidebar-header {
    padding: 24px 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo {
    font-size: 36px;
    line-height: 1;
}
.sidebar-logo img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
}
.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin-top: 6px;
    letter-spacing: 2px;
}
.sidebar-version {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.nav-section-title {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.45;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.78);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
    border-left-color: rgba(255,255,255,0.3);
}
.nav-link.active {
    color: white;
    background: rgba(255,255,255,0.18);
    border-left-color: white;
    font-weight: 600;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; }

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.user-info-mini {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 内容区 Tab 样式（覆盖侧边栏 nav-link） ==================== */
#salaryTabs {
    border: none;
    background: transparent;
    gap: 6px;
}
#salaryTabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-input);
    border-radius: 20px;
    background: white;
    transition: all 0.15s;
    text-decoration: none;
}
#salaryTabs .nav-link:hover {
    color: var(--primary);
    background: var(--primary-bg);
    border-color: var(--primary-light);
}
#salaryTabs .nav-link.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(8,145,178,0.3);
}
#salaryTabs .nav-link i { font-size: 15px; }

/* ==================== 工资管理表格统一样式（修复列错位） ==================== */
#mainContent .table-responsive { overflow-x: auto; }
/* ⛔ 2026-09-16 删除：原先这里用 12 行 `#salaryTabContent table {...}` 给**工资页单独开后门**，
   而其他所有记录页用的是统一的 `.data-table-container`。同一件事两套写法，正是
   「系统统一化」要收的病 —— 工资页的主表格已改走 `.data-table-container`（见上方「数据表格」段），
   这 12 行特判随即删除。以后**不要再按页面 ID 写表格样式**。 */

/* 年份选择器下拉滚动 */
.history-year-select {
    appearance: none;
    -webkit-appearance: none;
}
.history-year-select option {
    padding: 4px 8px;
}
.btn-logout {
    background: rgba(255,255,255,0.12) !important;
    color: rgba(255,255,255,0.85) !important;
    border: 1px solid rgba(255,255,255,0.18) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    transition: all 0.2s !important;
}
.btn-logout:hover {
    background: rgba(239,68,68,0.7) !important;
    color: white !important;
    border-color: transparent !important;
}

/* ==================== 主内容区 ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px;
    transition: margin-left 0.3s ease;
}
.content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
}

/* ==================== 页面头部 ==================== */
.page-header {
    margin-bottom: 24px;
}
.page-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 4px 0;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== KPI 卡片 ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.kpi-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(8,145,178,0.06);
    border: 1px solid var(--border-light);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(8,145,178,0.12);
}
.kpi-card.kpi-orange::before { background: var(--primary); }
.kpi-card.kpi-blue::before { background: var(--cyan); }
.kpi-card.kpi-green::before { background: var(--green); }
.kpi-card.kpi-purple::before { background: var(--purple); }
.kpi-card.kpi-cyan::before { background: var(--cyan-light); }
.kpi-card.kpi-amber::before { background: var(--amber); }
.kpi-record-eng::before { background: var(--primary); }
.kpi-card.kpi-record-trans::before { background: var(--cyan); }
.kpi-card.kpi-record-field::before { background: var(--green); }
.kpi-card.kpi-record-log::before { background: var(--purple); }

.kpi-icon { font-size: 36px; flex-shrink: 0; }
.kpi-info { flex: 1; min-width: 0; }
.kpi-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
}
.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ==================== 图表卡片 ==================== */
.chart-row { display: grid; grid-template-columns: 1fr; gap: 20px; }
.chart-card {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(8,145,178,0.04);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}
.chart-header h5 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==================== 档案卡片网格 ==================== */
/* 档案页面：固定头部 + 卡片滚动区域 */
.archive-page-wrapper {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 28px;
    background: var(--bg-page);
    z-index: 1;
}
.archive-page-wrapper .page-header { flex-shrink: 0; margin-bottom: 12px; }
.archive-page-wrapper .filter-bar { flex-shrink: 0; margin-bottom: 12px; }
.archive-card-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.archive-card-scroll .card-grid {
    margin-top: 8px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    margin-top: 20px;
}
/* ⛔ 2026-09-14 第 4 批「收卡片」：容器外观（底色 / 边框 / 圆角 / 阴影 / 内边距）
   已统一到 static\css\ui.css 的 `.ui-card` 别名组，本文件不再重复定义。
   这里只留「档案卡片」特有的行为与子元素规则。 */
.archive-card {
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.archive-card .card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}
.archive-card:hover .card-actions {
    opacity: 1;
}
.archive-card .card-actions .btn-icon-sm {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 13px;
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.archive-card .card-actions .btn-icon-sm:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    transform: scale(1.1);
}
.archive-card.card-hidden {
    opacity: 0.6;
    background: var(--bg-muted);
    border-style: dashed;
}
.archive-card.card-hidden .card-name {
    text-decoration: line-through;
    color: var(--text-muted);
}
.archive-card .card-status-badge {
    position: absolute;
    top: 10px;
    left: 12px;
    transform: none;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 5;
}
.status-active { background: var(--success-bg); color: var(--success-text); }
.status-warning { background: var(--border-light); color: var(--amber-text-deep); }
.status-archive { background: var(--cyan-bg); color: var(--danger-text-deep); }

.archive-card .card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 18px;
    margin-bottom: 4px;
    padding-right: 0;
    line-height: 1.3;
}
.archive-card .card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.archive-card .card-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-light);
}
.archive-card .stat-item {
    text-align: center;
    min-width: 0;
    overflow: hidden;
}
.archive-card .stat-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    word-break: break-all;
}
.archive-card .stat-lbl {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 筛选栏 ==================== */
.filter-bar {
    background: var(--card);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    overflow: visible;
    position: relative;
    z-index: 100;
}
.filter-bar label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.filter-bar input,
.filter-bar select {
    font-size: 13px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-warm);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}

/* ==================== 数据表格 ==================== */
.data-table-container {
    background: var(--card);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    /* 固定高度，超出部分由内部 .table-wrapper 处理滚动 */
    height: calc(100vh - 250px);
    overflow-x: auto;
    overflow-y: hidden;
}
/* 表格包裹层：横向滚动条始终可见，纵向滚动在这里 */
.data-table-container > .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100% - 27px);  /* 留出分页按钮栏高度（约16px + margin-top 1px + padding-bottom 10px） */
}
.table { margin: 0; }
/* 可调列宽表格 */
.col-resizable { table-layout: auto; }
.col-resizable th, .col-resizable td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table-container .table thead th {
    background: var(--card);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-bottom: 2px solid var(--gray-400);
    white-space: nowrap;
    padding: 3px 4px;
    font-size: 12px;
    line-height: 1.4;
    position: relative;
    text-align: center;
}
.data-table-container .table tbody td {
    font-size: 13px;
    vertical-align: middle;
    padding: 0px 4px;
    font-size: 12px;
    line-height: 1.0;
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    text-align: center;
}
.data-table-container .table tbody tr:hover {
    background: var(--bg-warm);
}
.data-table-container .table tbody tr:last-child td { border-bottom: none; }

/* 列拖拽 */
.drag-row { cursor: grab; }
.drag-row:active { cursor: grabbing; }
.drag-row.dragging { opacity: 0.4; background: var(--bg-warm) !important; }
.drag-header { cursor: grab; user-select: none; position: relative; }
.drag-header:active { cursor: grabbing; }
.drag-header .sort-handle { display: inline-block; width: 14px; text-align: center; color: var(--text-muted); font-size: 11px; margin-right: 2px; }
/* SortableJS 表头拖拽样式 */
.drag-ghost-th { opacity: 0.4; background: var(--border-light) !important; border: 2px dashed var(--primary) !important; }
.drag-chosen-th { background: var(--primary-bg) !important; }
.drag-dragging-th { background: var(--card) !important; box-shadow: 2px 4px 12px rgba(0,0,0,0.15) !important; cursor: grabbing !important; }
/* 列设置面板 */
.col-toggle-btn { font-size: 12px !important; padding: 4px 12px !important; }
.col-toggle-panel label { transition: opacity 0.2s; }
.col-toggle-panel input[type=checkbox] { accent-color: var(--primary); }

/* 状态标签 */
.badge-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-settled { background: var(--success-bg); color: var(--success-text); }
.badge-unsettled { background: var(--cyan-bg); color: var(--danger-text-deep); }
.badge-visa-yes { background: var(--info-bg); color: var(--info-text-deep); }
.badge-visa-no { background: var(--gray-100); color: var(--gray-500); }

/* ==================== 按钮样式 ==================== */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    padding: 8px 20px !important;
    transition: all 0.25s !important;
    box-shadow: 0 3px 12px rgba(8,145,178,0.3) !important;
}
.btn-primary-custom:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(8,145,178,0.4) !important;
    color: white !important;
}
.btn-outline-custom {
    background: white !important;
    color: var(--primary) !important;
    border: 1.5px solid var(--primary) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    padding: 8px 20px !important;
    transition: all 0.25s !important;
}
.btn-outline-custom:hover {
    background: var(--primary) !important;
    color: white !important;
}
.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px !important;
    font-size: 14px;
    background: var(--card) !important;
    color: var(--text-primary) !important;
}

/* ==================== 弹窗增强 ==================== */
.modal-content {
    border: none;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 18px 24px;
}
.modal-header .modal-title {
    font-weight: 700;
    font-size: 17px;
    color: var(--text-primary);
}
.modal-body { padding: 24px; }
.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 16px 24px;
}

/* 表单控件 */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--border);
    padding: 8px 12px;
    font-size: 14px;
    min-height: 36px;
    transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}
.form-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* ==================== 分页 ==================== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 18px 0 8px;
    color: var(--text-primary);
}
.pagination-wrapper .page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: var(--text-secondary);
}
.pagination-wrapper .page-btn:hover { background: var(--bg-warm); border-color: var(--primary-light); }
.pagination-wrapper .page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}
.pagination-wrapper .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-wrapper .page-info { font-size: 12px; color: var(--text-muted); margin: 0 8px; }

/* ==================== Toast 提示 ==================== */
.toast-custom {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border: none;
    overflow: hidden;
    color: var(--text-primary);
}
.toast-custom .toast-header {
    background: var(--bg-warm);
    border-bottom: 1px solid var(--border-light);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
}
.toast-success .toast-header { color: var(--green); }
.toast-error .toast-header { color: var(--red); }
.toast-warning .toast-header { color: var(--amber); }
.toast-info .toast-header { color: var(--info); }

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h4 { color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto; }

/* ==================== 分页器 ==================== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 16px 8px;
    flex-wrap: wrap;
}
.page-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 8px;
    white-space: nowrap;
}
.page-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.page-btn:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.page-btn.active,
.page-btn:disabled {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    cursor: default;
}
.page-ellipsis {
    min-width: 28px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== 动画 ==================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.4s ease-out both;
}
.fade-in-up:nth-child(1) { animation-delay: 0.02s; }
.fade-in-up:nth-child(2) { animation-delay: 0.04s; }
.fade-in-up:nth-child(3) { animation-delay: 0.06s; }
.fade-in-up:nth-child(4) { animation-delay: 0.08s; }
.fade-in-up:nth-child(5) { animation-delay: 0.10s; }
.fade-in-up:nth-child(6) { animation-delay: 0.12s; }

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 767px) {
    /* 移动端折叠按钮 */
    .sidebar-toggle-btn {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 999;
        width: 40px;
        height: 40px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        cursor: pointer;
    }
    .sidebar-toggle-btn:active { transform: scale(0.95); }
    
    /* 移动端遮罩层 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.7);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 侧边栏移动端显示 */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.show { transform: translateX(0); }
    
    /* 通用表格移动端横向滚动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive table {
        min-width: 600px;
    }
    
    /* KPI卡片移动端 */
    .kpi-grid { gap: 8px; }
    .kpi-card { padding: 12px 8px; }
    .kpi-value { font-size: 20px; }
    .kpi-label { font-size: 11px; }
}

/* ==================== 全局加载指示器 ==================== */
.global-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
[data-theme="dark"] .global-loading {
    background: rgba(15,23,42,0.95);
}
.global-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
/* 小型加载指示（用于按钮内） */
.btn-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* 左上角深色模式按钮 - 暗色模式适配 */
[data-theme="dark"] #themeToggle {
    background: rgba(30,41,59,0.9);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}
[data-theme="dark"] #themeToggle:hover {
    background: rgba(51,65,85,0.95);
}

/* ==================== 通知铃铛 + 弹窗样式 ==================== */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 8px auto;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    color: rgba(255,255,255,0.85);
}
.notification-bell:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}
.notification-bell .notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239,68,68,0.4);
}

/* 通知下拉面板 */
.notif-panel {
    position: fixed;
    bottom: 140px;
    left: 20px;
    width: 320px;
    max-height: 400px;
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    border: 1px solid var(--border-light);
    z-index: 10000;
    overflow: hidden;
    animation: notifSlideIn 0.2s ease-out;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-warm);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.notif-header .btn-link {
    font-size: 12px;
    color: var(--primary);
    padding: 0;
}
.notif-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 8px 0;
}
.notif-loading, .notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* 通知项样式 */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.notif-item:hover {
    background: var(--bg-warm);
}
.notif-item.unread {
    background: rgba(8,145,178,0.05);
}
.notif-item.notif-reject { border-left-color: var(--red); }
.notif-item.notif-pending { border-left-color: var(--amber); }
.notif-item.notif-success { border-left-color: var(--green); }
.notif-item.notif-info { border-left-color: var(--info); }

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.notif-reject .notif-icon { background: var(--danger-bg); color: var(--danger-text); }
.notif-pending .notif-icon { background: var(--warning-bg); color: var(--warning-text); }
.notif-success .notif-icon { background: var(--success-bg-soft); color: var(--success-text-soft); }
.notif-info .notif-icon { background: var(--info-bg); color: var(--info-text); }

.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.4;
}
.notif-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 移动端适配 */
@media (max-width: 767px) {
    .notif-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 160px;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar, .filter-bar, .btn, .pagination-wrapper, nav,
    .sidebar-toggle-btn, .sidebar-overlay, .ai-chat-btn, .ai-chat-panel,
    .global-loading, #toastContainer, #themeToggle { display: none !important; }
    .content-area, .main-content { margin-left: 0 !important; padding: 0 !important; }
    .data-table-container { overflow: visible !important; }
    table { font-size: 10px; }
}

/* ==================== 档案SmartSelect下拉框（position:absolute 跟随父容器，Tab切换时自动清掉）==================== */
.archive-smart-select {
    position: relative;
    z-index: 1000;
}
.archive-smart-select .archive-ss-dropdown {
    position: absolute !important;
    z-index: 99999 !important;
    min-width: 220px;
    top: 100%;
    left: 0;
    background: var(--card);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
}


/* 隐藏列 */
/* 列隐藏 */
table .col-hidden { display: none !important; }



/* ========== 表格自适应宽度 ========== */
/* 记录列表表格：自动宽度，不强制固定 */
.data-table-container table {
    table-layout: auto !important;
    width: 100% !important;
    min-width: max-content !important;
}

.data-table-container table th,
.data-table-container table td {
    white-space: nowrap !important;
    padding: 6px 10px !important;
}

/* 隐藏列 */
table .col-hidden { display: none !important; }


/* ========== 表格紧凑模式 ========== */
.data-table-container table th,
.data-table-container table td {
    padding: 4px 8px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
}

.data-table-container table thead th {
    font-weight: 600 !important;
}


/* ========== 表格紧凑模式（强制覆盖Bootstrap） ========== */
.data-table-container table { border-collapse: collapse !important; }
.data-table-container table thead th,
.data-table-container table tbody td {
    padding: 2px 8px !important;
    height: 26px !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
}


/* ==================== 侧边栏折叠按钮 ==================== */
.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.3s;
    font-size: 14px;
}
.sidebar-collapse-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.1);
}
.sidebar-collapse-btn i {
    transition: transform 0.3s;
}

/* ==================== 侧边栏收起状态 ==================== */
.sidebar.collapsed {
    width: 60px;
}
.sidebar.collapsed .sidebar-header {
    padding: 12px 0;
    position: relative;
}
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-version {
    display: none;
}
.sidebar.collapsed .sidebar-collapse-btn {
    right: -15px;
    top: 20px;
    transform: none;
}
.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}
.sidebar.collapsed .sidebar-nav {
    padding: 12px 0;
}
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
    margin: 0 6px;
    border-radius: 8px;
}
.sidebar.collapsed .nav-link i {
    font-size: 1.3em;
    margin: 0;
}
.sidebar.collapsed .nav-text {
    display: none;
}
.sidebar.collapsed .sidebar-footer {
    padding: 12px 6px;
}
.sidebar.collapsed .user-info-mini {
    display: none;
}
.sidebar.collapsed .notification-bell {
    margin: 0 auto 8px;
}
.sidebar.collapsed .sidebar-footer > div:last-child {
    flex-direction: column;
    gap: 4px;
}
.sidebar.collapsed .sidebar-footer .btn-logout {
    padding: 8px;
    justify-content: center;
}
.sidebar.collapsed .sidebar-footer .nav-text {
    display: none;
}

/* 主内容区跟随调整 */
.sidebar.collapsed ~ .main-content {
    margin-left: 60px;
}
