@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-pink: #ff9eb5;
    --soft-pink: #ffc1e0;
    --light-pink: #ffe8f5;
    --mint-green: #b8f2dc;
    --lavender: #d4b5f7;
    --peach: #ffb5a0;
    --rose: #ff7b9a;
    --cream: #fef9f3;
    --white: #ffffff;
    --light-gray: #f8f9fc;
    --text-dark: #2d3748;
    --text-light: #718096;
    --shadow-soft: 0 4px 20px rgba(255, 158, 181, 0.2);
    --shadow-medium: 0 8px 30px rgba(255, 158, 181, 0.3);
    --shadow-strong: 0 15px 40px rgba(255, 158, 181, 0.4);
    --border-color: #f0f0f0; /* New variable for borders */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #ffe8f5 0%, #b8f2dc 50%, #d4b5f7 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* 浮动装饰元素 */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-heart, .floating-star, .floating-flower, .floating-sparkle {
    position: absolute;
    font-size: 20px;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-heart {
    top: 10%;
    left: 80%;
    animation-delay: 0s;
}

.floating-star {
    top: 60%;
    left: 5%;
    animation-delay: 2s;
}

.floating-flower {
    top: 30%;
    right: 10%;
    animation-delay: 4s;
}

.floating-sparkle {
    top: 80%;
    left: 70%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    animation: slideUp 0.8s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header样式 */
.header {
    background: linear-gradient(135deg, var(--primary-pink), var(--rose));
    color: white;
    padding: 50px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex; /* 使用 flex 布局 */
    flex-direction: column; /* 垂直排列 */
    align-items: center; /* 水平居中 */
    justify-content: center; /* 垂直居中 */
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 20px,
        rgba(255,255,255,0.1) 20px,
        rgba(255,255,255,0.1) 40px
    );
    animation: backgroundSlide 25s linear infinite;
}

@keyframes backgroundSlide {
    0% { transform: translateX(-100px) translateY(-100px); }
    100% { transform: translateX(100px) translateY(100px); }
}

.header-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header h1 {
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
    font-weight: 400;
    margin-bottom: 20px;
}

/* 用户控制区域样式 (右上角) */
.user-controls {
    position: absolute; /* 绝对定位 */
    top: 20px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 3; /* 确保在最上层 */
}

.user-info-text {
    font-size: 1.1em;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    color: white;
}

/* 统计卡片 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    padding: 40px;
    background: var(--light-gray);
}

.stat-card {
    padding: 30px 25px;
    border-radius: 25px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s ease;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-strong);
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card.pink {
    background: linear-gradient(135deg, var(--soft-pink), var(--light-pink));
    border-color: var(--primary-pink);
}

.stat-card.mint {
    background: linear-gradient(135deg, var(--mint-green), #e0f7f0);
}

.stat-card.lavender {
    background: linear-gradient(135deg, var(--lavender), #f0e8ff);
}

.stat-card.peach {
    background: linear-gradient(135deg, var(--peach), #ffe8e0);
}

.stat-card.rose {
    background: linear-gradient(135deg, var(--rose), var(--soft-pink));
}

.stat-card.rose .stat-value {
    color: var(--rose);
}

.stat-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
    display: block;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.stat-card h3 {
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--text-dark);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

/* 报表仪表盘区域样式 */
.report-dashboard-section {
    background: var(--white);
    padding: 45px 40px;
    border-top: 1px solid var(--border-color);
}

.report-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.chart-tab-btn {
    padding: 12px 25px;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    color: var(--text-dark);
    width: fit-content;
    display: block;
    margin: 0 auto;
}

.chart-tab-btn.active {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-pink);
    background: var(--light-pink);
    color: var(--primary-pink);
}

.chart-container {
    display: none; /* 默认隐藏 */
    animation: fadeIn 0.5s ease-out;
    width: 100%;
}

.chart-container.active {
    display: block; /* 激活时显示 */
}

/* ECharts 容器的默认高度 */
#yearlyChart {
    width: 100%;
    height: 400px; /* 默认高度 */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chart-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.month-display {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 150px;
    text-align: center;
}

/* 表单样式 */
.form-section {
    background: var(--white);
    padding: 45px 40px;
    position: relative;
    border-top: 1px solid var(--border-color);
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.form-header h2 {
    color: var(--text-dark);
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 10px;
}

.form-decoration {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.sparkle {
    font-size: 1.5em;
    animation: sparkle 1.5s ease-in-out infinite;
}

.sparkle:nth-child(2) {
    animation-delay: 0.5s;
}

.sparkle:nth-child(3) {
    animation-delay: 1s;
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1em;
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 18px 55px 18px 20px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--cream);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-pink);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(255, 158, 181, 0.15);
    transform: translateY(-2px);
}

.input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3em;
    pointer-events: none;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-width: 140px;
    justify-content: center;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.btn:active {
    transform: translateY(-1px);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-pink), var(--rose));
    color: white;
    box-shadow: var(--shadow-soft);
}

.secondary-btn {
    background: linear-gradient(135deg, var(--mint-green), #a8e6d3);
    color: var(--text-dark);
}

.tertiary-btn {
    background: linear-gradient(135deg, var(--lavender), #c8a8f0);
    color: var(--text-dark);
}

.btn-danger {
    background: linear-gradient(135deg, #ff8a80, #ff5722);
    color: white;
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
    min-width: 100px;
}

.btn-icon {
    position: relative;
    z-index: 1;
}

.btn-text {
    position: relative;
    z-index: 1;
}

/* 记录列表样式 */
.records-section {
    padding: 45px 40px;
    background: var(--light-gray);
    border-top: 1px solid var(--border-color);
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    color: var(--text-dark);
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 15px;
}

.header-decoration {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.flower {
    font-size: 1.5em;
    animation: sway 2s ease-in-out infinite;
}

.flower:nth-child(2) {
    animation-delay: 0.5s;
}

.flower:nth-child(3) {
    animation-delay: 1s;
}

@keyframes sway {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

.table-container {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 2px solid rgba(255, 158, 181, 0.1);
}

.cute-table {
    width: 100%;
    border-collapse: collapse;
}

.cute-table th {
    background: linear-gradient(135deg, var(--primary-pink), var(--rose));
    color: white;
    padding: 20px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    position: relative;
}

.cute-table td {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 2px solid #f7fafc;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cute-table tr:nth-child(even) {
    background: linear-gradient(135deg, rgba(255, 158, 181, 0.03), rgba(184, 242, 220, 0.03));
}

.cute-table tr:hover {
    background: linear-gradient(135deg, rgba(255, 158, 181, 0.1), rgba(184, 242, 220, 0.1));
    transform: scale(1.01);
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 收入和支出颜色样式 */
.income { color: var(--mint-green); font-weight: 600; }
.expense { color: var(--rose); font-weight: 600; }


/* 加载和消息样式 */
.cute-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 158, 181, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cute-loading.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.spinner-heart {
    font-size: 3em;
    animation: heartbeat 1s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

.loading-content p {
    font-size: 1.2em;
    font-weight: 600;
}

.cute-message {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 20px 30px;
    border-radius: 20px;
    color: white;
    font-size: 1em;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none; /* 默认隐藏 */
    opacity: 0;
    transition: all 0.3s ease;
}

.cute-message.show {
    display: block;
    opacity: 1;
}

.cute-message.success {
    background: linear-gradient(135deg, #a8e6cf, #dcedc8);
    color: #388e3c;
}

.cute-message.error {
    background: linear-gradient(135deg, #ffccbc, #ffab91);
    color: #d32f2f;
}

/* Login Page Specific Styles */
.login-body {
    background: linear-gradient(135deg, #fce4ec 0%, #e0f7fa 50%, #f3e5f5 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    max-width: 450px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.2);
    padding: 50px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: fadeInScale 0.7s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-card {
    position: relative;
    z-index: 1;
}

.login-header h2 {
    font-size: 2.5em;
    color: var(--primary-pink);
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 1px 1px 5px rgba(255, 105, 180, 0.1);
}

.login-header p {
    color: var(--text-light);
    font-size: 1.1em;
    margin-bottom: 40px;
}

/* Enhancements for existing elements on login page */
.login-container .cute-form .form-group label {
    font-size: 1.05em;
    color: var(--text-dark);
    text-align: left;
    width: 100%;
    margin-left: 5px;
}

.login-container .cute-form .input-wrapper input {
    border-color: #ffb5c8;
    background: #fffafa;
}

.login-container .cute-form .input-wrapper input:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 4px rgba(255, 105, 180, 0.2);
}

.password-toggle {
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.password-toggle:hover {
    transform: scale(1.1);
}

.login-container .btn {
    width: 100%;
    padding: 18px 30px;
    font-size: 18px;
    margin-top: 20px;
}

/* Message Box Adjustments */
.cute-message {
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    top: auto; /* Override default top position */
    width: fit-content;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Loading Spinner for Login Button */
.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}


/* --- iPhone 14 (Portrait) Specific Optimizations --- */
@media only screen and (max-width: 390px) {
    body {
        padding: 15px;
    }

    .container {
        border-radius: 20px;
        box-shadow: var(--shadow-medium);
        padding: 0;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2.2em;
        margin-bottom: 10px;
    }

    .header p {
        font-size: 1em;
    }

    .user-controls { /* 移动端调整 */
        position: static;
        margin-top: 15px;
        justify-content: center;
    }

    .user-info-text {
        font-size: 1em;
        padding: 6px 12px;
    }

    .stats-section {
        grid-template-columns: 1fr; /* Stack stat cards */
        gap: 15px;
        padding: 20px;
    }

    .stat-card {
        padding: 15px 10px; /* 减小内边距 */
        border-radius: 15px;
    }

    .stat-icon {
        font-size: 1.8em; /* 适当减小图标大小 */
        margin-bottom: 8px; /* 调整间距 */
    }

    .stat-card h3 {
        font-size: 0.85em; /* 减小标题字体大小 */
        margin-bottom: 6px; /* 调整间距 */
    }

    .stat-value {
        font-size: 1.6em; /* 减小数值字体大小 */
        word-break: break-all; /* 允许在单词内部断行 */
    }

    .report-dashboard-section { /* 移动端图表调整 */
        padding: 30px 20px;
    }

    /* ECharts 容器在小屏幕的高度 */
    #yearlyChart {
        height: 280px; /* 调整为更适合小屏幕的高度 */
    }

    .report-controls {
        flex-direction: column; /* 即使只有一个按钮，也保持弹性布局，但会占据100%宽度 */
        gap: 10px;
    }

    .chart-tab-btn {
        width: 100%;
        text-align: center;
    }

    .chart-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .month-display {
        font-size: 1.2em;
    }

    .form-section {
        padding: 30px 20px;
    }

    .form-header h2 {
        font-size: 1.8em;
    }

    .form-grid {
        grid-template-columns: 1fr; /* Stack form groups */
        gap: 20px;
        margin-bottom: 30px;
    }

    .form-group label {
        font-size: 1em;
    }

    .input-wrapper input {
        padding: 15px 45px 15px 15px;
        font-size: 15px;
        border-radius: 12px;
    }

    .input-icon {
        right: 15px;
        font-size: 1.2em;
    }

    .form-actions {
        flex-direction: column; /* Stack buttons */
        gap: 15px;
    }

    .btn {
        padding: 14px 25px;
        font-size: 15px;
        border-radius: 20px;
        min-width: unset; /* Remove min-width constraint */
    }

    .records-section {
        padding: 30px 20px;
    }

    .section-header h2 {
        font-size: 1.8em;
    }

    /* === 响应式表格优化 === */
    .table-container {
        overflow-x: auto; /* 确保表格容器可以横向滚动 */
        border: none;
        box-shadow: none;
        background: transparent; /* 背景透明，让行卡片背景生效 */
    }

    .cute-table {
        width: 100%; /* 确保在小屏幕下表格宽度为100% */
        border-collapse: collapse;
        display: block; /* 将表格设置为块级元素 */
        min-width: 320px; /* 最小宽度，防止内容过窄 */
    }

    .cute-table thead {
        display: none; /* 隐藏表头 */
    }

    .cute-table tbody {
        display: block; /* tbody也设置为块级元素 */
        width: 100%;
    }

    .cute-table tbody tr {
        display: flex; /* 每行显示为flex容器 */
        flex-direction: column; /* 垂直堆叠内容 */
        margin-bottom: 20px; /* 增加行间距 */
        background: var(--white);
        border-radius: 15px;
        box-shadow: var(--shadow-soft);
        padding: 15px;
        transition: all 0.3s ease;
        border: 2px solid transparent;
        width: 100%; /* 确保每行卡片宽度为100% */
    }

    .cute-table tbody tr:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-medium);
    }
    .cute-table tbody tr:nth-child(even) {
        background: var(--white); /* 在卡片模式下，偶数行背景与奇数行一致 */
    }

    .cute-table td {
        /* 使用 inline-block + width 方式来布局标签和值 */
        padding: 10px 8px;
        border-bottom: 1px dashed var(--light-gray);
        font-size: 0.95em;
        width: 100%;
        text-align: right; /* 值右对齐 */
        white-space: normal; /* 允许文本换行 */
        word-break: break-word; /* 单词内部断行 */
        display: block; /* 让 td 作为块级元素，以便伪元素和文本内容在其中正常流动 */
        overflow: hidden; /* 防止内容溢出 */
    }
    /* 最后一行移除底部边框 */
    .cute-table td:last-child {
        border-bottom: none;
    }

    /* 显示 data-label 作为标题 */
    .cute-table td::before {
        content: attr(data-label); /* 使用 data-label 作为内容 */
        font-weight: 600;
        color: var(--text-light);
        text-align: left; /* 标签左对齐 */
        display: inline-block; /* 使其成为行内块元素，可以设置宽度 */
        width: 40%; /* 分配 40% 的宽度给标签 */
        margin-right: 10px; /* 标签和值之间的间距 */
        white-space: normal; /* 允许标签文本换行 */
        word-break: break-word;
        box-sizing: border-box; /* 包含内边距和边框在宽度内 */
    }

    .cute-table td .action-buttons {
        width: 100%; /* 操作按钮占据整行 */
        margin-top: 10px;
        display: flex; /* 使操作按钮区域成为 flex 容器 */
        justify-content: space-around; /* 按钮左右分散 */
        padding-top: 10px;
        border-top: 1px dashed var(--light-gray);
    }

    .action-buttons {
        gap: 8px; /* 增加按钮之间的间距 */
    }

    .btn-small {
        padding: 8px 15px;
        font-size: 13px;
    }

    .login-container {
        padding: 40px 30px;
        border-radius: 20px;
    }

    .login-header h2 {
        font-size: 2em;
    }

    .login-header p {
        font-size: 1em;
        margin-bottom: 30px;
    }

    .login-container .btn {
        padding: 16px 25px;
        font-size: 16px;
    }

    .cute-message {
        width: 90%;
        left: 5%;
        transform: translateX(0);
        bottom: 15px;
        right: auto;
    }
}

/* --- iPhone 14 Pro Max (Portrait) Specific Optimizations --- */
@media only screen and (max-width: 430px) and (min-width: 391px) {
    body {
        padding: 18px;
    }

    .container {
        border-radius: 25px;
        box-shadow: var(--shadow-medium);
        padding: 0;
    }

    .header {
        padding: 40px 30px;
    }

    .header h1 {
        font-size: 2.5em;
        margin-bottom: 12px;
    }

    .header p {
        font-size: 1.1em;
    }

    .user-controls { /* 移动端调整 */
        position: static;
        margin-top: 20px;
        justify-content: center;
    }

    .user-info-text {
        font-size: 1.05em;
        padding: 7px 14px;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr); /* Two columns for slightly larger screens */
        gap: 20px;
        padding: 30px;
    }

    .stat-card {
        padding: 20px 15px; /* 调整内边距 */
        border-radius: 20px;
    }

    .stat-icon {
        font-size: 2em; /* 适当减小图标大小 */
        margin-bottom: 10px; /* 调整间距 */
    }

    .stat-card h3 {
        font-size: 0.9em; /* 减小标题字体大小 */
        margin-bottom: 8px; /* 调整间距 */
    }

    .stat-value {
        font-size: 1.8em; /* 减小数值字体大小 */
        word-break: break-all; /* 允许在单词内部断行 */
    }

    .report-dashboard-section { /* 移动端图表调整 */
        padding: 35px 30px;
    }

    /* ECharts 容器在稍大屏幕的高度 */
    #yearlyChart {
        height: 320px; /* 调整为更适合屏幕的高度 */
    }

    .report-controls {
        gap: 15px;
    }

    .chart-tab-btn {
        min-width: 120px;
    }

    .chart-navigation {
        gap: 15px;
    }

    .month-display {
        font-size: 1.3em;
    }

    .form-section {
        padding: 35px 30px;
    }

    .form-header h2 {
        font-size: 1.9em;
    }

    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Allow two columns if space permits */
        gap: 25px;
        margin-bottom: 35px;
    }

    .form-group label {
        font-size: 1.05em;
    }

    .input-wrapper input {
        padding: 16px 50px 16px 18px;
        font-size: 16px;
        border-radius: 14px;
    }

    .input-icon {
        right: 16px;
        font-size: 1.25em;
    }

    .form-actions {
        gap: 18px;
    }

    .btn {
        padding: 15px 28px;
        font-size: 15.5px;
        border-radius: 22px;
        min-width: 120px;
    }

    .records-section {
        padding: 35px 30px;
    }

    .section-header h2 {
        font-size: 1.9em;
    }

    /* === 响应式表格优化 (针对 430px 屏幕) === */
    .table-container {
        overflow-x: auto; /* 确保表格容器可以横向滚动 */
        border: none;
        box-shadow: none;
        background: transparent; /* 背景透明，让行卡片背景生效 */
    }

    .cute-table {
        width: 100%; /* 确保在小屏幕下表格宽度为100% */
        border-collapse: collapse;
        display: block; /* 将表格设置为块级元素 */
        min-width: 350px; /* 最小宽度，防止内容过窄 */
    }

    .cute-table thead {
        display: none;
    }

    .cute-table tbody {
        display: block;
        width: 100%;
    }

    .cute-table tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 20px;
        background: var(--white);
        border-radius: 18px;
        box-shadow: var(--shadow-soft);
        padding: 20px;
        transition: all 0.3s ease;
        border: 2px solid transparent;
        width: 100%;
    }

    .cute-table tbody tr:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-medium);
    }
    .cute-table tbody tr:nth-child(even) {
        background: var(--white);
    }

    .cute-table td {
        /* 使用 inline-block + width 方式来布局标签和值 */
        padding: 12px 10px;
        border-bottom: 1px dashed var(--light-gray);
        font-size: 1em;
        width: 100%;
        text-align: right;
        white-space: normal;
        word-break: break-word;
        display: block;
        overflow: hidden;
    }
    .cute-table td:last-child {
        border-bottom: none;
    }

    .cute-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-light);
        text-align: left;
        display: inline-block;
        width: 40%; /* 分配 40% 的宽度给标签 */
        margin-right: 10px;
        white-space: normal;
        word-break: break-word;
        box-sizing: border-box;
    }

    .cute-table td .action-buttons {
        width: 100%;
        margin-top: 10px;
        display: flex;
        justify-content: space-around;
        padding-top: 10px;
        border-top: 1px dashed var(--light-gray);
    }

    .action-buttons {
        gap: 8px;
    }

    .btn-small {
        padding: 9px 18px;
        font-size: 13.5px;
    }

    .login-container {
        padding: 45px 35px;
        border-radius: 25px;
    }

    .login-header h2 {
        font-size: 2.2em;
    }

    .login-header p {
        font-size: 1.05em;
        margin-bottom: 35px;
    }

    .login-container .btn {
        padding: 17px 28px;
        font-size: 17px;
    }

    .cute-message {
        width: 85%;
        left: 7.5%;
        transform: translateX(0);
        bottom: 20px;
        right: auto;
    }
}


/* === 拟态框样式 === */
.neumorphic-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }

  .modal-content {
    background: var(--white);
    border-radius: 15px;
    box-shadow:
      -5px -5px 15px rgba(255, 255, 255, 0.7),
      5px 5px 15px rgba(0, 0, 0, 0.1);
    padding: 25px;
    width: 90%;
    max-width: 400px;
    animation: modalFadeIn 0.3s ease-out;
  }

  @keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .modal-header {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
  }

  .modal-body {
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.1rem;
  }

  .modal-footer {
    display: flex;
    justify-content: space-around;
  }

  .modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-width: 100px;
  }

  .confirm-btn {
    background: var(--rose);
    color: white;
    box-shadow:
      -2px -2px 5px rgba(255, 255, 255, 0.5),
      2px 2px 5px rgba(0, 0, 0, 0.1);
  }

  .confirm-btn:hover {
    background: #e53963;
    transform: translateY(-2px);
    box-shadow:
      -3px -3px 7px rgba(255, 255, 255, 0.5),
      3px 3px 7px rgba(0, 0, 0, 0.1);
  }

  .cancel-btn {
    background: var(--light-gray);
    color: var(--text-dark);
    box-shadow:
      -2px -2px 5px rgba(255, 255, 255, 0.5);
  }

 .cancel-btn:hover {
        background: #e0e0e0;
        transform: translateY(-2px);
        box-shadow:
          -3px -3px 7px rgba(255, 255, 255, 0.5),
          3px 3px 5px rgba(214, 214, 214, 0.5);
      }

      .delete-btn {
        background: var(--rose);
        color: var(--white);
        border: none;
        padding: 10px 15px;
        border-radius: 12px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow:
          -5px -5px 10px rgba(255, 255, 255, 0.5),
          5px 5px 10px rgba(0, 0, 0, 0.1);
      }

      .delete-btn:hover {
        background: #e66b8b;
        transform: translateY(-2px);
        box-shadow:
          -3px -3px 7px rgba(255, 255, 255, 0.5),
          3px 3px 5px rgba(214, 214, 214, 0.5);
      }