/* 日报统计页 */

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

.ms-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 页头 */
.ms-header {
    margin-bottom: 4px;
}

.ms-header-text h1,
.ms-header-text h2,
.ms-panel-head h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 6px;
}

.ms-header-text p {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.ms-hint {
    margin-top: 4px !important;
    font-size: 12px !important;
    color: var(--ink-subtle) !important;
}

/* 统计规则说明 */
.ms-rules-section {
    padding: 16px 24px 20px !important;
    border-bottom: 1px solid var(--border-light, #ebeef5);
    background: var(--surface-2, #fafbfc);
}

.ms-rules-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.65;
    color: var(--ink-muted, #606266);
}

.ms-rules-list li {
    position: relative;
    padding: 6px 0 6px 16px;
    border-bottom: 1px dashed var(--border-light, #ebeef5);
}

.ms-rules-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ms-rules-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent, #409eff);
    font-weight: 700;
}

.ms-rules-list strong {
    color: var(--ink, #303133);
    font-weight: 600;
}

/* 筛选栏 */
.ms-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    padding: 16px 20px;
}

.ms-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ms-filter-group label {
    font-size: 12px;
    color: var(--ink-muted);
    font-weight: 500;
}

.ms-filter-group select {
    min-width: 120px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
}

.ms-btn-refresh {
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

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

/* 统计概览 */
.ms-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.ms-stat-card {
    padding: 18px 20px;
    text-align: left;
}

.ms-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-bottom: 4px;
}

.ms-stat-label {
    font-size: 13px;
    color: var(--ink-muted);
}

.ms-stat-success .ms-stat-value { color: #67c23a; }
.ms-stat-warning .ms-stat-value { color: #e6a23c; }
.ms-stat-info .ms-stat-value { color: #409eff; }

/* 日历区块 */
.ms-calendar-section {
    padding: 0;
    overflow: hidden;
}

.ms-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.ms-makeup-meta {
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-muted);
}

.ms-makeup-meta strong {
    color: var(--accent);
    font-weight: 600;
}

.ms-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-2);
}

.ms-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-muted);
}

.ms-legend-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.ms-legend-submitted::before { background: #67c23a; }
.ms-legend-makeup::before { background: #e6a23c; }
.ms-legend-missing::before { background: #f56c6c; }
.ms-legend-weekend::before { background: #dcdfe6; }
.ms-legend-override::before { background: #b37feb; }

.ms-loading {
    text-align: center;
    padding: 48px 16px;
    color: var(--ink-subtle);
    font-size: 13px;
}

.workdays-calendar {
    padding: 16px 20px 20px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    min-width: 560px;
}

.calendar-header-day {
    text-align: center;
    font-weight: 500;
    padding: 8px 4px;
    background: var(--surface-2);
    border-radius: var(--radius);
    color: var(--ink-muted);
    font-size: 12px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    min-width: 560px;
}

.calendar-empty {
    min-height: 96px;
}

/* 日历格子 */
.workday-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 8px 6px;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    background: var(--surface);
}

.workday-item:hover {
    border-color: #c6e2ff;
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.12);
}

.workday-item.submitted {
    border-color: #c2e7b0;
    background: #f0f9eb;
}

.workday-item.makeup {
    border-color: #f5dab1;
    background: #fdf6ec;
}

.workday-item.missing {
    border-color: #fbc4c4;
    background: #fef0f0;
}

.workday-item.leave {
    border-color: #d3adf7;
    background: #f9f0ff;
}

.workday-item.weekend,
.workday-item.holiday {
    border-color: var(--border-light);
    background: var(--surface-2);
    opacity: 0.85;
}

.workday-item.workday-override {
    border-color: #d3adf7;
    box-shadow: inset 0 0 0 1px rgba(179, 127, 235, 0.25);
}

.workday-date {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.workday-weekday {
    font-size: 11px;
    color: var(--ink-subtle);
    margin: 2px 0 4px;
}

.workday-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    margin: 0 auto 4px;
    font-weight: 500;
}

.status-submitted { background: #e1f3d8; color: #67c23a; }
.status-makeup { background: #faecd8; color: #e6a23c; }
.status-missing { background: #fde2e2; color: #f56c6c; }
.status-leave { background: #efdbff; color: #9254de; }
.status-weekend,
.status-holiday { background: var(--border-light); color: var(--ink-subtle); }

.workday-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: auto;
}

.btn-small {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

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

.btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-create-small { border-color: #b3d8ff; color: #409eff; }
.btn-makeup-small { border-color: #f5dab1; color: #e6a23c; }
.btn-view-small { border-color: #c2e7b0; color: #67c23a; }
.btn-leave-small { border-color: #d3adf7; color: #9254de; }

.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--ink-subtle);
}

.empty-state h3 {
    margin: 8px 0 4px;
    font-size: 15px;
    color: var(--ink-muted);
}

.empty-state p {
    margin: 0;
    font-size: 13px;
}

/* 响应式 */
@media (max-width: 992px) {
    .ms-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ms-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ms-stat-value {
        font-size: 22px;
    }

    .ms-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .ms-legend {
        gap: 8px;
    }

    .workday-item {
        min-height: 80px;
        padding: 6px 4px;
    }

    .workday-date {
        font-size: 13px;
    }

    .btn-small {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .ms-overview {
        grid-template-columns: 1fr 1fr;
    }

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

    .ms-filter-group select {
        width: 100%;
    }

    .ms-btn-refresh {
        width: 100%;
    }
}

[data-theme="dark"] .workday-item.submitted { background: #1a3318; border-color: #3d6b2e; }
[data-theme="dark"] .workday-item.makeup { background: #2b2111; border-color: #6b4e1a; }
[data-theme="dark"] .workday-item.missing { background: #2b1d1d; border-color: #6b2e2e; }
[data-theme="dark"] .workday-item.leave { background: #2a1a33; border-color: #5c3d6b; }
