* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 去除所有状态下的下划线 */
#tongyi a,
#tongyi a:link,
#tongyi a:visited,
#tongyi a:hover,
#tongyi a:active {
text-decoration: none;
}

/* 去除点击时的外部虚线框 */
#tongyi a {
outline: none;
}

/* 设置链接颜色为黑色，去除默认的蓝色 */
#tongyi a {
color: #000;
}

/* 使链接继承父元素的文本颜色 */
#tongyi a {
color: inherit;
}

:root {
    --primary: #4a90d9;
    --primary-dark: #357abd;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #333333;
    --text-light: #888888;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 18px;
    background: transparent;
    color: var(--text);
}

.btn-icon:hover {
    background: var(--bg);
}

.btn-block {
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--card);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.username {
    color: var(--text-light);
    font-size: 14px;
}

.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.auth-box {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 360px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    border-color: var(--primary);
}

.main-section {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px;
}

.calendar-container {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px;
    margin-bottom: 12px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-title {
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.calendar-title:hover {
    background: var(--bg);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 5px;
}

.weekday {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    padding: 8px 0;
    font-weight: 500;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    min-height: 60px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-day:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.calendar-day.today {
    border-color: var(--primary);
    background: #f0f7ff;
}

.calendar-day.other-month {
    opacity: 0.4;
}

.day-number {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.day-amounts {
    flex: 1;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    padding-top: 1px;
}

.day-income {
    color: var(--success);
    white-space: nowrap;
}

.day-expense {
    color: var(--danger);
    white-space: nowrap;
}

.summary-section {
    margin-top: 12px;
    padding: 12px 15px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.summary-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.summary-item {
    text-align: center;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.summary-label {
    font-size: 12px;
    color: var(--text-light);
    display: inline;
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
    display: inline;
    margin-left: 2px;
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
}

.summary-value.income {
    color: var(--success);
}

.summary-value.expense {
    color: var(--danger);
}

.summary-value.balance {
    color: var(--primary);
}

.year-title {
    font-size: 18px;
    font-weight: 600;
}

.year-summary {
    overflow-x: auto;
}

.year-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.year-table th,
.year-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.year-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
}

.year-table th:not(:first-child),
.year-table td:not(:first-child) {
    text-align: right;
}

.year-table tr:last-child {
    font-weight: 600;
    border-top: 2px solid var(--border);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-year {
    max-width: 600px;
}

.modal-year .modal-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.year-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.record-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
}

.record-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.record-tab.active {
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.record-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.record-form select,
.record-form input {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
}

.record-form select:focus,
.record-form input:focus {
    border-color: var(--primary);
}

.day-records {
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.day-records-title {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.day-record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.day-record-item:last-child {
    border-bottom: none;
}

.day-record-info {
    flex: 1;
}

.day-record-category {
    font-size: 14px;
    font-weight: 500;
}

.day-record-note {
    font-size: 12px;
    color: var(--text-light);
}

.day-record-amount {
    font-size: 14px;
    font-weight: 600;
    margin-left: 10px;
}

.day-record-amount.income {
    color: var(--success);
}

.day-record-amount.expense {
    color: var(--danger);
}

.day-record-amount.reserved {
    color: var(--warning);
}

.profile-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
}

.profile-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.profile-tab.active {
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.category-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
}

.category-form input:focus {
    border-color: var(--primary);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
    font-size: 14px;
}

@media (max-width: 600px) {
    .header {
        padding: 10px 15px;
    }

    .logo {
        font-size: 16px;
    }

    .btn-sm {
        padding: 3px 8px;
        font-size: 11px;
    }

    .calendar-container {
        padding: 15px 10px;
    }

    .calendar-day {
        min-height: 45px;
        padding: 2px;
    }

    .day-number {
        font-size: 11px;
    }

    .day-amounts {
        font-size: 8px;
    }

    .year-table {
        font-size: 12px;
    }

    .year-table th,
    .year-table td {
        padding: 6px 6px;
    }

    .modal-content {
        max-width: 100%;
        max-height: 90vh;
    }
}
