* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
    font-size: 16px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 15px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 0;
}

header h1 {
    color: #2c3e50;
    font-size: 1.8em;
    margin-bottom: 8px;
    font-weight: 600;
}

/* 统计信息 - 移动端优化 */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-item {
    background: white;
    padding: 15px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s;
}

.summary-item:hover {
    transform: translateY(-2px);
}

.summary-item.income {
    border-left: 4px solid #27ae60;
}

.summary-item.expense {
    border-left: 4px solid #e74c3c;
}

.summary-item.balance {
    border-left: 4px solid #3498db;
}

.summary-item h3 {
    font-size: 0.9em;
    margin-bottom: 8px;
    color: #7f8c8d;
    font-weight: 500;
}

.summary-item span {
    font-size: 1.4em;
    font-weight: bold;
    display: block;
}

.summary-item.income span {
    color: #27ae60; /* 收入 - 绿色 */
}

.summary-item.expense span {
    color: #e74c3c; /* 支出 - 红色 */
}

.summary-item.balance span {
    color: #3498db; /* 余额 - 蓝色 */
}
/* 操作按钮 - 移动端优化 */
.actions {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;  /* ← 内边距，影响按钮大小 */
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em; /* ← 字体大小 */
    font-weight: 500;
    transition: all 0.3s;
    min-width: 20px; /* ← 最小宽度 */
    flex: 1;
    max-width: 100px;  /* ← 最大宽度 */

}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}

/* 模态框 - 移动端优化 */
.form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 20px 10px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.4em;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    height: 80px;
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 文件上传区域 - 移动端优化 */
.file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 10px 0;
    transition: all 0.3s;
    background: #fafafa;
}

.file-upload-area:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.file-upload-area.dragover {
    border-color: #3498db;
    background-color: #e3f2fd;
}

.upload-instructions {
    color: #7f8c8d;
    margin-bottom: 12px;
    font-size: 0.9em;
}

.upload-instructions p {
    margin-bottom: 5px;
}

.upload-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.3s;
}

.upload-button:hover {
    background: #2980b9;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.preview-item {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

.preview-image:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.remove-preview-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s;
}

.remove-preview-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 图片预览模态框 - 支持缩放 */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    touch-action: none;
    overflow: hidden;
    user-select: none;
}

.modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    cursor: grab;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.modal-content:active {
    cursor: grabbing;
}

.modal-content.zoomed {
    cursor: grab;
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #f1f1f1;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1002;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

.close:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

/* 缩放提示 */
.zoom-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 1002;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-hint.show {
    opacity: 1;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .modal-container {
        padding: 15px;
    }

    .close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 30px;
    }

    .modal-content {
        border-radius: 6px;
    }

    .zoom-hint {
        bottom: 15px;
        font-size: 13px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        padding: 10px;
    }

    .close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 25px;
    }

    .modal-content {
        border-radius: 4px;
    }

    .zoom-hint {
        bottom: 10px;
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-container {
        padding: 10px;
    }
}

/* 加载状态 */
.modal-content.loading {
    opacity: 0.5;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .close {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

    .close:hover {
        background: rgba(255,255,255,0.2);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .close {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

    .close:hover {
        background: rgba(255,255,255,0.2);
    }
}

/* 费用列表 - 移动端优化 */
.expenses-list {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.expenses-list h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.3em;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    margin: 2px;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.attachment-thumb:hover {
    border-color: #3498db;
    transform: scale(1.1);
}

/* 添加类型样式 */
.type-income {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.9em;
}

.type-expense {
    color: #e74c3c;
    font-weight: 600;
    font-size: 0.9em;
}

/* 移动端专属样式 */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* 移动端卡片视图 */
.mobile-expense-card {
    display: none;
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
}

.mobile-expense-card.income {
    border-left-color: #27ae60;
}

.mobile-expense-card.expense {
    border-left-color: #e74c3c;
}

.card-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.card-title {
    font-weight: 600;
    font-size: 1.1em;
    color: #2c3e50;
    flex: 1;
}

.card-amount {
    font-weight: bold;
    font-size: 1.1em;
}

.card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.9em;
    color: #666;
}

.card-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.card-detail-label {
    font-weight: 500;
    color: #7f8c8d;
}

.card-actions {
    margin-top: 12px;
    text-align: right;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        line-height: 1.6;
        color: #333;
        background-color: #f5f5f5;  /* ← 这里是PC端的灰色背景 */
        font-size: 16px;

    }

    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 15px;
        background-color: #ffffff;  /* 确保容器也是白色 */
    }
    header h1 {
        font-size: 1.5em;
    }

    .summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .summary-item {
        padding: 12px 6px;
    }

    .summary-item h3 {
        font-size: 0.8em;
    }

    .summary-item span {
        font-size: 1.2em;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        min-width: auto;
        max-width: none;
        padding: 14px;
        font-size: 1em;
    }

    .modal-content {
        padding: 15px;
        margin: 10px;
        max-height: 85vh;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        margin: 2px 0;
    }

    /* 移动端表格隐藏，显示卡片 */
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    table {
        display: none;
    }

    .mobile-expense-card {
        display: block;
    }

    .preview-image {
        width: 70px;
        height: 70px;
    }

    .file-upload-area {
        padding: 15px;
    }

    .upload-instructions {
        font-size: 0.85em;
    }

    .modal-content {
        width: 100%;
        max-width: none;
    }

    .close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }

    .modal-controls {
        bottom: 20px;
        flex-direction: column;
        gap: 10px;
    }

    .modal-controls button {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.3em;
    }

    .summary {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .summary-item {
        padding: 10px 5px;
    }

    .card-details {
        grid-template-columns: 1fr;
    }

    .preview-image {
        width: 60px;
        height: 60px;
    }

    .attachment-thumb {
        width: 35px;
        height: 35px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .form-modal {
        align-items: flex-start;
        padding: 10px;
    }

    .modal-content {
        max-height: 80vh;
    }
}
/* 20260318 */

/* 筛选区域样式 */
.filter-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-header h3 {
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
    margin: 0;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 500;
}

.filter-group input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.filter-group input[type="date"]:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.quick-filter-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.quick-filter-label {
    font-size: 0.95em;
    color: #7f8c8d;
    font-weight: 500;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    min-width: auto;
}

.btn-outline {
    background: white;
    border: 1px solid #3498db;
    color: #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: white;
}
/* 添加按钮激活状态样式 */
.btn-outline.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}
/* 移动端适配 */
@media (max-width: 768px) {
    .filter-section {
        padding: 15px;
    }

    .filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    .quick-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-filter-label {
        text-align: left;
    }

    .btn-small {
        width: 100%;
        text-align: center;
    }
}