* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --green: #4CAF50;
    --green-dark: #388E3C;
    --green-light: #81C784;
    --white: #fff;
    --text: #333;
    --text-light: #999;
    --border: #eee;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}
html, body { margin: 0; padding: 0; width: 100%; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; font-size: 14px; color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
input, button, textarea, select { font-family: inherit; font-size: inherit; border: none; outline: none; }
.hidden { display: none !important; }

/* Page */
.page { display: none; }
.page.active { display: block; }

/* ===== HOME PAGE: 与背景图 472×1024 等比缩放，热区百分比=设计稿比例（避免 cover 裁切错位）===== */
#page-home { width: 100%; margin: 0; padding: 0; }

.home-bg-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #ececec;
}
.home-bg-stage {
    position: relative;
    width: min(100vw, calc(100vh * 472 / 1024));
    max-width: 100%;
    aspect-ratio: 472 / 1024;
}
.home-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    pointer-events: none;
}
.home-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 公司名称：今日总收入上方，与参考图「名称 >」一致 */
.home-company-row {
    position: absolute;
    top: 19.2%;
    left: 6%;
    width: 88%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 3;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.96);
    font-family: Nunito, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    transform: translateY(-20px);
}
.home-company-row:active {
    opacity: 0.88;
}
.home-company-chevron {
    font-weight: 300;
    opacity: 0.9;
    font-size: 0.88em;
    line-height: 1;
    transform: translateY(0.5px);
}

/* 金额：仅数字在遮罩内；左对齐 + 不换行，首位固定在背景 ¥ 右侧，位数增加只向右延伸 */
.home-amount {
    position: absolute;
    top: 25.6%;
    left: 41.5%;
    width: auto;
    max-width: 56%;
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    cursor: pointer;
    line-height: 1;
    transform: translateX(-4px);
}
.home-amount-fig {
    display: inline-flex;
    align-items: baseline;
    flex: 0 0 auto;
    color: #fff;
    font-family: Oswald, "Barlow Semi Condensed", "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(34px, 9.8vw, 48px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    text-shadow: 0 1px 2px rgba(0,0,0,0.09);
    white-space: nowrap;
}
.home-amount-square-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 0.14em;
    height: 0.14em;
    margin: 0 0.06em 0.22em;
    background: currentColor;
    vertical-align: baseline;
}

/* 收款笔数 / 退款笔数 下方整数（与主金额同字体，无小数点） */
.home-stats-nums {
    position: absolute;
    top: 30.6%;
    left: 6%;
    width: 88%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    transform: translateY(calc(7.8% + 80px));
}
.home-stat-num-col {
    flex: 1;
    width: 50%;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
}
.home-stat-num {
    color: #fff;
    /* Nunito 笔画更圆；400 比主金额略细 */
    font-family: Nunito, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(20px, 5.8vw, 30px);
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1.1;
    -webkit-font-smoothing: antialiased;
    text-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.home-hotzone { position: absolute; cursor: pointer; }
.home-todo-zone  { top: 33.2%; left: 3%; width: 94%; height: 5.2%; transform: translateY(80px); }
/* 九宫格：相对 472×1024 设计稿等比容器，行列与图一致 */
.home-grid-zone  {
    position: absolute;
    top: 46.2%;
    left: 4%;
    width: 92%;
    height: 35.5%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0;
    box-sizing: border-box;
    transform: translateY(50px);
}
.home-grid-btn   { cursor: pointer; position: relative; }
.home-grid-btn:active { background: rgba(0,0,0,0.06); border-radius: 10px; }
.home-help-zone  { bottom: 0; left: 15%; width: 70%; height: 4.5%; }
.home-logout-btn { position: absolute; top: 1%; right: 3%; width: 60px; height: 35px; cursor: pointer; }

/* ===== Header for sub pages ===== */
.header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--green); color: #fff; position: sticky; top: 0; z-index: 100; }
.header .title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.header .back-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transform: translateY(50px); }
.header .back-btn svg { width: 20px; height: 20px; fill: #fff; }
.header .right-btn { width: 32px; }

/* Badge */
.badge { background: #ff4444; color: #fff; border-radius: 10px; padding: 2px 8px; font-size: 12px; min-width: 20px; text-align: center; }

/* Login */
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%); padding: 30px; }
.login-logo { width: 70px; height: 70px; background: rgba(255,255,255,0.2); border-radius: 18px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; }
.login-logo svg { width: 40px; height: 40px; fill: #fff; }
.login-title { color: #fff; font-size: 22px; font-weight: 600; margin-bottom: 35px; }
.login-form { width: 100%; max-width: 350px; }
.login-form .input-group { background: rgba(255,255,255,0.15); border-radius: 10px; padding: 0 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,0.2); }
.login-form .input-group svg { width: 20px; height: 20px; fill: rgba(255,255,255,0.7); flex-shrink: 0; }
.login-form .input-group input { flex: 1; height: 48px; background: transparent; color: #fff; font-size: 15px; }
.login-form .input-group input::placeholder { color: rgba(255,255,255,0.5); }
.login-form .submit-btn { width: 100%; height: 48px; background: #fff; color: var(--green); border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 10px; transition: opacity 0.2s; }
.login-form .submit-btn:active { opacity: 0.85; }

/* List Pages */
.list-container { padding: 12px 16px; }

/* 待办事项页：全屏背景（仅 .active 时生效，避免 fixed 层叠到首页） */
#page-todos.active {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}
#page-todos.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-color: #f0f2f5;
    /* 待办页全屏底图（用户提供的设计稿 472×1024） */
    background-image: url(../img/todo-page-cover.jpg?v=1);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
#page-todos.active .header {
    position: relative;
    /* 高于 .list-container，避免返回键 translateY(50px) 后落入列表层下方导致点击被拦截 */
    z-index: 10;
    flex-shrink: 0;
    background: transparent;
    /* 底图为浅色时保证白字可读 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
/* 隐藏顶栏标题（与小程序导航文案重叠或不需要展示时） */
#page-todos.active .header .title {
    visibility: hidden;
}
/* 仅隐藏箭头图形，.back-btn 仍可点击触发 goBack */
#page-todos.active .header .back-btn svg {
    opacity: 0;
}
/* 隐藏右下角「+」；改为点击顶栏右侧透明热区（与底图「⋯」位置对齐）打开添加待办 */
#page-todos.active .fab {
    display: none;
}
#page-todos.active .header .right-btn.todo-header-more {
    width: 88px;
    height: 48px;
    min-width: 88px;
    flex-shrink: 0;
    transform: translateY(45px);
    cursor: pointer;
    opacity: 0;
    z-index: 11;
    position: relative;
}
#page-todos.active .list-container {
    position: relative;
    z-index: 2;
    flex: 1;
    min-height: calc(100vh - 52px);
    min-height: calc(100dvh - 52px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent;
}

/* 资金管理页：全屏底图（用户提供的设计稿 472×1024） */
#page-fund-stats.active {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}
#page-fund-stats.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-color: #f5f5f5;
    background-image: url(../img/fund-page-cover.jpg?v=1);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
#page-fund-stats.active .header {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    background: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
#page-fund-stats.active .header .title {
    visibility: hidden;
}
#page-fund-stats.active .header .back-btn svg {
    opacity: 0;
}
#page-fund-stats.active .list-container {
    position: relative;
    z-index: 2;
    flex: 1;
    min-height: calc(100vh - 52px);
    min-height: calc(100dvh - 52px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent;
}

/* 资金管理：仅在底图标记处叠数字（pointer-events 避免挡返回/滚动） */
#page-fund-stats.active .fund-amt-layer {
    position: relative;
    z-index: 3;
    pointer-events: none;
    min-height: 40vh;
}
#page-fund-stats.active .fund-amt-total {
    position: fixed;
    top: 15.5%;
    left: 19%;
    transform: translate(-10px, 35px);
    font-size: clamp(26px, 7.5vw, 38px);
    font-weight: 600;
    color: #111;
    line-height: 1;
    letter-spacing: 0.02em;
}
#page-fund-stats.active .fund-amt-basic,
#page-fund-stats.active .fund-amt-op {
    position: fixed;
    right: 16%;
    font-size: 15px;
    font-weight: 400;
    color: #9e9e9e;
    line-height: 1;
}
#page-fund-stats.active .fund-amt-basic {
    top: 36.5%;
}
#page-fund-stats.active .fund-amt-op {
    top: 46.5%;
}

.list-card { background: var(--white); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.list-card .card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.list-card .card-title { font-size: 15px; font-weight: 500; }
.list-card .card-badge { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.badge-green { background: #E8F5E9; color: var(--green); }
.badge-red { background: #FFEBEE; color: #E53935; }
.badge-orange { background: #FFF3E0; color: #F57C00; }
.badge-blue { background: #E3F2FD; color: #1976D2; }
.list-card .card-info { display: flex; gap: 16px; font-size: 13px; color: var(--text-light); }
.list-card .card-amount { font-size: 18px; font-weight: 600; color: var(--green); }
.list-card .card-amount.refund { color: #E53935; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state svg { width: 64px; height: 64px; fill: #ddd; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Tabs */
.tabs { display: flex; background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 45px; z-index: 90; }
.tabs .tab { flex: 1; text-align: center; padding: 12px 0; font-size: 14px; color: var(--text-light); cursor: pointer; position: relative; transition: color 0.2s; }
.tabs .tab.active { color: var(--green); font-weight: 500; }
.tabs .tab.active::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 3px; background: var(--green); border-radius: 2px; }

/* FAB */
.fab { position: fixed; bottom: 30px; right: 20px; width: 52px; height: 52px; background: var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(76,175,80,0.4); cursor: pointer; z-index: 200; transition: transform 0.2s; }
.fab:active { transform: scale(0.9); }
.fab svg { width: 26px; height: 26px; fill: #fff; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.modal-overlay.modal-center {
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 400;
}
.modal.modal-centered {
    border-radius: 14px;
    width: 100%;
    max-width: 320px;
    margin: 0;
    padding: 22px 20px 20px;
    animation: modalPop 0.22s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}
.center-prompt-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}
.center-prompt-btn {
    flex: 1;
    height: 44px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}
.center-prompt-btn.cancel {
    background: #f0f0f0;
    color: #333;
}
.center-prompt-btn.ok {
    background: var(--green);
    color: #fff;
}
.modal { background: var(--white); border-radius: 16px 16px 0 0; width: 100%; max-width: 750px; padding: 24px 20px; max-height: 80vh; overflow-y: auto; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal .modal-title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 20px; position: relative; }
.modal .modal-close { position: absolute; right: 0; top: -2px; font-size: 22px; color: var(--text-light); cursor: pointer; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; font-size: 14px; color: #666; margin-bottom: 6px; }
.modal .form-group input, .modal .form-group textarea, .modal .form-group select { width: 100%; padding: 12px 14px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; background: #fafafa; transition: border-color 0.2s; }
.modal .form-group input:focus, .modal .form-group textarea:focus { border-color: var(--green); background: #fff; }
.modal .form-group textarea { height: 80px; resize: none; }
.modal .modal-btn { width: 100%; height: 46px; background: var(--green); color: #fff; border-radius: 10px; font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 8px; transition: opacity 0.2s; }
.modal .modal-btn:active { opacity: 0.85; }

/* Toast */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.75); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 999; animation: fadeIn 0.3s; pointer-events: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Loading */
.loading { text-align: center; padding: 30px; }
.loading .spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats Section */
.stats-section { margin: 12px 16px; padding: 16px; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); }
.stats-section .stats-title { font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.stats-row { display: flex; justify-content: space-around; text-align: center; }
.stats-row .stat-box { flex: 1; }
.stats-row .stat-box .val { font-size: 20px; font-weight: 600; }
.stats-row .stat-box .lbl { font-size: 12px; color: var(--text-light); margin-top: 4px; }
