#alertModal {
    display: none;
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    width: 80%;
    max-width: 400px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
}

#closeAlert, #confirm, #cancel {
    margin-top: 20px;
    margin-left: 20px;
    padding: 12px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#confirm {
    background-color: #8B3A3A; /* 红色 */
}

#closeAlert {
    background-color: #458B74;
}

#closeAlert:hover,#confirm:hover, #cancel:hover {
    transform: translateY(-2px);
}

#alertModal {
    font-size: 16px;
    margin-top: 20px;
    color: #333;
}


.summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f7f9fc 0%, #eef3fa 100%);
    border: 1px solid #e6ebf2;
    border-radius: 8px;
    padding: 3px 15px;
    margin-bottom: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.summary-items {
    display: flex;
    gap: 48px;
}
.summary-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}

.income { color: #007979; }
.expense { color: #804040; }

.summary-link {
    font-size: 14px;
    font-weight: bold;
    color: #1890ff;
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 4px;
    transition: all .2s;
}
.summary-link:hover {
    background: #e6f4ff;
}

/* ====== 弹窗按比例缩放，高度跟随内容，超出上限才出现滚动条 ====== */
.modal {
    width: 60vw;
    min-width: 480px;
    max-width: 900px;
    /* 不再写死 height，让内容决定实际高度 */
    max-height: 98vh;   /* 内容超过这个高度时，modal-body 才会滚动 */
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 36px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ====== 九宫格：固定高度，内部按需滚动 ====== */
.grid-outer {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: #fafbfc;

    height: 24vh;
    min-height: 160px;
    max-height: 260px;

    overflow-y: auto;
}

.grid-wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.grid-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
    padding: 9px 2px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    background: #fff;
    user-select: none;
    transition: all .1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-item:hover {
    background: #ecf5ff;
    border-color: #B0E0E6;
    color: #409eff;
}

.grid-item.active {
    background: #B0E0E6;
    color: #333;
    box-shadow: 0 2px 6px rgba(64,158,255,0.35);
}

.img_popup {
    z-index: 10000;
    position: fixed;
    top: 10%;
    left: 35%;
    transform: translate(-10%, -10%);
    padding: 0px;
    display: none;
}

.image-wrapper {
    position: relative;
}

.close-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    transform: scale(3);
    cursor: pointer;
    color:red
}



/* 显示弹窗按钮 */
.open-button {
    margin: 40px;
    height: 40px;
    padding: 0 22px;
    border: 1px solid #409eff;
    border-radius: 4px;
    background: #409eff;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
}

.open-button:hover {
    background: #2688e8;
}

/* 弹窗遮罩 */
.statistics-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
}

/* 弹窗隐藏 */
.statistics-modal-mask.hidden {
    display: none;
}

/* 弹窗主体 */
.statistics-modal {
    width: 1000px;
    max-width: 100%;
    height: 720px;
    max-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* 弹窗顶部 */
.statistics-modal-header {
    flex-shrink: 0;
    display: flex;
    height: 58px;
    padding: 0 14px;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid #e5e5e5;
    background: #ffffff;
}

/* 统计概览：黑色加粗 */
.page-title {
    color: #000000;
    font-size: 20px;
    font-weight: bold;
}

/* 表格滚动区域 */
.table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #ffffff;
}

/* 数据表格 */
.statistics-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    table-layout: fixed;
}

.statistics-table th,
.statistics-table td {
    height: 52px;
    padding: 8px 30px;
    border-right: 1px solid #eeeeee;
    border-bottom: 1px solid #eeeeee;
    text-align: center;
    vertical-align: middle;
}

.statistics-table th:last-child,
.statistics-table td:last-child {
    border-right: none;
}

/* 表头 */
.statistics-table thead th {
    height: 54px;
    background: #f7f9fb;
    color: #222222;
    font-size: 15px;
    font-weight: bold;
}

/* 收入表头保持绿色 */
.statistics-table thead th.income-header {
    color: #007979;
}

/* 支出表头保持红色 */
.statistics-table thead th.expense-header {
    color: #804040;
}

/* 结余表头保持黑色 */
.statistics-table thead th.balance-header {
    color: #222222;
}

/* 左侧统计期间 */
.period-header,
.period-cell {
    width: 260px;
    text-align: left !important;
}

.period-cell {
    color: #222222;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

/* 括号及括号内内容普通显示 */
.normal-text {
    font-weight: normal;
}

.period-date {
    color: #666666;
    font-size: 13px;
}

/* 第1、2、5、6、9、10……行 */
.statistics-table tbody tr:nth-child(4n + 1),
.statistics-table tbody tr:nth-child(4n + 2) {
    background: #ffffff;
}

/* 第3、4、7、8、11、12……行 */
.statistics-table tbody tr:nth-child(4n + 3),
.statistics-table tbody tr:nth-child(4n + 4) {
    background: #f5f9ff;
}

/* 鼠标悬停时统一显示悬停颜色 */
.statistics-table tbody tr:hover {
    background: #eaf3ff;
}

/* 收入、支出数据 */
.amount-cell {
    color: #1677ff;
    font-size: 14px;
    font-weight: normal;
    white-space: nowrap;
}

.amount-0 {
    font-size: 14px;
    font-weight: normal;
    white-space: nowrap;
}

/* 普通蓝色超链接，不显示下划线 */
.data-link {
    color: #1677ff;
    font-weight: normal;
    text-decoration: none;
    cursor: pointer;
}

.data-link:hover {
    color: #0958d9;
    text-decoration: none;
}

.data-link:active {
    color: #003eb3;
}

/* 结余数据：普通黑色 */
.balance-cell {
    color: #000000;
    font-size: 14px;
    font-weight: normal;
    white-space: nowrap;
}

/* 小屏幕适配 */
@media screen and (max-width: 650px) {
    .open-button {
        margin: 20px;
    }

    .statistics-modal-mask {
        padding: 10px;
    }

    .statistics-modal {
        width: 100%;
        height: 92vh;
        max-height: none;
    }

    .page-title {
        font-size: 18px;
    }

    .statistics-table {
        min-width: 660px;
    }

    .statistics-table th,
    .statistics-table td {
        height: 46px;
        padding: 6px 10px;
    }

    .period-header,
    .period-cell {
        width: 220px;
    }

    .statistics-table thead th {
        font-size: 14px;
    }

    .period-cell,
    .amount-cell,
    .balance-cell {
        font-size: 13px;
    }

    .period-date {
        font-size: 12px;
    }
}

