/* 门窗管家 · 独立 App 样式（移动优先，桌面居中预览） */
:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --line: #e7ebf2;
    --text: #1b2432;
    --sub: #6c788c;
    --muted: #98a3b4;
    --primary: #1f6feb;
    --primary-dark: #1859c4;
    --orange: #f08a24;
    --red: #e5484d;
    --green: #17a673;
    --purple: #7b5cd6;
    --blue: #2c86d8;
    --shadow: 0 6px 22px rgba(28, 48, 84, .07);
    --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
    background: #e9edf4;
    color: var(--text);
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
#app {
    max-width: 480px;
    height: 100dvh;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(20, 40, 80, .12);
    overflow: hidden;
}
@media (min-width: 520px) { #app { height: min(920px, 100dvh); margin-top: max(0px, calc((100dvh - 920px) / 2)); border-radius: 20px; } }

/* 顶栏 */
.header {
    flex: 0 0 auto;
    height: 56px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
}
.head-back { width: 30px; font-size: 26px; line-height: 1; color: var(--text); }
#page-title { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: .3px; }
#head-action { flex: 0 0 auto; }
.head-btn { color: var(--primary); font-size: 14px; font-weight: 600; padding: 6px 4px; }
#scroller { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
#scroller::-webkit-scrollbar { display: none; }
#view { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }

/* 底部导航 */
.tabbar {
    flex: 0 0 auto;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(62px + env(safe-area-inset-bottom));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); }
.tab-on { color: var(--primary); }
.tab-icon { font-size: 19px; line-height: 1; }
.tab-label { font-size: 11px; }

/* 卡片与通用 */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.link { color: var(--primary); font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.notice { background: #f5f8fd; color: var(--sub); font-size: 12px; line-height: 1.6; padding: 10px 12px; border-radius: 10px; margin-top: 10px; }
.list-count { color: var(--sub); font-size: 12px; margin: 10px 2px 8px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; vertical-align: middle; }
.tone-gray { background: #eef1f6; color: #6b7688; }
.tone-orange { background: #fff1e2; color: #c26b0d; }
.tone-purple { background: #f0eaff; color: #6a45c4; }
.tone-blue { background: #e4f1ff; color: #1e6fc4; }
.tone-red { background: #ffe9e9; color: #cf3238; }
.tone-green { background: #e2f7ee; color: #0e8c5d; }
.mini-tag { display: inline-block; background: #eef2f8; color: var(--sub); font-size: 10px; padding: 1px 6px; border-radius: 5px; margin-left: 4px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.btn:disabled { opacity: .6; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: #f1f4f9; color: var(--text); }
.btn-danger { background: #fff0f0; color: var(--red); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row > .btn { flex: 1; }
.mini-btn { background: #f1f4f9; color: var(--sub); font-size: 12px; padding: 5px 10px; border-radius: 8px; white-space: nowrap; }
.mini-danger { background: #fff0f0; color: var(--red); }
.row-actions { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.as-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* 列表 */
.list-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; line-height: 1.5; }
.list-desc { color: var(--sub); font-size: 12px; line-height: 1.6; margin-top: 2px; word-break: break-all; }
.list-right { text-align: right; flex: 0 0 auto; }
.list-amount { font-size: 14px; font-weight: 700; color: var(--text); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #e6f0ff; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty-icon { font-size: 30px; opacity: .5; }
.empty-title { font-size: 14px; margin-top: 6px; color: var(--sub); }
.empty-desc { font-size: 12px; margin-top: 4px; }
.progress { height: 5px; background: #edf1f7; border-radius: 5px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #5aa2ff); border-radius: 5px; }

/* 栅格与统计 */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile, .mini-stat { background: #f7f9fc; border-radius: 10px; padding: 12px 6px; text-align: center; }
.stat-tile { cursor: pointer; }
.stat-num { font-size: 20px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--sub); margin-top: 2px; }
.mini-stat b { display: block; font-size: 18px; color: var(--text); }
.mini-stat span { font-size: 11px; color: var(--sub); }
.hero { background: linear-gradient(135deg, #1f6feb, #3f8df6); color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 8px 22px rgba(31, 111, 235, .22); }
.hero-label { font-size: 12px; opacity: .85; }
.hero-value { font-size: 30px; font-weight: 800; margin: 4px 0 12px; letter-spacing: .5px; }
.hero-foot { display: flex; justify-content: space-between; font-size: 12px; opacity: .92; border-top: 1px solid rgba(255,255,255,.25); padding-top: 10px; }
.todo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 7px; background: #f7f9fc; border-radius: 10px; padding: 10px; cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot-gray { background: #9aa6b8; } .dot-orange { background: var(--orange); }
.dot-purple { background: var(--purple); } .dot-blue { background: var(--blue); } .dot-green { background: var(--green); }
.todo-label { flex: 1; font-size: 13px; }
.todo-num { font-weight: 700; font-size: 15px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-btn { background: #f2f6fd; color: var(--primary); border-radius: 10px; padding: 12px; font-size: 13px; font-weight: 600; }

/* 表单 */
.ff { margin-bottom: 14px; }
.ff-label { display: block; font-size: 13px; color: var(--sub); font-weight: 600; margin-bottom: 6px; }
.ff-label i { color: var(--red); font-style: normal; }
.ff-input { width: 100%; border: 1px solid var(--line); background: #fafbfe; border-radius: 10px; padding: 10px 12px; outline: none; font-size: 14px; }
.ff-input:focus { border-color: var(--primary); background: #fff; }
.ff-textarea { resize: vertical; line-height: 1.6; }
.ff-hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.ff-static { font-size: 14px; }
.inline-row { display: flex; gap: 8px; align-items: flex-end; }
.inline-row .ff { flex: 1; }
.inline-row .mini-btn { margin-bottom: 14px; }
select.ff-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9aa6b8 50%), linear-gradient(135deg, #9aa6b8 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: #f1f4f9; color: var(--sub); border: 1px solid transparent; border-radius: 20px; padding: 6px 13px; font-size: 13px; white-space: nowrap; }
.chip-on { background: #e7f0ff; color: var(--primary); border-color: #b9d4ff; font-weight: 600; }
.search-bar { display: flex; align-items: center; position: relative; margin-bottom: 10px; }
.search-input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 34px 10px 12px; outline: none; }
.search-input:focus { border-color: var(--primary); }
.search-clear { position: absolute; right: 8px; font-size: 20px; color: var(--muted); padding: 0 6px; }
.month-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.month-input { flex: 1; border: 1px solid var(--line); background: #fafbfe; border-radius: 10px; padding: 8px 10px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; background: #f1f4f9; font-size: 20px; color: var(--sub); }
.form-error { color: var(--red); font-size: 13px; background: #fff0f0; padding: 9px 12px; border-radius: 9px; margin: 10px 0; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn { flex: 1; }

/* 图片 */
.imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.img-cell, .img-add { position: relative; width: 68px; height: 68px; border-radius: 10px; overflow: hidden; background: #f1f4f9; }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-add { display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--sub); border: 1px dashed #cdd6e4; cursor: pointer; }
.img-del { position: absolute; top: 0; right: 0; width: 20px; height: 20px; background: rgba(0,0,0,.55); color: #fff; border-radius: 0 0 0 8px; font-size: 14px; line-height: 18px; }
.thumb-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { width: 62px; height: 62px; border-radius: 8px; object-fit: cover; background: #f1f4f9; cursor: pointer; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* 键值与详情 */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--sub); flex: 0 0 auto; }
.kv > span:last-child, .kv b, .kv-text { text-align: right; word-break: break-all; }
.detail-hero { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.detail-top { display: flex; align-items: center; gap: 10px; }
.detail-name { font-size: 19px; font-weight: 800; }
.detail-sub { color: var(--sub); font-size: 13px; margin-top: 4px; }
.detail-money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; }
.detail-money span { display: block; font-size: 11px; color: var(--sub); }
.detail-money b { font-size: 16px; }
.detail-money .warn { color: var(--orange); }
.detail-money .ok { color: var(--green); }
.detail-desc { font-size: 12px; color: var(--sub); margin-top: 8px; }
.flow-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin: 8px 0 16px; }
.flow-step { text-align: center; }
.step-dot { width: 24px; height: 24px; margin: 0 auto 5px; border-radius: 50%; background: #edf1f7; color: var(--muted); font-size: 11px; line-height: 24px; }
.step-name { font-size: 10px; color: var(--muted); line-height: 1.3; }
.step-done .step-dot { background: #e2f1ff; color: var(--primary); }
.step-done .step-name { color: var(--primary); }
.step-current .step-dot { background: var(--primary); color: #fff; font-weight: 700; }
.done-banner { background: #e2f7ee; color: var(--green); text-align: center; padding: 12px; border-radius: 10px; font-weight: 600; }
.pay-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.as-mini { padding: 12px 0; border-bottom: 1px solid var(--line); }
.as-mini:last-child { border-bottom: 0; }
.as-card { padding-bottom: 14px; }

/* 我的 */
.profile { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.profile-logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #1f6feb, #5aa2ff); color: #fff; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.profile-name { font-size: 18px; font-weight: 800; }
.profile-desc { color: var(--sub); font-size: 12px; margin-top: 3px; }
.flow-text { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--sub); }
.flow-text span { background: #f1f5fc; padding: 4px 8px; border-radius: 7px; }
.flow-text i { font-style: normal; color: var(--muted); }

/* 弹层 / 提示 */
.sheet-mask, .modal-mask { position: fixed; inset: 0; background: rgba(16, 26, 44, .45); z-index: 200; display: flex; }
.sheet-mask { align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 88dvh; background: var(--surface); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 16px; font-weight: 700; }
.sheet-close { font-size: 26px; color: var(--muted); line-height: 1; padding: 0 4px; }
.sheet-body { padding: 16px 18px 20px; overflow-y: auto; }
.modal-mask { align-items: center; justify-content: center; padding: 24px; }
.confirm-box { width: 100%; max-width: 340px; background: var(--surface); border-radius: 16px; padding: 20px; }
.confirm-title { font-size: 16px; font-weight: 700; }
.confirm-text { font-size: 13px; color: var(--sub); line-height: 1.7; margin: 10px 0 18px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(24, 34, 52, .92); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 22px; z-index: 500; max-width: 86%; text-align: center; transition: opacity .25s; }
.toast-error { background: rgba(200, 48, 52, .95); }
.toast-out { opacity: 0; }

/* 账号密码登录 / 同步状态 */
#app.no-tabs .tabbar { display: none; }
#app.no-tabs #scroller { padding-bottom: 24px; }
.login-wrap { padding: 22px 16px 32px; }
.login-logo { width: 64px; height: 64px; margin: 8px auto 12px; border-radius: 18px; background: linear-gradient(135deg, #1f6feb, #5aa2ff); color: #fff; font-size: 30px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.login-title { text-align: center; font-size: 20px; font-weight: 800; }
.login-sub { text-align: center; color: var(--sub); font-size: 12px; line-height: 1.7; margin: 6px 0 18px; }
.login-card { margin-bottom: 12px; }
.login-card .ff { margin-bottom: 10px; }
.login-card .btn-block { margin-top: 6px; }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-size: 13px; color: var(--sub); cursor: pointer; }
.login-remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.login-hint { margin: 2px 0 8px; }
.login-foot { margin-top: 16px; }
