* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 50%, #b3e5fc 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    background-attachment: fixed;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 30px;
}

.title {
    text-align: center;
    color: #00796b;
    margin-bottom: 30px;
    font-size: 2rem;
}

.month-selector {
    text-align: center;
    margin-bottom: 30px;
}

.month-selector label {
    font-size: 1.1rem;
    margin-right: 10px;
    color: #00695c;
}

.month-selector select {
    padding: 10px 20px;
    font-size: 1rem;
    border: 2px solid #b2dfdb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    color: #00796b;
}

/* 同步状态提示 */
#sync-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* 正在同步的状态：黄色 */
.sync-loading {
    background-color: #fef3c7;
    color: #92400e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 同步成功：绿色，且自动变透明 */
.sync-success {
    background-color: #dcfce7;
    color: #166534;
    opacity: 0.8;
}

/* 平时隐藏 */
.sync-idle {
    opacity: 0;
    transform: translateY(-10px);
}

/* 同步失败：红色 */
.sync-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* 顶部统计区域 - 第一行：预算和分类统计 */
.top-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* 顶部统计区域 - 第二行：进度条单独成行 */
.progress-row {
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.stat-icon {
    font-size: 1.3rem;
}

.stat-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #616161;
}

/* 左侧：预算卡片 */
.stat-card.budget-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #a5d6a7;
}

.budget-info-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.budget-item {
    text-align: center;
    flex: 1;
}

.budget-label {
    display: block;
    font-size: 0.85rem;
    color: #66bb6a;
    margin-bottom: 5px;
}

.budget-card input {
    width: 100%;
    padding: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid #81c784;
    border-radius: 8px;
    background: white;
    color: #2e7d32;
}

.budget-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2e7d32;
}

.budget-value.spent {
    color: #ef5350;
}

.budget-divider {
    width: 2px;
    height: 50px;
    background: #a5d6a7;
    margin: 0 10px;
}

.budget-remaining-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 2px dashed #a5d6a7;
}

.remaining-label {
    font-size: 0.9rem;
    color: #66bb6a;
    font-weight: 500;
}

.remaining-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2e7d32;
}

/* 中间：进度卡片 */
.stat-card.progress-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #90caf9;
}

.progress-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.progress-label {
    font-size: 0.9rem;
    color: #42a5f5;
    font-weight: 500;
}

.progress-percent {
    font-size: 2rem;
    font-weight: bold;
    color: #1976d2;
}

.progress-card .progress-bar-container {
    background: rgba(255,255,255,0.6);
    height: 25px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-card .progress-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    transition: width 0.5s ease, background-color 0.5s ease;
    border-radius: 12px;
}

.progress-inner-text {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.progress-tip {
    text-align: center;
    font-size: 0.85rem;
    color: #64b5f6;
    font-weight: 500;
}

/* 右侧：分类卡片 */
.stat-card.category-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 193, 7, 0.3);
}

.category-rank {
    margin-bottom: 15px;
}

.category-rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    transition: background-color 0.2s;
}

.category-rank-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

.category-rank-item:last-child {
    margin-bottom: 0;
}

.category-rank-icon {
    font-size: 1.2rem;
    width: 24px;
}

.category-rank-name {
    flex: 1;
    margin-left: 8px;
    font-weight: 600;
    color: #5d4037;
    font-size: 0.9rem;
}

.category-rank-percent {
    font-weight: bold;
    color: #ef6c00;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
}

.category-rank-bar-container {
    flex: 1;
    height: 8px;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-left: 12px;
    margin-right: 8px;
}

.category-rank-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 不同分类的颜色 */
.category-rank-bar.food {
    background: linear-gradient(90deg, #ff5722, #ff9800);
}

.category-rank-bar.transport {
    background: linear-gradient(90deg, #2196f3, #64b5f6);
}

.category-rank-bar.shopping {
    background: linear-gradient(90deg, #e91e63, #f48fb1);
}

.category-rank-bar.entertainment {
    background: linear-gradient(90deg, #9c27b0, #ce93d8);
}

.category-rank-bar.other {
    background: linear-gradient(90deg, #757575, #a1a1a1);
}

.daily-budget-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 2px dashed #ffcc80;
}

.daily-label {
    font-size: 0.9rem;
    color: #ef6c00;
    font-weight: 500;
}

.daily-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e65100;
}

/* 旧的预算信息样式（保留部分） */
.budget-info {
    display: none;
}

.budget-card {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #80cbc4;
}

.budget-card h3 {
    color: #00695c;
    margin-bottom: 10px;
    font-size: 1rem;
}

.budget-card input,
.budget-card span {
    font-size: 1.8rem;
    font-weight: bold;
    color: #004d40;
    background: transparent;
    border: none;
    text-align: center;
    width: 100%;
}

.expense-form {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.expense-form h2 {
    color: #558b2f;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    color: #33691e;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid #aed581;
    border-radius: 8px;
    font-size: 1rem;
}

#addExpense {
    background: linear-gradient(135deg, #81c784 0%, #4caf50 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

#addExpense:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.expense-table-container {
    margin-bottom: 30px;
}

.expense-table-container h2 {
    color: #00796b;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* 卡片列表容器 */
.records-container {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 8px;
}

/* 记录卡片 */
.record-card {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.record-card:last-child {
    border-bottom: none;
}

.record-card:hover {
    background-color: rgba(241, 248, 233, 0.5);
}

/* 日期部分 */
.record-date {
    width: 50px;
    text-align: center;
    margin-right: 15px;
}

.record-date-empty {
    width: 50px;
    margin-right: 15px;
}

.date-day {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.date-month {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

/* 内容部分 */
.record-content {
    flex: 1;
    min-width: 0;
}

.record-desc {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-category {
    font-size: 0.8rem;
    color: #999;
}

/* 金额部分 */
.record-amount {
    font-weight: 600;
    color: #2ecc71;
    font-size: 1rem;
    margin-right: 12px;
    white-space: nowrap;
}

.record-amount .yen-symbol {
    font-size: 0.8rem;
    color: #27ae60;
    margin-right: 1px;
}

.record-amount.over-budget {
    color: #e74c3c;
}

.record-amount.over-budget .yen-symbol {
    color: #c0392b;
}

/* 操作部分 */
.record-action {
    margin-left: auto;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 1rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.delete-btn:hover,
.delete-btn:active {
    background: rgba(0, 0, 0, 0.05);
    color: #999;
}

/* 当日小计卡片 */
.daily-total-card {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.total-divider {
    height: 1px;
    background: #e0e0e0;
    margin-bottom: 8px;
}

.total-content {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.total-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.total-amount {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2ecc71;
}

.total-amount.over-budget {
    color: #e74c3c;
}

.expense-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.expense-table th,
.expense-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.expense-table th {
    background: linear-gradient(135deg, #b2ebf2 0%, #80deea 100%);
    color: #006064;
    font-weight: 600;
}

.expense-table tbody tr:hover {
    background: #f1f8e9;
}

.expense-table td button {
    background: #ef5350;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.empty-cell {
    color: #9e9e9e;
    text-align: center;
}

.over-budget {
    color: #d32f2f !important;
    font-weight: bold;
}

/* 空状态提示样式 */
.empty-table {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px dashed rgba(0, 121, 107, 0.2);
    margin: 10px;
}

.empty-icon {
    font-size: 4.5rem;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-text {
    font-size: 1.4rem;
    color: #424242;
    margin-bottom: 10px;
    font-weight: 500;
}

.empty-hint {
    font-size: 1rem;
    color: #757575;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.empty-hint span {
    color: #00796b;
    font-weight: 500;
}

/* 表格行样式 */
.expense-row {
    transition: background-color 0.2s;
}

.expense-row:hover {
    background-color: #f1f8e9 !important;
}

/* 日期单元格样式 */
.date-cell {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    vertical-align: top;
    padding: 10px !important;
    position: relative;
}

.date-main {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2e7d32;
}

.date-sub {
    font-size: 0.85rem;
    color: #66bb6a;
}

.over-budget-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ef5350;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 单元格样式 */
.desc-cell {
    font-weight: 500;
}

.amount-cell {
    font-weight: 600;
    color: #333;
}

.category-cell {
    color: #616161;
}

.action-cell {
    text-align: center;
}

/* 桌面端删除按钮 - 保持透明背景 */
.delete-btn {
    background: transparent;
    color: #ccc;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.delete-btn:hover,
.delete-btn:active {
    background: rgba(0, 0, 0, 0.05);
    color: #999;
}

/* 当日小计行 */
.daily-total-row {
    background: rgba(245, 245, 245, 0.8);
    border-top: 1px solid #e8e8e8;
}

/* Emoji 与文字间距 */
.amount-cell span:first-child,
.category-cell span:first-child {
    margin-right: 4px;
}

.total-label {
    font-weight: bold;
    color: #616161;
    text-align: right;
}

.total-amount {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2e7d32;
}

/* 进度条颜色类 */
.progress-bar.progress-green {
    background: linear-gradient(90deg, #81c784, #4caf50);
}

.progress-bar.progress-yellow {
    background: linear-gradient(90deg, #ffb74d, #ff9800);
}

.progress-bar.progress-red {
    background: linear-gradient(90deg, #ef5350, #d32f2f);
}

.progress-text {
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #ffcc80;
}

.summary-card.remaining {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #a5d6a7;
}

.summary-card h3 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 1rem;
}

.summary-card.remaining h3 {
    color: #1b5e20;
}

.summary-card span {
    font-size: 1.8rem;
    font-weight: bold;
    color: #bf360c;
}

.summary-card.remaining span {
    color: #2e7d32;
}

.export-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.export-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.csv-btn {
    background: linear-gradient(135deg, #64b5f6, #2196f3);
    color: white;
}

.print-btn {
    background: linear-gradient(135deg, #90caf9, #42a5f5);
    color: white;
}

.clear-btn {
    background: linear-gradient(135deg, #ef9a9a, #ef5350);
    color: white;
}

/* 表单验证样式 */
.form-group input.error,
.form-group select.error {
    border-color: #ef5350 !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 表格行双击样式 */
.expense-table tbody tr.empty-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.expense-table tbody tr.empty-row:hover {
    background-color: #f0f9ff;
}

/* 分类统计样式 */
.category-stats {
    margin-top: 30px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 12px;
}

.category-stats h3 {
    color: #00796b;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-item {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-item.top-spend {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 2px solid #ff9800;
}

.category-amount {
    font-weight: bold;
    color: #d32f2f;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
    .export-buttons {
        flex-direction: column;
    }
    .export-btn {
        width: 100%;
    }
}

@media print {
    body {
        background: white;
        padding: 0;
    }
    .expense-form,
    .export-buttons,
    .month-selector,
    .category-stats {
        display: none;
    }
    .container {
        box-shadow: none;
        max-width: 100%;
    }
}

/* ==================== 移动端优化 ==================== */

/* 全局移动端基础样式 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px 15px;
        border-radius: 16px;
    }
    
    .title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
}

/* 小屏幕（手机）优化 */
@media (max-width: 480px) {
    /* 容器和标题 */
    .container {
        padding: 15px 12px;
    }
    
    .title {
        font-size: 1.4rem;
    }
    
    /* 月份选择器优化 */
    .month-selector {
        margin-bottom: 20px;
    }
    
    .month-selector label {
        font-size: 1rem;
        display: block;
        margin-bottom: 8px;
    }
    
    .month-selector select {
        width: 100%;
        padding: 14px 20px;
        font-size: 1.1rem;
        border-radius: 12px;
        min-height: 48px;
    }
    
    /* 顶部统计卡片 - 手机上堆叠显示 */
    .top-stats-row {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .progress-row {
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    /* 预算输入框优化 */
    .budget-card input {
        font-size: 1.5rem;
        padding: 12px;
        min-height: 48px;
    }
    
    .budget-value,
    .remaining-value,
    .daily-value {
        font-size: 1.3rem;
    }
    
    /* 进度显示优化 */
    .progress-percent {
        font-size: 1.6rem;
    }
    
    /* 分类排名优化 */
    .category-rank-name {
        font-size: 0.85rem;
    }
    
    .category-rank-percent {
        font-size: 0.85rem;
    }
    
    /* ==================== 响应式表单优化 ==================== */
    .expense-form {
        padding: 18px;
        margin-bottom: 20px;
    }
    
    .expense-form h2 {
        font-size: 1.15rem;
        margin-bottom: 16px;
    }
    
    /* 表单改为垂直排列 */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-group {
        min-height: 48px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    /* 输入框点击区域增大 */
    .form-group input,
    .form-group select {
        padding: 14px 16px;
        font-size: 1.05rem;
        min-height: 48px;
        border-radius: 10px;
    }
    
    /* 按钮热区增大 */
    #addExpense {
        padding: 16px 32px;
        font-size: 1.05rem;
        min-height: 48px;
        border-radius: 12px;
    }
    
    /* ==================== 表格优化 ==================== */
    .expense-table-container {
        margin-bottom: 20px;
        padding: 0 10px;
    }
    
    .expense-table-container h2 {
        font-size: 1.15rem;
        margin-bottom: 12px;
        padding: 0 10px;
    }
    
    /* 卡片列表容器 */
    .records-container {
        margin: 0 10px;
    }
    
    /* 记录卡片优化 */
    .record-card {
        padding: 10px 8px;
    }
    
    /* 日期部分优化 */
    .record-date {
        width: 45px;
        margin-right: 12px;
    }
    
    .record-date-empty {
        width: 45px;
        margin-right: 12px;
    }
    
    .date-day {
        font-size: 1.2rem;
    }
    
    .date-month {
        font-size: 0.65rem;
    }
    
    /* 内容部分优化 */
    .record-desc {
        font-size: 0.85rem;
    }
    
    .record-category {
        font-size: 0.75rem;
    }
    
    /* 金额部分优化 */
    .record-amount {
        font-size: 0.9rem;
        margin-right: 10px;
    }
    
    .record-amount .yen-symbol {
        font-size: 0.7rem;
    }
    
    /* 删除按钮优化 */
    .delete-btn {
        padding: 4px;
        font-size: 0.9rem;
    }
    
    /* 当日小计优化 */
    .daily-total-card {
        padding: 6px 8px;
    }
    
    .total-label {
        font-size: 0.8rem;
    }
    
    .total-amount {
        font-size: 0.85rem;
        font-weight: 600;
        color: #555;
    }
    
    /* 空状态优化 */
    .empty-table {
        padding: 40px 15px;
    }
    
    .empty-icon {
        font-size: 3.5rem;
        margin-bottom: 15px;
    }
    
    .empty-text {
        font-size: 1.2rem;
    }
    
    .empty-hint {
        font-size: 0.9rem;
    }
    
    /* ==================== 导出按钮优化 ==================== */
    .export-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .export-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
        min-height: 48px;
        border-radius: 12px;
    }
    
    /* 分类统计详情优化 */
    .category-stats {
        margin-top: 20px;
        padding: 16px;
    }
    
    .category-stats h3 {
        font-size: 1.1rem;
    }
    
    .category-list {
        flex-direction: column;
    }
    
    /* ==================== 点击优化 ==================== */
    /* 所有可点击元素添加 touch 反馈 */
    .stat-card,
    .expense-row,
    .category-rank-item {
        -webkit-tap-highlight-color: transparent;
    }
    
    .stat-card:active,
    .category-rank-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* 按钮 active 状态 */
    button:active {
        transform: scale(0.96);
        transition: transform 0.1s ease;
    }
    
    /* ==================== 虚拟键盘适配 ==================== */
    /* 确保表单元素在键盘弹出时可见 */
    body {
        /* 防止页面在键盘弹出时整体上移太多 */
        padding-bottom: env(safe-area-inset-bottom, 10px);
    }
    
    /* 表单区域增加底部内边距 */
    .expense-form {
        padding-bottom: calc(env(safe-area-inset-bottom, 10px) + 18px);
    }
    
    /* 防止输入框被遮挡 */
    .form-group input,
    .form-group select {
        position: relative;
        z-index: 10;
    }
    
    /* 滚动时自动调整到输入框位置 */
    html {
        scroll-padding-top: 100px;
        scroll-behavior: smooth;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .category-rank-item {
        padding: 8px 10px;
    }
    
    .category-rank-bar-container {
        display: none;
    }
    
    .expense-table th,
    .expense-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
}

/* ==================== 数据管理按钮样式 ==================== */
.data-management-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.data-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.data-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.data-btn:active {
    transform: scale(0.98);
}

.backup-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.import-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    cursor: pointer;
}

.clear-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

/* ==================== 深色模式支持 ==================== */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
        color: #e0e0e0;
    }
    
    .container {
        background: rgba(30, 30, 46, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .title {
        color: #a5d6a7;
    }
    
    .month-selector label {
        color: #81c784;
    }
    
    .month-selector select {
        background: rgba(50, 50, 70, 0.8);
        border: 2px solid #4caf50;
        color: #e0e0e0;
    }
    
    /* 统计卡片深色模式 */
    .stat-card {
        background: rgba(40, 40, 60, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .stat-title {
        color: #9e9e9e;
    }
    
    .stat-card.budget-card {
        border-color: rgba(76, 175, 80, 0.4);
    }
    
    .budget-card input {
        background: rgba(50, 50, 70, 0.8);
        border: 2px solid #4caf50;
        color: #81c784;
    }
    
    .budget-label {
        color: #66bb6a;
    }
    
    .budget-value {
        color: #81c784;
    }
    
    .budget-value.spent {
        color: #ef5350;
    }
    
    .budget-divider {
        background: rgba(76, 175, 80, 0.4);
    }
    
    .remaining-label {
        color: #66bb6a;
    }
    
    .remaining-value {
        color: #81c784;
    }
    
    .stat-card.progress-card {
        border-color: rgba(33, 150, 243, 0.4);
    }
    
    .progress-label {
        color: #64b5f6;
    }
    
    .progress-percent {
        color: #90caf9;
    }
    
    .progress-card .progress-bar-container {
        background: rgba(50, 50, 70, 0.5);
    }
    
    .progress-tip {
        color: #64b5f6;
    }
    
    .stat-card.category-card {
        border-color: rgba(255, 193, 7, 0.4);
    }
    
    .category-rank-item {
        background: rgba(50, 50, 70, 0.6);
        border: 1px solid rgba(255, 193, 7, 0.2);
    }
    
    .category-rank-name {
        color: #ffb74d;
    }
    
    .category-rank-percent {
        color: #ffb74d;
    }
    
    .category-rank-bar-container {
        background: rgba(255, 193, 7, 0.15);
    }
    
    .daily-label {
        color: #ffb74d;
    }
    
    .daily-value {
        color: #ffb74d;
    }
    
    /* 表单深色模式 */
    .expense-form {
        background: rgba(40, 40, 60, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .expense-form h2 {
        color: #81c784;
    }
    
    .form-group label {
        color: #9e9e9e;
    }
    
    .form-group input,
    .form-group select {
        background: rgba(50, 50, 70, 0.8);
        border: 2px solid #4caf50;
        color: #e0e0e0;
    }
    
    .form-group input::placeholder {
        color: #616161;
    }
    
    #addExpense {
        background: linear-gradient(135deg, #4CAF50, #45a049);
        color: white;
    }
    
    /* 表格深色模式 */
    .expense-table-container h2 {
        color: #81c784;
    }
    
    .expense-table-wrapper {
        background: rgba(40, 40, 60, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .expense-table th {
        background: linear-gradient(135deg, #388e3c, #43a047);
        color: #e8f5e9;
    }
    
    .expense-table tbody tr:hover {
        background: rgba(76, 175, 80, 0.1);
    }
    
    .date-cell {
        background: linear-gradient(135deg, rgba(46, 125, 50, 0.3), rgba(67, 160, 71, 0.2));
    }
    
    .date-main {
        color: #81c784;
    }
    
    .date-sub {
        color: #66bb6a;
    }
    
    .desc-cell {
        color: #e0e0e0;
    }
    
    .amount-cell {
        color: #e0e0e0;
    }
    
    .category-cell {
        color: #9e9e9e;
    }
    
    .over-budget {
        color: #ef5350 !important;
    }
    
    .delete-btn {
        background: #ef5350;
    }
    
    .delete-btn:hover {
        background: #d32f2f;
    }
    
    /* 空表格提示深色模式 */
    .empty-table {
        background: rgba(50, 50, 70, 0.6);
        border: 2px dashed rgba(76, 175, 80, 0.3);
    }
    
    .empty-text {
        color: #bdbdbd;
    }
    
    .empty-hint {
        color: #757575;
    }
    
    .empty-hint span {
        color: #81c784;
    }
    
    /* 每日小计深色模式 */
    .daily-total-row {
        background: rgba(50, 50, 70, 0.5);
        border-top: 2px solid rgba(100, 100, 100, 0.3);
    }
    
    .total-label {
        color: #bdbdbd;
    }
    
    .total-amount {
        color: #81c784;
    }
    
    /* 分类统计详情深色模式 */
    .category-stats {
        background: rgba(40, 40, 60, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .category-stats h3 {
        color: #81c784;
    }
    
    .category-item {
        background: rgba(50, 50, 70, 0.6);
    }
    
    .category-item.top-spend {
        background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 193, 7, 0.2));
        border: 2px solid rgba(255, 152, 0, 0.4);
    }
    
    .category-amount {
        color: #81c784;
    }
    
    /* 导出按钮深色模式 */
    .csv-btn {
        background: linear-gradient(135deg, #64b5f6, #2196f3);
    }
    
    .print-btn {
        background: linear-gradient(135deg, #90caf9, #2196f3);
    }
    
    /* 主题色元标签更新 - 深色模式用深色 */
    html {
        transition: background-color 0.3s ease;
    }
}