* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

header {
    background-color: #2468ad;
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    line-height: 1;
}

.logout-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.3);
}

/* Toast 提示样式 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 200px;
    max-width: 90vw;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}

.toast.error {
    background: linear-gradient(135deg, #ff4d4f 0%, #cf1322 100%);
}

.toast.info {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}

.toast-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    display: block;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.toast.hiding {
    animation: toastFadeOut 0.3s ease forwards;
}

/* 自定义确认对话框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background-color: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 12px;
}

.modal-icon svg {
    width: 48px;
    height: 48px;
}

.modal-icon.warning svg {
    fill: #faad14;
    stroke: #faad14;
}

.modal-icon.info svg {
    fill: #1890ff;
    stroke: #1890ff;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-align: center;
}

.modal-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn.cancel {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
    color: white;
}

.modal-btn.cancel:hover {
    background: linear-gradient(135deg, #45a314 0%, #2d7a0a 100%);
}

.modal-btn.confirm {
    background-color: #ff4d4f;
    color: white;
}

.modal-btn.confirm:hover {
    background-color: #cf1322;
}

.modal-btn.confirm.logout {
    background-color: #2468ad;
}

.modal-btn.confirm.logout:hover {
    background-color: #1a4d80;
}

.balance-card {
    margin: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-label {
    font-size: 14px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
}

.nav {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.nav-item.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

.content {
    padding: 20px;
}

.card {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.login-card .card-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: #2468ad;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

input[type="number"],
input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
    background-color: white;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* 移动端优化 */
@media (max-width: 480px) {
    input[type="date"] {
        padding: 14px 12px;
        font-size: 16px;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px;
    }
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #367ecb;
    box-shadow: 0 0 0 0.2rem rgba(54, 126, 203, 0.25);
}

input[type="password"]:focus {
    outline: none;
    border-color: #367ecb;
    box-shadow: 0 0 0 0.2rem rgba(54, 126, 203, 0.25);
}

.type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.type-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.type-btn.income {
    color: #28a745;
    border-color: #28a745;
}

.type-btn.income.active {
    background-color: #28a745;
    color: white;
}

.type-btn.expense {
    color: #dc3545;
    border-color: #dc3545;
}

.type-btn.expense.active {
    background-color: #dc3545;
    color: white;
}

.submit-btn {
    width: 50%;
    padding: 14px;
    background-color: #367ecb;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background-color: #2a6bb3;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 3px solid #dee2e6;
}

.history-item .actions {
    display: flex;
    gap: 10px;
    margin-left: 10px;
}

.action-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.edit-btn {
    background-color: #ffc107;
    color: #212529;
}

.edit-btn:hover {
    background-color: #e0a800;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
}

.history-item.income {
    border-left-color: #28a745;
}

.history-item.expense {
    border-left-color: #dc3545;
}

.history-item .info {
    flex: 1;
}

.history-item .category {
    font-weight: 500;
    margin-bottom: 4px;
    color: #2c3e50;
}

.history-item .date {
    font-size: 12px;
    color: #6c757d;
}

.history-item .amount {
    font-weight: 600;
}

.history-item.income .amount {
    color: #28a745;
}

.history-item.expense .amount {
    color: #dc3545;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-card.income {
    border-top: 3px solid #28a745;
}

.stat-card.expense {
    border-top: 3px solid #dc3545;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
}

.stat-card.income .stat-value {
    color: #28a745;
}

.stat-card.expense .stat-value {
    color: #dc3545;
}

.summary-card {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.summary-label {
    color: #6c757d;
    font-weight: 500;
}

.summary-value {
    font-weight: 600;
    color: #2c3e50;
}

.login-card {
    margin: 40px 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background-color: #367ecb;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.login-btn:hover {
    background-color: #2a6bb3;
}

.register-link {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.register-link a {
    color: #367ecb;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}
