:root {
    --bg: #F5F3EF;
    --bg-secondary: #FAF8F5;
    --card: #FFFFFF;
    --text: #1A1A1A;
    --text-muted: #6B7280;
    --text-secondary: #57534E;
    --text-light: #9CA3AF;
    --border: #E8E5E0;
    --accent: #3B82F6;
    --accent-light: #DBEAFE;
    --income: #059669;
    --income-light: #D1FAE5;
    --expense: #DC2626;
    --expense-light: #FEE2E2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.msg-error {
    font-size: 1rem;
    text-align: center;
    color: var(--expense);
    margin-bottom: 20px;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: #FFFFFF;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,212,170,0.4);
    animation: slideInRight 0.4s ease-out, fadeOut 0.4s ease-out 2.5s forwards;
}

.message.success {
    background: #52c41a;
}

.message.error {
    background: #ff4d4f;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100px); }
}

/* 登录页 */
.login-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}

.login-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-logo {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #6366F1 100%);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(59,130,246,0.3);
}

.login-logo svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-title h1 {
    font-size: 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 1rem;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.login-group {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.login-group input {
    flex: 1;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.25s ease;
}

.login-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px var(--accent-light);
}

.login-group input::placeholder {
    color: var(--text-light);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent) 0%, #6366F1 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(59,130,246,0.45);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* 记账页面 */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 头部 */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1.6rem;
}

.user-info h2 {
    font-weight: 600;
    font-size: 16px;
}

.user-info p {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.user-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.user-btn:hover, .user-btn.active {
    background: var(--income-light);
    border-color: transparent;
    color: var(--income);
}

.logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.logout-btn:hover {
    background: var(--expense-light);
    border-color: transparent;
    color: var(--expense);
}

/* 快捷操作 */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.quick-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 14px var(--border);
}

.quick-btn:hover, .quick-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, #6366F1 100%);
    color: white;
    border: 1px solid var(--accent);
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}

/* 查询 */
.chaxun-card {
    background: var(--card);
    border-radius: 16px;
    padding: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.chaxun-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 70px;
    gap: 10px;
}
.chaxun-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--card);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 600;
    cursor: pointer;
}

.chaxun-select {
    width: 100%;
    padding: 12px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.chaxun-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* 统计卡片 */
.stats-card {
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.balance-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
}

.balance-amount .currency {
    font-size: 20px;
    color: var(--text-muted);
    margin-right: 2px;
}

.stats-row {
    display: flex;
    gap: 16px;
}

.stat-item {
    flex: 1;
    padding: 16px;
    border-radius: 14px;
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: scale(1.02);
}

.stat-item.income {
    background: var(--income-light);
}

.stat-item.expense {
    background: var(--expense-light);
}

.stat-item.income .stat-icon {
    margin: 0 6px;
    color: var(--income);
}

.stat-item.expense .stat-icon {
    margin: 0 6px;
    color: var(--expense);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-weight: 700;
    font-size: 18px;
}

.stat-item.income .stat-value {
    color: var(--income);
}

.stat-item.expense .stat-value {
    color: var(--expense);
}

/* 按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.action-btn {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.income:hover {
    border-color: var(--income);
    background: var(--income-light);
    color: var(--income);
}

.action-btn.expense:hover {
    border-color: var(--expense);
    background: var(--expense-light);
    color: var(--expense);
}

.action-btn.active {
    border-color: transparent;
}

.action-btn.income.active {
    background: var(--income);
    color: white;
}

.action-btn.expense.active {
    background: var(--expense);
    color: white;
}

/*添加表单 */
.edit-form {
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.add-form {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    height: 0;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.add-form.show {
    height: auto;
    opacity: 1;
    padding: 24px;
    margin-bottom: 24px;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.form-title {
    font-weight: 600;
}

.form-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.form-close:hover {
    background: var(--border);
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.form-group input,
.form-group select {
    flex: 1;
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px var(--accent-light);
}

.form-group input::placeholder,
.form-group select::placeholder {
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 12px;
}

.form-actions .btn {
    flex: 1;
}

/* 记录列表 */
.records-section {
    transition: all 0.25s;
    margin-bottom: 16px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    margin-bottom: 16px;
}

.section-title {
    font-weight: 600;
    font-size: 16px;
}

.record-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-item {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    transition: all 0.25s;
}

.record-item:hover {
    box-shadow: var(--shadow);
    background: var(--bg);
}

.record-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

.record-item.income .record-icon {
    background: var(--income-light);
    color: var(--income);
}

.record-item.expense .record-icon {
    background: var(--expense-light);
    color: var(--expense);
}

.record-content {
    flex: 1;
    min-width: 0;
}

.record-category {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.record-note {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-right {
    text-align: right;
}

.record-amount {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.record-item.income .record-amount {
    color: var(--income);
}

.record-item.expense .record-amount {
    color: var(--expense);
}

.record-date {
    font-size: 12px;
    color: var(--text-light);
}

.btn-edit {
    border-radius: 4px;
    padding: 4px 4px;
    background: var(--accent-light);
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-delete {
    border-radius: 4px;
    padding: 4px 4px;
    background: var(--expense-light);
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background: var(--expense-light);
    color: var(--expense);
}

/* 响应式 */
@media (max-width: 480px) {
    .login-card { padding: 36px 24px; }
    .balance-amount { font-size: 28px; }
    .record-icon { display: none; }
}