/**
 * 应用内页统一布局（部门报告、搜索、管理后台等）
 */

body.app-page-v2 {
    background: var(--page, #f0f2f5);
}

.ap-container {
    width: 100%;
}

.ap-page .nav-icon {
    margin-right: 8px;
    vertical-align: middle;
}

.ap-page .nav-emoji {
    margin-right: 8px;
}

/* 页头 */
.ap-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 0;
}

.ap-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 6px;
}

.ap-header p {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.ap-header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.ap-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent, #409eff);
    color: #fff !important;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ap-btn-primary:hover {
    filter: brightness(1.05);
}

.ap-btn-ghost {
    padding: 10px 18px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    color: #4a5568;
    font-size: 0.9rem;
    cursor: pointer;
}

.ap-btn-ghost:hover {
    border-color: var(--accent, #409eff);
    color: var(--accent, #409eff);
}

/* 工具栏 / 筛选 */
.ap-toolbar,
.ap-panel {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 18px 22px;
    margin-bottom: 18px;
}

.ap-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.ap-toolbar .search-group,
.ap-toolbar .filter-group,
.ap-panel .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
    flex: 1;
    max-width: 280px;
}

.ap-panel {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 18px 22px;
    margin-bottom: 18px;
}

.ap-toolbar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
}

.ap-toolbar input[type="text"],
.ap-toolbar input[type="date"],
.ap-toolbar select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    width: 100%;
}

.ap-toolbar input:focus,
.ap-toolbar select:focus {
    outline: none;
    border-color: var(--accent, #409eff);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.ap-toolbar-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

/* 列表面板 */
.ap-list-panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.ap-list-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.85rem;
    color: #718096;
}

.ap-list-body {
    padding: 14px;
}

/* 部门报告卡片 */
.ap-report-card {
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 14px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.ap-report-card:last-child {
    margin-bottom: 0;
}

.ap-report-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.ap-report-card .report-header,
.ap-report-card .ap-report-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
}

.ap-report-card .report-title,
.ap-report-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 10px 0;
    word-break: break-word;
}

.ap-report-card .report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ap-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ap-badge.daily { background: #c6f6d5; color: #22543d; }
.ap-badge.published { background: #bee3f8; color: #2c5282; }
.ap-badge.draft { background: #feebc8; color: #7b341e; }
.ap-badge.makeup { background: #fed7d7; color: #9b2c2c; }

.ap-report-card .report-author,
.ap-report-card .report-time {
    font-size: 0.82rem;
    color: #718096;
}

.ap-report-card .report-content-wrapper {
    padding: 18px 22px;
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.65;
}

.ap-report-card .report-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf2f7;
}

.ap-report-card .report-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ap-report-card .section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent, #409eff);
    margin-bottom: 8px;
}

/* 空状态 / 加载 */
.ap-empty,
.ap-loading {
    text-align: center;
    padding: 48px 24px;
    color: #718096;
}

.ap-empty-icon {
    font-size: 2.5rem;
    opacity: 0.5;
    margin-bottom: 12px;
}

.ap-empty h3,
.ap-empty h4 {
    color: #2d3748;
    margin-bottom: 8px;
}

/* 分页 */
.ap-pagination,
.pagination.ap-style {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px;
    border-top: 1px solid #edf2f7;
}

.ap-pagination .page-btn,
.pagination.ap-style .page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #4a5568;
    cursor: pointer;
}

.ap-pagination .page-btn.active,
.pagination.ap-style .page-btn.active {
    background: linear-gradient(135deg, var(--accent, #409eff), var(--accent-hover, #337ecc));
    color: #fff;
    border-color: transparent;
}

.ap-page-info,
.mr-page-info {
    font-size: 0.85rem;
    color: #a0aec0;
    margin: 0 8px;
    align-self: center;
}

/* 表格容器 */
.ap-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
}

body.app-page-v2 .data-table {
    width: 100%;
    border-collapse: collapse;
}

body.app-page-v2 .data-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    font-size: 0.82rem;
    border-bottom: 2px solid #edf2f7;
}

body.app-page-v2 .data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.88rem;
    color: #2d3748;
}

body.app-page-v2 .data-table tr:hover td {
    background: #f8fafc;
}

/* 模态框 */
body.app-page-v2 .modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

body.app-page-v2 .modal .modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

body.app-page-v2 .modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid #edf2f7;
}

body.app-page-v2 .modal .modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}

body.app-page-v2 .modal .modal-footer {
    padding: 14px 22px;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 管理后台标签页 */
body.admin-page-v2 .tab-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

body.admin-page-v2 .tab-header {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
    background: #f7fafc;
    border-bottom: 1px solid #edf2f7;
}

body.admin-page-v2 .tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 10px 10px 0 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
}

body.admin-page-v2 .tab-btn.active {
    background: #fff;
    color: #5a67d8;
    font-weight: 600;
    box-shadow: 0 -2px 0 var(--accent, #409eff) inset;
}

body.admin-page-v2 .tab-content {
    padding: 22px;
}

body.admin-page-v2 .content-header {
    background: #f7fafc;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border-left: 4px solid var(--accent, #409eff);
}

body.admin-page-v2 .filters,
body.admin-page-v2 .filters-section {
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: none;
}

/* 管理员报告查看页 */
body.admin-reports-page-v2 {
    background: #eef1f6 !important;
}

body.admin-reports-page-v2 .page-header {
    background: #fff !important;
    color: #1a202c !important;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

body.admin-reports-page-v2 .page-header .header-content h2 {
    color: #1a202c !important;
}

body.admin-reports-page-v2 .page-header .header-content p {
    color: #718096 !important;
    opacity: 1 !important;
}

body.admin-reports-page-v2 .tab-container {
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

body.admin-reports-page-v2 .tab-btn.active {
    color: #5a67d8 !important;
    border-bottom-color: var(--accent, #409eff) !important;
}

/* 补交记录页 */
body.makeup-page-v2 {
    background: #eef1f6 !important;
}

body.makeup-page-v2 .makeup-header,
body.makeup-page-v2 .filter-card,
body.makeup-page-v2 .table-card,
body.makeup-page-v2 .stat-card {
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

body.makeup-page-v2 .makeup-header::before {
    background: linear-gradient(90deg, var(--accent, #409eff), var(--accent-hover, #337ecc));
}

body.makeup-page-v2 .btn-search {
    background: linear-gradient(135deg, var(--accent, #409eff), var(--accent-hover, #337ecc));
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
}

body.makeup-page-v2 .btn-reset {
    padding: 10px 18px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
}

body.makeup-page-v2 .filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    width: 100%;
}

body.makeup-page-v2 .filter-title {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 14px;
    width: 100%;
}

body.makeup-page-v2 .filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

body.makeup-page-v2 .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

body.makeup-page-v2 .btn-delete {
    padding: 8px 16px;
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    cursor: pointer;
}

body.makeup-page-v2 .btn-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.makeup-page-v2 .btn-view-report {
    padding: 4px 12px;
    border: 1px solid var(--accent, #409eff);
    border-radius: 6px;
    background: #fff;
    color: var(--accent, #409eff);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

body.makeup-page-v2 .btn-view-report:hover {
    background: var(--accent, #409eff);
    color: #fff;
}

body.makeup-page-v2 .text-muted {
    color: var(--ink-subtle, #c0c4cc);
}

@media (max-width: 768px) {
    body.app-page-v2 .main-content {
        padding: 16px;
    }

    .ap-header {
        flex-direction: column;
    }

    .ap-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ap-toolbar .search-group,
    .ap-toolbar .filter-group {
        max-width: none;
    }

    .ap-toolbar-actions {
        margin-left: 0;
        width: 100%;
    }

    .ap-toolbar-actions .ap-btn-primary,
    .ap-toolbar-actions .ap-btn-ghost {
        flex: 1;
    }
}
