html, body { background: #f5f5f5; }
.tab-bar { position: relative; top: auto; left: auto; right: auto; display: flex; align-items: center; }
.tab-bar .tab-btn.active::after { background: rgb(167, 139, 216); opacity: 0.75; }
.tab-back {
    position: absolute; left: 0.16rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: #666;
    padding: 0.16rem 0.1rem; cursor: pointer; line-height: 1;
    display: flex; align-items: center; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.tab-back svg { width: 0.52rem; height: 0.52rem; }
.help-icon {
    position: absolute; top: 50%; right: 0.42rem; transform: translateY(-50%);
    border: 0; width: 0.37rem; height: 0.37rem; border-radius: 50%;
    background: rgb(149, 121, 198); color: #fff;
    font-size: 0.24rem; font-weight: bold; line-height: 0.37rem;
    padding: 0; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
body {
    margin: 0;
    padding-bottom: 0.5rem; box-sizing: border-box;
}
#scroll-root {
    display: block;
    overflow-y: visible; background: #f5f5f5;
    padding-bottom: 0; height: auto;
}
#scroll-root::-webkit-scrollbar { display: none; }
.container {
    max-width: 23.52rem; width: 100%; margin: 0 auto;
    padding: 0.21rem 0.42rem 1.2rem 0.42rem; box-sizing: border-box;
}
.card {
    background: #fff; border-radius: 0.47rem;
    padding: 0.31rem; margin-bottom: 0.42rem;
}
.card-title {
    font-size: 0.37rem; font-weight: 600; color: #333;
    margin-bottom: 0.26rem; display: flex; align-items: center; gap: 0.16rem;
}
.card-title::before {
    content: ''; width: 0.08rem; height: 0.37rem;
    background: rgb(167, 139, 216); border-radius: 0.04rem; display: inline-block;
}

/* 简介卡片 */
.intro-card {
    display: flex; align-items: center; gap: 0.31rem;
    background: linear-gradient(135deg, #EFEAF7, #F5F0FB);
    border: 0.02rem solid #D5C7EE;
    border-radius: 0.47rem; padding: 0.31rem;
}
.intro-text h2 { margin: 0 0 0.1rem; font-size: 0.42rem; color: #6B4FA0; }
.intro-text p { margin: 0; font-size: 0.29rem; color: #666; line-height: 1.6; }
.intro-disclaimer { margin-top: 0.16rem !important; font-size: 0.28rem !important; color: #9E9E9E !important; word-break: break-all; }
.intro-text .intro-brand { margin: 0.31rem 0 0; font-size: 0.28rem; color: #6B4FA0; text-align: right; }

/* 账本切换栏 */
.book-tabs {
    display: flex; gap: 0.21rem; overflow-x: auto;
    padding: 0.08rem 0; scrollbar-width: none;
}
.book-tabs::-webkit-scrollbar { display: none; }
.book-tab {
    flex: 0 0 auto; cursor: pointer; padding: 0.21rem 0.31rem;
    border-radius: 9999px; font-size: 0.34rem; color: #666;
    background: #f5f5f5; white-space: nowrap;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.book-tab.active {
    background: rgb(149, 121, 198); color: #fff; font-weight: 600;
}
.book-tab-add {
    border: 0.03rem dashed #D5C7EE; background: #fff; color: #6B4FA0;
    font-weight: bold; padding: 0.16rem 0.37rem;
}
.book-tab-del {
    margin-left: 0.12rem; font-size: 0.3rem; color: #999;
    cursor: pointer; line-height: 1; display: inline-flex;
    align-items: center; justify-content: center;
    width: 0.42rem; height: 0.42rem; border-radius: 50%;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.book-tab.active .book-tab-del { color: rgba(255,255,255,0.75); }
.book-tab-del:hover { color: #e53935; background: rgba(0,0,0,0.08); }
.book-tab.active .book-tab-del:hover { color: #fff; background: rgba(255,255,255,0.2); }

/* 宠物标签栏 */
.pet-tabs {
    display: flex; gap: 0.21rem; overflow-x: auto;
    padding: 0.08rem 0; scrollbar-width: none;
}
.pet-tabs::-webkit-scrollbar { display: none; }
.pet-tab {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
    gap: 0.08rem; cursor: pointer; padding: 0.16rem 0.21rem;
    border-radius: 9999px; transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-width: 1.36rem;
}
.pet-tab.active { }
.pet-tab-dot {
    width: 0.84rem; height: 0.84rem; border-radius: 50%;
    background: #c9e4de; display: flex; align-items: center; justify-content: center;
    font-size: 0.37rem; color: #5b8c7a; font-weight: bold;
}
.pet-tab.active .pet-tab-dot { }
.pet-tab-name { font-size: 0.28rem; color: #333; max-width: 1.26rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-tab-add .pet-tab-dot { background: #f5f5f5; border: 0.03rem dashed #c9e4de; color: #5b8c7a; }

/* 宠物档案 */
.pet-profile { display: flex; gap: 0.21rem; align-items: flex-start; flex-wrap: wrap; }
.pet-profile-avatar {
    width: 1.47rem; height: 1.47rem; border-radius: 50%;
    background: #c9e4de;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.58rem; color: #5b8c7a; font-weight: bold;
    flex-shrink: 0;
}
.pet-profile-detail { flex: 1; min-width: 0; }
.pet-profile-name { font-size: 0.47rem; font-weight: bold; color: #333; margin-bottom: 0.12rem; }
.pet-profile-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.1rem 0.31rem; font-size: 0.29rem; color: #666;
}
.pet-profile-grid span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-profile-label { color: #999; }
.pet-profile-actions { display: flex; gap: 0.16rem; flex-shrink: 0; }
.pet-edit-btn {
    font-size: 0.31rem; color: #6B4FA0; cursor: pointer;
    border: 0.02rem solid #D5C7EE; border-radius: 9999px;
    padding: 0.08rem 0.26rem; background: #fff;
    -webkit-tap-highlight-color: transparent;
}
.pet-edit-btn.danger { color: #e53935; border-color: #e53935; }

/* 表单 */
.form-row { display: flex; gap: 0.21rem; margin-bottom: 0.21rem; flex-wrap: wrap; }
.form-row input, .form-row select, .form-row button {
    flex: 1; min-width: 0; font-size: 0.34rem;
    padding: 0.21rem 0.26rem; border: 0.02rem solid #e0e0e0;
    border-radius: 0.26rem; outline: none; box-sizing: border-box;
    font-family: inherit; color: #333; background: #fff;
    -webkit-appearance: none;
}
.form-row input:focus, .form-row select:focus { border-color: #D5C7EE; }
.btn-primary {
    background: rgb(149, 121, 198) !important;
    color: #fff !important; border: none !important;
    border-radius: 9999px !important;
    font-weight: bold; cursor: pointer; letter-spacing: 0.03rem;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { opacity: 0.85; }
.btn-sm { flex: 0 0 auto !important; padding: 0.21rem 0.42rem !important; }

/* 弹窗 */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.35); z-index: 9999;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff; border-radius: 0.47rem; padding: 0.52rem;
    width: 85%; max-width: 8.5rem; box-shadow: 0 0.31rem 1.05rem rgba(0,0,0,0.15);
    max-height: 80vh; overflow-y: auto;
}
.modal-box h3 { margin: 0 0 0.31rem; font-size: 0.42rem; color: #333; }
.modal-box input, .modal-box select {
    width: 100%; font-size: 0.37rem; padding: 0.21rem 0.26rem;
    border: 0.02rem solid #e0e0e0; border-radius: 0.26rem;
    outline: none; box-sizing: border-box; font-family: inherit;
    margin-bottom: 0.26rem;
}
.modal-box input:focus, .modal-box select:focus { border-color: #D5C7EE; }
.modal-btns { display: flex; gap: 0.21rem; }
.modal-btns button {
    flex: 1; padding: 0.21rem; font-size: 0.37rem;
    border-radius: 9999px; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-cancel { background: #f5f5f5; color: #666; }

/* 图表 */
.chart-wrap { width: 100%; height: 5.2rem; position: relative; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-tabs { display: flex; gap: 0.1rem; margin-bottom: 0.21rem; }
.chart-tab {
    font-size: 0.31rem; padding: 0.12rem 0.31rem;
    border-radius: 9999px; border: 0.02rem solid #e0e0e0;
    background: #fff; color: #666; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.chart-tab.active {
    background: rgb(149, 121, 198); color: #fff; border-color: rgb(149, 121, 198);
}

/* 统计 */
.stats-row { display: flex; gap: 0.21rem; margin-bottom: 0.26rem; }
.stat-item {
    flex: 1; text-align: center; padding: 0.31rem 0.16rem;
    background: #F3EEFA; border-radius: 0.31rem;
    border: 0.02rem solid #E4DAF4;
}
.stat-val { font-size: 0.47rem; font-weight: bold; color: #6B4FA0; }
.stat-label { font-size: 0.28rem; color: #9E9E9E; margin-top: 0.06rem; }

/* 账单列表 */
.bill-item {
    display: flex; align-items: center; padding: 0.26rem 0;
    border-bottom: 0.01rem solid #f0f0f0;
}
.bill-item:last-child { border-bottom: none; }
.bill-cat {
    width: 0.84rem; height: 0.84rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.3rem; font-weight: bold; flex-shrink: 0; margin-right: 0.26rem;
}
.bill-cat.food { background: #ffdac1; color: #c9806e; }
.bill-cat.medical { background: #f8c8d8; color: #b56d82; }
.bill-cat.grooming { background: #e2f0cb; color: #6d8a4e; }
.bill-cat.supplies { background: #b5e8fb; color: #4f8fa8; }
.bill-cat.other { background: #d4c5f9; color: #6b5b9e; }
.bill-info { flex: 1; min-width: 0; }
.bill-desc { font-size: 0.34rem; color: #333; display: flex; align-items: center; gap: 0.16rem; }
.bill-pet-tag {
    font-size: 0.26rem;
    padding: 0.04rem 0.16rem; border-radius: 9999px;
}
.bill-date { font-size: 0.28rem; color: #999; margin-top: 0.04rem; }
.bill-amount { font-size: 0.42rem; font-weight: bold; color: #333; flex-shrink: 0; }
.bill-del {
    flex-shrink: 0; margin-left: 0.21rem; width: 0.63rem; height: 0.63rem;
    font-size: 0.37rem; color: #ccc; cursor: pointer; border: none;
    background: transparent; display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

/* 数据备份 */
#backupCard { margin-bottom: 0.3rem; }
.backup-head {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.backup-head .card-title { margin-bottom: 0; }
.backup-arrow {
    width: 0.2rem; height: 0.2rem;
    border-right: 0.05rem solid #bbb; border-bottom: 0.05rem solid #bbb;
    transform: rotate(-45deg); transition: transform 0.2s; flex: none;
}
.backup-bar { display: none; gap: 0.21rem; margin-top: 0.24rem; }
#backupCard.expanded .backup-bar { display: flex; }
#backupCard.expanded .backup-arrow { transform: rotate(45deg); }
.btn-outline {
    flex: 1; font-size: 0.34rem; padding: 0.21rem;
    border: 0.02rem solid #D5C7EE; border-radius: 9999px;
    background: #fff; color: #6B4FA0; cursor: pointer;
    -webkit-tap-highlight-color: transparent; text-align: center;
}
.btn-danger { color: #e53935; border-color: #e53935; }

.empty-tip { text-align: center; padding: 0.84rem 0; color: #ccc; font-size: 0.34rem; }

.book-meta-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.16rem;
}

/* 自定义 Toast */
.toast-wrap {
    position: fixed; top: 1.2rem; left: 50%; transform: translateX(-50%);
    z-index: 99999; pointer-events: none;
}
.toast-msg {
    background: rgba(0,0,0,0.6); color: #fff; font-size: 0.34rem;
    padding: 0.26rem 0.52rem; border-radius: 0.42rem;
    white-space: nowrap;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 0.16rem 0.52rem rgba(0,0,0,0.12);
    animation: toastIn 0.25s ease;
}
.toast-msg.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-0.3rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-0.3rem); } }

/* 自定义 Confirm */
.confirm-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.35); z-index: 99998;
    align-items: center; justify-content: center;
}
.confirm-overlay.show { display: flex; }
.confirm-box {
    background: #fff; border-radius: 0.52rem; padding: 0.52rem 0.42rem 0.36rem;
    width: 78%; max-width: 7.5rem; text-align: center;
    box-shadow: 0 0.31rem 1.05rem rgba(0,0,0,0.15);
}
.confirm-box .confirm-text {
    font-size: 0.37rem; color: #333; line-height: 1.6; margin-bottom: 0.42rem;
}
.confirm-box .confirm-btns { display: flex; gap: 0.26rem; }
.confirm-box .confirm-btns button {
    flex: 1; padding: 0.24rem; font-size: 0.37rem;
    border-radius: 9999px; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.confirm-btn-cancel { background: #f5f5f5; color: #666; }
.confirm-btn-ok { background: #e53935; color: #fff; font-weight: bold; }
