/* SVG 线性图标 */
.icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.icon-sm {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 28px;
    height: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::root {
    --bg-page: #FFF9F5;
    --bg-card: #FFFFFF;
    --bg-grouped: #F8F0E8;
    --text-primary: #332A22;
    --text-secondary: #6D5A4B;
    --text-tertiary: #9E8A7A;
    --color-primary: #F59E0B;
    --color-primary-light: #FFFBEB;
    --color-ai: #D97706;
    --bg-ai: #FEF3C7;
    --border-light: #F3E8D2;
    --border-base: #E5D8C5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

.phone-frame {
    max-width: 390px;
    margin: 20px auto;
    background: var(--bg-page);
    min-height: 844px;
    position: relative;
    overflow: hidden;
}

.page {
    display: none;
    padding-bottom: 80px;
}

.page.active {
    display: block;
}

/* 导航栏 */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-page);
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
}

/* Logo 设计 */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.logo-acronym {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--color-primary-light);
    padding: 3px 8px;
    border-radius: 6px;
}

.nav-back {
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
}

.nav-more {
    font-size: 20px;
    cursor: pointer;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-grouped);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border-radius: 14px;
    margin: 0 16px 12px;
    padding: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.card-amount {
    font-size: 28px;
    font-weight: 600;
    margin: 12px 0;
    letter-spacing: -0.5px;
}

.card-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 列表项 */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.list-item:hover {
    background-color: var(--color-primary-light);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-size: 14px;
    color: var(--text-primary);
}

.list-item-amount {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.list-item-arrow {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.list-item-arrow.collapsed {
    transform: rotate(-90deg);
}

/* 分组标题 */
.section-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 16px 16px 8px;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 390px;
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
    z-index: 9999;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 16px;
    cursor: pointer;
    color: var(--text-tertiary);
}

.tab-item.active {
    color: var(--color-primary);
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.tab-text {
    font-size: 10px;
}

/* AI 气泡 */
.ai-bubble {
    background: var(--bg-ai);
    border-radius: 14px;
    padding: 16px;
    margin: 12px 16px;
}

.ai-bubble-header {
    font-size: 13px;
    color: var(--color-ai);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-bubble-content {
    font-size: 14px;
    line-height: 1.6;
}

.ai-bubble-link {
    font-size: 14px;
    color: var(--color-ai);
    margin-top: 12px;
    display: inline-block;
}

/* 按钮 */
.btn-primary {
    background: var(--color-primary);
    color: white;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    border: none;
}

.btn-secondary {
    background: var(--bg-grouped);
    color: var(--text-primary);
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    border: none;
}

/* Tab 切换 */
.tab-switch {
    display: flex;
    background: var(--bg-grouped);
    border-radius: 8px;
    margin: 0 16px 16px;
    padding: 4px;
}

.tab-switch-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.tab-switch-item.active {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
}

/* 快捷选项 */
.quick-options {
    display: flex;
    gap: 12px;
    padding: 0 16px;
    margin: 12px 0;
}

.quick-option {
    flex: 1;
    background: var(--bg-card);
    border-radius: 10px;
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
}

.quick-option-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.quick-option-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 输入框 */
.input-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 390px;
    background: var(--bg-card);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
}

.input-field {
    flex: 1;
    background: var(--bg-grouped);
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
}

.input-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 消息气泡 */
.message {
    margin: 8px 16px;
    max-width: 80%;
}

.message-ai {
    background: var(--bg-ai);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message-user {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    margin-left: auto;
    text-align: right;
}

/* 时间轴 */
.timeline-month {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 16px 16px 8px;
}

.timeline-item {
    background: var(--bg-card);
    margin: 0 16px 8px;
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.timeline-title {
    font-size: 14px;
    margin-bottom: 2px;
}

.timeline-amount {
    font-size: 14px;
    font-weight: 500;
}

/* 底部统计 */
.bottom-stats {
    background: var(--bg-card);
    padding: 12px 16px;
    margin: 16px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 32px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

/* 页面切换按钮 */
.page-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
}

.page-switcher-btn {
    display: block;
    padding: 8px 16px;
    margin: 4px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
}

.page-switcher-btn:hover {
    background: var(--bg-grouped);
}

.page-switcher-btn.active {
    background: var(--color-primary);
    color: white;
}

/* ========== 新增样式 ========== */

/* 首页趋势和健康度 */
.trend-up {
    color: #F59E0B;
    font-size: 11px;
    margin-right: 8px;
}

.progress-bar {
    background: #F3E8D2;
    height: 4px;
    border-radius: 2px;
    margin: 8px 0;
    overflow: hidden;
}

.progress-fill {
    background: #F59E0B;
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* 预算优先级徽章 */
.priority-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.priority-badge.urgent {
    background: #FEE2E2;
    color: #DC2626;
}

.ai-optimized-badge {
    display: inline-block;
    font-size: 10px;
    color: #059669;
    margin-right: 8px;
}

/* AI气泡增强 */
.ai-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: #FEF3C7;
    color: #D97706;
    margin-right: 8px;
}

.ai-suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.ai-suggestion-icon {
    font-size: 14px;
}

.ai-bubble-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.btn-ai-apply {
    background: #D97706;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ai-apply:hover {
    background: #B45309;
}

/* 时间轴日历 */
.mini-calendar {
    background: var(--bg-card);
    border-radius: 12px;
    margin: 0 16px 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.calendar-month {
    text-align: center;
}

.calendar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    font-size: 11px;
    padding: 6px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-day:hover {
    background: var(--bg-grouped);
}

.calendar-day.empty {
    pointer-events: none;
}

.calendar-day.active {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 10px;
    color: var(--text-tertiary);
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.legend-dot.active {
    background: var(--color-primary);
}

.legend-dot.warning {
    background: #F59E0B;
}

/* 时间轴增强 */
.timeline-date-enhanced {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-grouped);
    border-radius: 8px;
    flex-shrink: 0;
}

.timeline-day {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.timeline-month-label {
    font-size: 10px;
    color: var(--text-tertiary);
}

.timeline-content {
    flex: 1;
}

.timeline-amount {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.btn-reminder {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-grouped);
    border: 1px solid var(--border-base);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.btn-reminder:hover {
    background: var(--border-base);
    color: var(--text-primary);
}

/* AI助手增强 */
.upgrade-banner {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    margin: 0 16px 16px;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-content {
    flex: 1;
}

.upgrade-title {
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.upgrade-price {
    color: rgba(255,255,255,0.9);
    font-size: 11px;
}

.btn-upgrade {
    background: white;
    color: #D97706;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.ai-stats {
    display: flex;
    background: var(--bg-card);
    border-radius: 12px;
    margin: 0 16px 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ai-stat-item {
    flex: 1;
    text-align: center;
}

.ai-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.ai-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.ai-stat-divider {
    width: 1px;
    background: var(--border-light);
    margin: 0 8px;
}

.ai-suggestions-history {
    background: var(--bg-ai);
    border-radius: 12px;
    margin: 0 16px 16px;
    padding: 16px;
}

.history-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-ai);
    margin-bottom: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.history-icon {
    color: #059669;
    font-size: 14px;
}

.history-saved {
    margin-left: auto;
    color: #059669;
    font-weight: 500;
}

/* 模板市场增强 */
.smart-recommendation {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-radius: 12px;
    margin: 0 16px 16px;
    padding: 16px;
    border: 2px solid var(--color-primary);
}

.recommendation-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-ai);
    margin-bottom: 12px;
}

.recommendation-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.recommendation-tag {
    font-size: 10px;
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

.recommendation-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.btn-use {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-use:hover {
    background: var(--color-ai);
}

.template-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.template-tag.hot {
    background: #FEE2E2;
    color: #DC2626;
}

.template-tag.new {
    background: #D1FAE5;
    color: #059669;
}

.btn-favorite {
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-favorite:hover {
    color: #EF4444;
}

.btn-favorite.favorited {
    color: #EF4444;
}

/* 会员中心 */
.member-card {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    border-radius: 14px;
    padding: 16px;
    margin: 0 16px 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.member-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.2);
}

.member-stats {
    display: flex;
    margin-bottom: 16px;
}

.member-stat {
    flex: 1;
    text-align: center;
}

.stat-number {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    opacity: 0.9;
}

.member-divider {
    width: 1px;
    background: rgba(255,255,255,0.3);
    margin: 0 8px;
}

.member-perks {
    display: flex;
    gap: 12px;
}

.perk-item {
    font-size: 11px;
    opacity: 0.9;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 12px;
    font-size: 14px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--border-base);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}
