:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #111111;
    --text-secondary: #888888;
    --border-color: #eeeeee;
    --accent: #000000;
    /* Pure black accent */
    --accent-hover: #333333;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --expense-color: #111111;
    --income-color: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

body {
    background-color: #000000;
    /* Pure black background outside the app bounds for desktop viewing */
    color: var(--text-primary);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile width */
    background-color: var(--bg-color);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

/* Header */
.top-header {
    background-color: #ffffff;
    /* White background */
    color: #000000;
    /* Black text */
    padding: 24px 24px 16px;
    z-index: 10;
    border-bottom: 2px solid #000000;
    /* Thick black line to separate header from content */
    transition: all 0.3s ease;
}

.top-header.hidden {
    display: none;
}

.header-content {
    display: flex;
    align-items: stretch;
    /* Stretch to let divider match height */
    justify-content: flex-start;
}

/* Left side: Calendar */
.header-left {
    display: flex;
    align-items: center;
    padding-right: 20px;
}

.calendar-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 2px solid #000000;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
}

.hidden-date-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    z-index: 20;
    /* Ensure it's on top of everything inside calendar-icon */
}

/* Force the clickable indicator (which actually opens the picker in webkit) to cover the whole input */
.hidden-date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    /* invisible but clickable */
}

.calendar-icon ion-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.cal-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.cal-year {
    font-size: 10px;
    font-weight: 600;
}

.cal-month-day {
    font-size: 11px;
    font-weight: 700;
}

/* Dividers */
.divider-vertical {
    width: 2px;
    background-color: #000000;
    margin: 0 24px 0 0;
}

.divider-horizontal {
    height: 2px;
    background-color: #000000;
    width: 100%;
    margin: 8px 0;
}

/* Right side: Summary Rows */
.header-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.summary-row .label {
    font-size: 14px;
    font-weight: 600;
    color: #000000;
}

.summary-row .value {
    font-size: 18px;
    font-weight: 700;
    color: #000000;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
    /* space for bottom nav */
    background-color: var(--bg-color);
    position: relative;
}

.tab-pane {
    display: none;
    width: 100%;
}

.tab-pane.active {
    display: block;
}

/* Empty State / Coming Soon */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-state ion-icon {
    font-size: 48px;
    margin-bottom: 12px;
    color: #cccccc;
}

/* Modal Overlay (Add Transaction) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-color);
    width: 100%;
    height: 80vh;
    /* Takes up 80% of screen */
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Add Transaction Modal specific */
.type-toggle {
    display: flex;
    background-color: #f0f0f0;
    border-radius: 20px;
    padding: 2px;
}

.type-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn.active {
    background-color: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.add-tx-body {
    padding-top: 10px;
}

.note-input-container {
    display: flex;
    align-items: center;
    padding: 0 10px 15px;
}

.note-input-container ion-icon {
    font-size: 20px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.note-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
}

.note-input::placeholder {
    color: #bbbbbb;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 10px;
    padding-bottom: 20px;
}

.category-grid.hidden {
    display: none;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.category-item:active {
    transform: scale(0.95);
}

.cat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.category-item span {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.category-item.active .cat-icon {
    background-color: var(--accent);
    color: #ffffff;
}

.category-item.active span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Step 2: Amount & Keypad */
#stepAmount {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#stepAmount.hidden {
    display: none;
}

#stepCategory.hidden {
    display: none;
}

.amount-display-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.selected-cat-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-icon.small {
    width: 36px;
    height: 36px;
    font-size: 18px;
    background-color: var(--accent);
    color: #ffffff;
    margin-bottom: 0;
}

.selected-cat-info span {
    font-size: 16px;
    font-weight: 600;
}

.amount-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.keypad-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.keypad-date-selector {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    padding: 6px 12px;
    border-radius: 16px;
    gap: 6px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 50px;
    gap: 10px;
}

.key-btn {
    background-color: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s;
}

.key-btn:active {
    background-color: #e0e0e0;
}

.key-btn.action-key {
    background-color: #eeeeee;
    font-size: 24px;
}

.key-btn.submit-key {
    background-color: var(--accent);
    color: #ffffff;
}


.transaction-list {
    padding-bottom: 20px;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: #f9f9f9;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.day-header-right {
    display: flex;
    gap: 12px;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.transaction-item:active {
    background-color: #f5f5f5;
}

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

.t-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
    color: var(--accent);
    font-size: 20px;
}

.t-details {
    flex: 1;
}

.t-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.t-amount {
    font-size: 16px;
    font-weight: 600;
}

.t-amount.expense {
    color: var(--expense-color);
}

.t-amount.income {
    color: var(--income-color);
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    width: 20%;
    height: 100%;
    transition: color 0.2s ease;
    font-size: 10px;
}

.nav-item ion-icon {
    font-size: 24px;
    margin-bottom: 3px;
    --ionicon-stroke-width: 32px;
}

.nav-item.active {
    color: var(--accent);
}

/* FAB - Middle Action Button */
.fab-container {
    position: relative;
    top: -18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto !important;
    /* Override .nav-item height: 100% */
    justify-content: flex-start;
}

.fab-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    aspect-ratio: 1 / 1;
    /* Force perfect circle */
    border-radius: 50%;
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.fab-button:active {
    transform: scale(0.92);
    background-color: var(--accent-hover);
}

.fab-container span {
    color: var(--text-secondary);
    font-size: 10px;
}

/* Scrollbar customization for webkit */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 2px;
}

/* =========================================================================
   Charts Tab Styles
   ========================================================================= */

.timeframe-selector {
    display: flex;
    background: #fff;
    border: 1.5px solid #222;
    border-radius: 6px;
    margin: 0 auto 15px auto;
    padding: 0;
    overflow: hidden;
    width: 90%;
    max-width: 400px;
}

.time-btn {
    flex: 1;
    border: none;
    border-right: 1.5px solid #222;
    background: #fff;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    color: #222;
    border-radius: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.time-btn:last-child {
    border-right: none;
}

.time-btn.active {
    background: #222;
    color: #fff;
    box-shadow: none;
}

/* =========================================================================
   Sub-timeframe (本周/上周...) Horizontal Scroll
   ========================================================================= */
.sub-time-scroll-container {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    padding: 0 15px;
    scrollbar-width: none;
}
.sub-time-scroll-container::-webkit-scrollbar {
    display: none;
}

.sub-time-item {
    font-size: 14px;
    color: #999;
    padding: 10px 15px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.sub-time-item.active {
    color: #222;
    font-weight: 600;
}

/* 底部黑色短横线表示选中 */
.sub-time-item.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    background: #222;
    border-radius: 2px;
}

/* 图表页签切换器 */
.chart-header-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 4px;
}

.chart-header-toggle .chart-title {
    margin: 0;
    font-size: 15px;
    color: #999;
    cursor: pointer;
    position: relative;
    padding-bottom: 6px;
    transition: all 0.2s ease;
}

.chart-header-toggle .chart-title.active {
    color: #111;
    font-weight: 700;
}

.chart-header-toggle .chart-title.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #111;
    border-radius: 2px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px 4px;
}

.chart-container {
    width: 100%;
    height: 280px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    padding: 10px;
}

/* 统计汇总栏样式 - 强制横向整齐排列 */
.statistics-summary {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 15px !important;
    margin-bottom: 25px !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.stat-item {
    flex: 1 !important;
    background: #fdfdfd !important;
    border: 1px solid #222 !important;
    border-radius: 8px !important;
    padding: 8px 4px !important;
    display: flex !important;
    flex-direction: row !important; /* 强制 label 和 value 横向排列 */
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.stat-label {
    font-size: 11px !important;
    color: #888 !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important; /* 清除之前可能的 margin */
}

.stat-value {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #222 !important;
    white-space: nowrap !important;
}

.stat-value.expense { color: #111 !important; }
.stat-value.income { color: #111 !important; }
.stat-value.balance { color: #111 !important; }

/* 排行榜样式 */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 4px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-icon {
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: #222;
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranking-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ranking-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
}

.ranking-amount-box {
    text-align: right;
}

.ranking-amount {
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

.ranking-percent {
    font-size: 11px;
    color: #888;
    margin-left: 4px;
}

/* 进度条 */
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #f2f2f7;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #111;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Assets Tab Styles */
.assets-overview {
    background: #ffffff; /* 简约白 */
    margin: 15px;
    padding: 24px 20px;
    border-radius: 16px;
    color: #1c1c1e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #f2f2f7;
}

.assets-overview .net-assets-label {
    font-size: 14px;
    color: #8e8e93;
    margin-bottom: 8px;
    display: block;
}

.assets-overview .net-assets-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    display: block;
    color: #000;
}

.assets-overview .assets-details {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #f2f2f7;
    padding-top: 20px;
    gap: 15px;
}

.assets-overview .stat-item {
    flex: 1;
    background: #f8f8f8;
    padding: 12px;
    border-radius: 12px;
}

.assets-overview .stat-label {
    font-size: 11px;
    color: #8e8e93;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.assets-overview .stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.account-list-container {
    padding: 10px 15px 40px 15px;
}

.account-group-title {
    font-size: 13px;
    color: #8e8e93;
    margin: 24px 0 12px 5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* 更轻的交互阴影 */
}

/* 账户卡片图标 */
.account-card .acc-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    background-color: #f2f2f7;
    color: #1c1c1e;
    flex-shrink: 0;
}

.account-card .acc-icon-wrap ion-icon {
    font-size: 24px;
}

.account-card .acc-info {
    flex: 1;
}

.account-card .acc-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.account-card .acc-type {
    font-size: 12px;
    color: var(--text-secondary);
}

.account-card .acc-balance {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.account-card .acc-balance.negative {
    color: #000; /* 强制黑白 */
    font-weight: 700;
}

/* =========================================================================
   Add Account Button
   ========================================================================= */
.add-account-container {
    display: flex;
    justify-content: center;
    padding: 10px 15px 40px 15px;
}

.add-account-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
    height: 50px;
    background-color: #f2f2f7;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    color: #111111;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-account-btn:active {
    transform: scale(0.98);
    background-color: #e5e5ea;
}

.add-account-btn ion-icon {
    font-size: 20px;
}

/* =========================================================================
   Full Page Overlay (Asset Details)
   ========================================================================= */
.full-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #ffffff;
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.full-page-overlay.hidden {
    transform: translateX(100%); /* Slide from right */
}

.sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #ffffff;
    border-bottom: 2px solid #000000;
    z-index: 10;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: #000000;
}

.overlay-content {
    flex: 1;
    overflow-y: auto;
    background-color: #fafafa;
    padding-bottom: 80px;
}

.scrollable {
    -webkit-overflow-scrolling: touch;
}

/* Asset Detail Card (Specific for info display) */
.asset-card-large {
    background: #ffffff;
    margin: 15px;
    padding: 24px 20px;
    border-radius: 16px;
    border: 1px solid #000000;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.asset-card-large .acc-type-tag {
    display: inline-block;
    background-color: #000000;
    color: #ffffff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.asset-card-large .acc-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.asset-card-large .acc-balance {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
}

.asset-card-large .acc-label {
    font-size: 12px;
    color: #888888;
}

.adjust-balance-btn {
    position: absolute;
    right: 20px;
    bottom: 24px;
    background-color: #ffffff;
    border: 1.5px solid #000000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Sections in Detail View */
.detail-section {
    margin: 20px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 10px;
    font-size: 16px;
    font-weight: 700;
}

.month-selector-small {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.asset-transaction-list {
    background: #ffffff;
    border-top: 1px solid #eeeeee;
}

/* Bottom Actions Toolbar */
.asset-footer-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #ffffff;
    border-top: 2px solid #000000;
    display: flex;
    align-items: center;
    justify-content: stretch;
    padding-bottom: env(safe-area-inset-bottom);
}

.footer-action-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 700;
    color: #000000;
    height: 100%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.footer-action-item:active {
    background-color: #f5f5f5;
}

.footer-action-item.delete {
    color: #ff3b30; /* Keep a hint of red for delete? User said black and white, but icons usually have color. Let's stick to black for consistency if strictly asked. */
    color: #000000;
}

.footer-action-item ion-icon {
    font-size: 22px;
}

.action-divider {
    width: 2px;
    height: 24px;
    background-color: #000000;
}


/* ================= Mine Tab Styles ================= */
.mine-header {
    display: flex;
    align-items: center;
    padding: 30px 20px;
    background-color: #fff;
    margin-bottom: 15px;
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    border: 1.5px solid #000;
    overflow: hidden;
}

.user-avatar ion-icon {
    font-size: 42px;
    color: #000;
}

.user-info h2 {
    font-size: 20px;
    margin: 0 0 5px 0;
    color: #000;
    font-weight: 700;
}

.user-info p {
    font-size: 13px;
    margin: 0;
    color: #666;
}

.mine-stats {
    display: flex;
    background-color: #fff;
    margin: 0 15px 15px 15px;
    border-radius: 10px;
    border: 1.5px solid #000;
    overflow: hidden;
}

.stat-card {
    flex: 1;
    text-align: center;
    padding: 20px 0;
}

.stat-card:first-child {
    border-right: 1.5px solid #000;
}

.stat-card-single {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0;
}

.stat-card-single .stat-num {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    margin-bottom: 0;
}

.stat-card-single .stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 0;
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: #000;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: #666;
}

.mine-menu {
    background-color: #fff;
    border-top: 1.5px solid #000;
    border-bottom: 1.5px solid #000;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1.5px solid #eeeeee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:active {
    background-color: #f5f5f5;
}

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

.menu-item ion-icon {
    font-size: 22px;
    color: #000;
    margin-right: 15px;
}

.menu-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.menu-val {
    font-size: 14px;
    color: #666;
    margin-right: 10px;
}

.menu-arrow {
    font-size: 18px;
    color: #999;
}

/* ==================== 自定义弹窗 ==================== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: dialogFadeIn 0.2s ease;
}

@keyframes dialogFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-box {
    background: #fff;
    border-radius: 16px;
    width: 80%;
    max-width: 320px;
    padding: 28px 24px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: dialogScaleIn 0.2s ease;
}

@keyframes dialogScaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.dialog-title {
    font-size: 17px;
    font-weight: 700;
    color: #000;
    text-align: center;
    margin-bottom: 12px;
}

.dialog-message {
    font-size: 15px;
    color: #333;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 24px;
    word-break: break-all;
}

.dialog-input-wrap {
    margin-bottom: 20px;
}

.dialog-input {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #000;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}

.dialog-actions {
    display: flex;
    gap: 10px;
}

.dialog-btn {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.dialog-btn-primary {
    background: #000;
    color: #fff;
}

.dialog-btn-cancel {
    background: #f2f2f7;
    color: #333;
}

/* ==================== 月份切换指示器 ==================== */
.month-switch-indicator {
    position: sticky;
    top: 0;
    z-index: 50;
    text-align: center;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 0 12px 12px;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.month-switch-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== 头像裁剪 ==================== */
#cropCircleOverlay {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.crop-drag-handle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.9);
    color: #333;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    pointer-events: none;
}

/* ==================== 分类添加按钮 ==================== */
.add-category-btn .cat-icon {
    border: 2px dashed #ccc !important;
    background: #f9f9f9 !important;
}

.add-category-btn .cat-icon ion-icon {
    color: #999;
}

.add-category-btn span {
    color: #999;
}

/* ==================== 图标选择器 ==================== */
.icon-pick-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.icon-pick-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.15s;
    justify-self: center;
}

.icon-pick-item:active {
    background: #e0e0e0;
}

.icon-pick-item ion-icon {
    font-size: 22px;
    color: #333;
}

/* ==================== 自定义选择按钮 ==================== */
.custom-select-btn:active {
    background-color: #f5f5f5 !important;
}

/* ==================== 资产预设选择 ==================== */
.preset-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.preset-scroll::-webkit-scrollbar {
    display: none;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
    color: #333;
    transition: all 0.15s;
    flex-shrink: 0;
}

.preset-btn ion-icon {
    font-size: 20px;
}

.preset-btn:active,
.preset-btn.active {
    border-color: #000;
    background: #f5f5f5;
}

/* ==================== 日期/月份选择器 ==================== */
.picker-year-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.picker-year-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f2f2f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

.picker-year-btn:active {
    background: #e0e0e0;
}

.picker-year-text {
    font-size: 18px;
    font-weight: 700;
    color: #000;
}

.picker-month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.picker-month-item {
    text-align: center;
    padding: 12px 0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.15s;
}

.picker-month-item:active {
    background: #e0e0e0;
}

.picker-month-item.active {
    background: #000;
    color: #fff;
}

.picker-day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.picker-day-header {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 6px 0;
}

.picker-day-empty {
    height: 38px;
}

.picker-day-item {
    text-align: center;
    height: 38px;
    line-height: 38px;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.picker-day-item:active {
    background: #e0e0e0;
}

.picker-day-item.active {
    background: #000;
    color: #fff;
    font-weight: 600;
}

/* 导出格式选择 */
.export-format-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.export-format-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.export-format-option:active {
    background: #f2f2f7;
    border-color: #000;
}

.export-format-info {
    flex: 1;
}

.export-format-name {
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

.export-format-desc {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Toggle Switch 开关样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #000;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ==================== 账本管理样式 ==================== */

/* 账本列表 */
.ledger-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0 16px;
}

.ledger-list-item {
    display: flex;
    align-items: center;
    padding: 16px 12px;
    border-bottom: 1.5px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.ledger-list-item:active {
    background-color: #f5f5f5;
}

.ledger-list-item:last-child {
    border-bottom: none;
}

.ledger-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.ledger-icon ion-icon {
    font-size: 22px;
    color: #000;
}

.ledger-info {
    flex: 1;
}

.ledger-name {
    font-size: 16px;
    font-weight: 500;
    color: #000;
    margin-bottom: 4px;
}

.ledger-stats {
    font-size: 12px;
    color: #999;
}

.ledger-badge {
    padding: 4px 8px;
    background: #000;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    margin-right: 8px;
}

.ledger-actions {
    display: flex;
    gap: 8px;
}

.ledger-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ledger-action-btn:active {
    background: #f5f5f5;
    border-color: #000;
}

.ledger-action-btn ion-icon {
    font-size: 16px;
    color: #666;
}

/* 新建账本按钮 */
.btn-add-ledger {
    width: 100%;
    padding: 16px;
    border: none;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-top: 1.5px solid #eee;
}

.btn-add-ledger:active {
    background-color: #f5f5f5;
}

.btn-add-ledger ion-icon {
    font-size: 20px;
    color: #000;
}

.btn-add-ledger span {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

/* 账本编辑表单 */
.ledger-edit-form {
    margin: 16px 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #000;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #007AFF;
}

.icon-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1.5px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.icon-selector:active {
    border-color: #000;
}

.icon-selector ion-icon {
    font-size: 24px;
    color: #000;
}

.icon-selector span {
    font-size: 14px;
    color: #666;
}

/* 图标选择网格 */
.icon-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.icon-grid::-webkit-scrollbar {
    display: none;
}

.icon-grid-item {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1.5px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-grid-item:active {
    background: #f5f5f5;
}

.icon-grid-item.selected {
    border-color: #000;
    background: #000;
}

.icon-grid-item.selected ion-icon {
    color: #fff;
}

.icon-grid-item ion-icon {
    font-size: 22px;
    color: #000;
}

/* 数据迁移弹窗 */
.migrate-info {
    margin: 16px 0;
    text-align: center;
}

.migrate-info p {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.migrate-info p:first-child {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.migrate-target-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1.5px solid #eee;
    border-radius: 8px;
    margin: 12px 0;
}

.migrate-target-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.migrate-target-item:last-child {
    border-bottom: none;
}

.migrate-target-item:active {
    background-color: #f5f5f5;
}

.migrate-target-item.selected {
    background-color: #f0f0f0;
}

.migrate-target-item ion-icon {
    font-size: 20px;
    color: #000;
    margin-right: 12px;
}

.migrate-target-item span {
    font-size: 15px;
    color: #000;
}

/* 导出范围选择器 */
.export-scope-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: #f5f5f5;
    border-radius: 8px;
}

.scope-option {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.scope-option:active {
    opacity: 0.8;
}

.scope-option.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Modal 样式补充 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1.5px solid #eee;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #000;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1.5px solid #eee;
    border-radius: 0 0 16px 16px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn ion-icon {
    font-size: 24px;
    color: #333;
}
/* =========== 登录页样式 =========== */
.login-page {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    box-shadow: 0 0 20px rgba(255,255,255,0.05);
}

.login-container {
    width: 100%;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: #000;
    color: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.login-logo-text {
    font-size: 32px;
    font-weight: 700;
    color: #000;
    letter-spacing: -1px;
}

.login-subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 48px;
    text-align: center;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #000;
    border-radius: 10px;
    font-size: 16px;
    color: #000;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
    -webkit-user-select: text;
    user-select: text;
}

.login-input:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

.login-code-row {
    display: flex;
    gap: 10px;
}

.login-input-code {
    flex: 1;
}

.send-code-btn {
    flex-shrink: 0;
    padding: 14px 16px;
    background: #fff;
    color: #000;
    border: 1.5px solid #000;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.send-code-btn:disabled {
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
}

.send-code-btn:not(:disabled):active {
    background: #000;
    color: #fff;
}

.login-error {
    font-size: 13px;
    color: #ff3b30;
    text-align: center;
    margin: -8px 0;
}

.login-submit-btn {
    width: 100%;
    padding: 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}

.login-submit-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.login-submit-btn:not(:disabled):active {
    background: #333;
}

.login-tips {
    font-size: 12px;
    color: #bbb;
    text-align: center;
}

/* --- 登录页协议勾选 --- */
.login-agreement {
    margin: 12px 0 6px;
    display: flex;
    justify-content: center;
}

.agreement-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    user-select: none;
}

.agreement-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #000;
    cursor: pointer;
}

.agreement-link {
    color: #000;
    text-decoration: none;
    font-weight: 500;
}

.agreement-link:active {
    opacity: 0.6;
}

/* --- 协议内容弹窗 --- */
.agreement-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.agreement-modal {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 20px 20px 0 0;
    height: 75vh;
    display: flex;
    flex-direction: column;
}

.agreement-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
    font-weight: 600;
}

.agreement-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
    font-size: 22px;
    display: flex;
    align-items: center;
}

.agreement-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    -webkit-overflow-scrolling: touch;
}

.agreement-modal-footer {
    padding: 12px 20px 24px;
    border-top: 1px solid #f0f0f0;
}

.agreement-agree-btn {
    width: 100%;
    padding: 14px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.agreement-agree-btn:active {
    background: #333;
}
