:root{
  font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;
  color:#142033;background:#eef3f8;font-synthesis:none;text-rendering:optimizeLegibility;
  --nav:#0c2b46;--nav2:#123b5e;--primary:#2468db;--primary-soft:#eaf2ff;
  --line:#d8e1ec;--muted:#718096;--card:#fff;--danger:#bd3945;--danger-soft:#fff0f1;
  --good:#16815b;--good-soft:#eaf8f2;--warn:#9b6815;--warn-soft:#fff6df;--shadow:0 8px 28px rgba(24,49,79,.08)
}
*{box-sizing:border-box}html,body,#root{min-height:100%;margin:0}body{background:#eef3f8}button,input,select,textarea{font:inherit}button{cursor:pointer}a{color:inherit}
.loading-screen,.setup-screen,.login-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 15% 10%,#dceaff 0,transparent 34%),linear-gradient(145deg,#edf3fa,#f9fbfd)}
.auth-card{width:min(460px,100%);background:#fff;border:1px solid var(--line);border-radius:22px;padding:30px;box-shadow:0 18px 55px rgba(21,53,87,.13)}
.auth-brand{display:flex;gap:14px;align-items:center;margin-bottom:24px}.brand-mark{width:48px;height:48px;border-radius:13px;background:#fff;color:#0c2b46;display:grid;place-items:center;font-size:24px;font-weight:900;box-shadow:inset 0 0 0 1px #d6e1ed}.auth-brand .brand-mark{background:#0c2b46;color:#fff}.auth-brand h1{font-size:22px;margin:0}.auth-brand p{margin:5px 0 0;color:var(--muted);font-size:13px}
.form-stack{display:flex;flex-direction:column;gap:14px}.field{display:flex;flex-direction:column;gap:7px;font-weight:650;color:#35445a}.field small{font-weight:400;color:var(--muted)}input,select,textarea{width:100%;border:1px solid #cbd7e5;border-radius:10px;background:#fff;color:#18263a;padding:11px 12px;outline:none}input:focus,select:focus,textarea:focus{border-color:#75a0e9;box-shadow:0 0 0 3px rgba(36,104,219,.1)}textarea{min-height:88px;resize:vertical}.error-box,.info-box,.warning-box{border-radius:10px;padding:11px 13px;line-height:1.55}.error-box{background:var(--danger-soft);border:1px solid #efc4c8;color:#972d37}.info-box{background:#eef6ff;border:1px solid #c8dcf7;color:#385b82}.warning-box{background:var(--warn-soft);border:1px solid #ecd28f;color:#725116}
.btn{border:1px solid #cfd9e6;background:#fff;color:#213148;border-radius:9px;padding:9px 13px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px}.btn:hover{background:#f5f8fc}.btn.primary{border-color:var(--primary);background:var(--primary);color:#fff}.btn.primary:hover{background:#1c58bc}.btn.danger{border-color:#efc0c5;color:#ad3440;background:#fff8f8}.btn.ghost{border-color:transparent;background:transparent}.btn.small{padding:6px 9px;min-height:32px;font-size:12px}.btn.block{width:100%}.btn:disabled{opacity:.55;cursor:not-allowed}
.app-shell{min-height:100vh;display:grid;grid-template-columns:186px minmax(0,1fr)}.sidebar{position:fixed;left:0;top:0;bottom:0;width:186px;background:linear-gradient(180deg,var(--nav),#0a263e);color:#dbe8f3;padding:14px 11px 18px;display:flex;flex-direction:column;z-index:40}.brand{display:flex;gap:10px;align-items:center;padding:7px 6px 17px;border-bottom:1px solid rgba(255,255,255,.12)}.brand .brand-mark{width:34px;height:34px;border-radius:9px;font-size:18px}.brand b{display:block;font-size:14px;color:#fff}.brand small{display:block;color:#9fb3c5;margin-top:4px;font-size:10px}.sidebar nav{display:flex;flex-direction:column;gap:5px;margin-top:14px}.nav-item{border:0;border-radius:9px;background:transparent;color:#c5d5e3;display:flex;align-items:center;gap:10px;padding:11px 10px;font-weight:650;text-align:left}.nav-item span{width:22px;height:22px;border-radius:7px;background:rgba(255,255,255,.09);display:grid;place-items:center;font-size:11px}.nav-item.active{background:#fff;color:#17324d}.nav-item.active span{background:#e9f1ff;color:#2468db}.sidebar-footer{margin-top:auto;border-top:1px solid rgba(255,255,255,.12);padding:13px 7px 0;font-size:11px;line-height:1.6;color:#9fb3c5}.sidebar-user{margin-bottom:8px;color:#eef6ff}.sidebar-user b{display:block}.main{grid-column:2;min-width:0}.topbar{height:66px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:25}.topbar h1{font-size:20px;margin:0}.topbar p{margin:4px 0 0;color:var(--muted);font-size:12px}.top-actions{display:flex;gap:8px}.page{padding:20px 24px 90px;max-width:1540px;margin:auto}.mobile-bottom{display:none}
.section{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px;box-shadow:var(--shadow);margin-bottom:15px}.section.flat{box-shadow:none}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}.section-heading h2{font-size:17px;margin:0}.section-heading p{margin:4px 0 0;color:var(--muted);font-size:12px}.section-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.eyebrow{color:var(--primary);font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}
.market-card{background:linear-gradient(135deg,#f2f7ff,#fff 72%);border-color:#bfd3ef}.market-list{display:grid;gap:9px}.market-item{display:flex;gap:12px;align-items:flex-start;padding:11px 12px;border:1px solid #d6e3f2;border-radius:10px;background:rgba(255,255,255,.75)}.market-dot{width:10px;height:10px;border-radius:50%;background:#2d70dd;margin-top:5px;flex:0 0 auto}.market-item.warn .market-dot{background:#d48a1d}.market-item.danger .market-dot{background:#c74450}.market-item b{display:block}.market-item p{margin:4px 0 0;color:#56677c;font-size:12px;line-height:1.5}.empty{padding:24px;text-align:center;color:var(--muted);border:1px dashed #cad6e4;border-radius:11px;background:#fafcfe}
.quick-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.quick-action{border:1px solid #d6e0ec;border-radius:11px;background:#fff;padding:14px;text-align:left;display:flex;align-items:center;gap:12px;color:#18283d}.quick-action:hover{border-color:#90afe2;background:#f8fbff}.quick-icon{width:38px;height:38px;border-radius:10px;background:#edf4ff;color:#2468db;display:grid;place-items:center;font-size:18px;font-weight:900}.quick-action b{display:block}.quick-action small{color:var(--muted);display:block;margin-top:4px}
.period-tabs{display:flex;gap:6px;flex-wrap:wrap}.period-tabs button{border:1px solid var(--line);background:#fff;border-radius:8px;padding:7px 12px;color:#5f6e81;font-weight:650}.period-tabs button.active{background:#eaf2ff;color:#1f60c8;border-color:#b8cff1}.metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.metric-card{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px;min-height:102px;display:flex;flex-direction:column;gap:8px;box-shadow:0 4px 16px rgba(27,49,75,.04)}.metric-card span{color:var(--muted);font-size:12px}.metric-card strong{font-size:22px;letter-spacing:-.02em}.metric-card small{color:#8793a4}.metric-card.danger strong{color:#b73542}.metric-card.good strong{color:#157c58}
.chart-grid{display:grid;grid-template-columns:.9fr 1.1fr;gap:15px}.chart-card{min-height:340px}.debt-list{display:flex;flex-direction:column;gap:6px}.debt-row{display:grid;grid-template-columns:24px 120px 1fr auto;gap:9px;align-items:center;padding:8px;border-radius:8px;border:0;background:transparent;text-align:left}.debt-row:hover{background:#f5f8fc}.rank{width:23px;height:23px;border-radius:7px;background:#edf2f7;color:#56687c;display:grid;place-items:center;font-size:11px;font-weight:800}.debt-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}.bar{height:9px;border-radius:999px;background:#edf1f6;overflow:hidden}.bar i{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#7ba5e6,#2267d8)}.debt-amount{font-size:12px;white-space:nowrap}.trend{height:250px;display:flex;align-items:flex-end;gap:9px;border-bottom:1px solid var(--line);padding:20px 6px 0;overflow-x:auto}.trend-group{height:100%;min-width:54px;flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:6px}.trend-bars{height:205px;width:100%;display:flex;align-items:flex-end;justify-content:center;gap:3px;border-bottom:1px dashed #e3e8ef}.trend-bars i{width:13px;min-height:2px;border-radius:4px 4px 1px 1px}.trend-bars .sale{background:#2267d8}.trend-bars .receipt{background:#43a379}.trend-bars .profit{background:#d99a32}.trend-group small{font-size:10px;color:var(--muted);white-space:nowrap}.legend{display:flex;gap:14px;justify-content:flex-end;color:var(--muted);font-size:11px}.legend span:before{content:"";display:inline-block;width:8px;height:8px;border-radius:3px;margin-right:5px}.legend .sale:before{background:#2267d8}.legend .receipt:before{background:#43a379}.legend .profit:before{background:#d99a32}
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:13px}.toolbar .search{min-width:260px;flex:1}.toolbar select{width:auto;min-width:130px}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:10px}.data-table{width:100%;border-collapse:collapse;min-width:820px;background:#fff}.data-table th,.data-table td{padding:11px 12px;border-bottom:1px solid #e8edf3;text-align:left;vertical-align:top}.data-table th{position:sticky;top:0;background:#f7f9fc;color:#526277;font-size:11px;z-index:2}.data-table td{font-size:13px}.data-table tr:last-child td{border-bottom:0}.data-table tbody tr:hover{background:#fbfdff}.name-cell b{display:block}.name-cell small{display:block;color:var(--muted);margin-top:3px}.money-positive{color:#b43340;font-weight:800}.money-negative{color:#16815b;font-weight:800}.tag{display:inline-flex;align-items:center;border-radius:999px;background:#edf3fb;color:#4b6078;padding:4px 8px;font-size:11px;font-weight:700}.tag.good{background:var(--good-soft);color:var(--good)}.tag.warn{background:var(--warn-soft);color:var(--warn)}.tag.danger{background:var(--danger-soft);color:var(--danger)}.row-actions{display:flex;gap:5px;flex-wrap:wrap}.mobile-card-list{display:none}
.detail-drawer{position:fixed;inset:0;background:rgba(13,28,43,.34);z-index:70;display:flex;justify-content:flex-end}.drawer-panel{width:min(840px,94vw);height:100%;background:#f3f6fa;box-shadow:-12px 0 40px rgba(10,30,50,.18);overflow:auto}.drawer-head{position:sticky;top:0;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:flex-start;padding:18px 20px;z-index:4}.drawer-head h2{margin:0;font-size:20px}.drawer-head p{margin:5px 0 0;color:var(--muted)}.drawer-body{padding:16px}.detail-hero{background:linear-gradient(135deg,#edf5ff,#fff 72%);border:1px solid #c8d9ef;border-radius:13px;padding:16px;margin-bottom:13px}.balance-title{color:var(--muted);font-size:12px}.balance-value{font-size:27px;font-weight:900;margin:6px 0}.detail-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin-top:13px}.detail-stat{background:#fff;border:1px solid var(--line);border-radius:10px;padding:11px}.detail-stat span{display:block;color:var(--muted);font-size:11px}.detail-stat b{display:block;margin-top:6px}.profile-line{display:flex;gap:18px;flex-wrap:wrap;margin-top:12px;padding-top:12px;border-top:1px solid #dbe5f0;color:#56667a;font-size:12px}.drawer-actions{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:13px}
.modal-backdrop{position:fixed;inset:0;background:rgba(14,28,43,.48);z-index:90;display:grid;place-items:center;padding:18px}.modal{width:min(840px,100%);max-height:94vh;background:#fff;border-radius:16px;overflow:auto;box-shadow:0 24px 80px rgba(4,22,40,.28)}.modal.narrow{width:min(560px,100%)}.modal-head{position:sticky;top:0;z-index:4;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:15px 18px}.modal-head h2{font-size:18px;margin:0}.close-btn{border:0;background:#edf2f7;border-radius:8px;width:34px;height:34px;font-size:18px}.modal-body{padding:17px}.modal-footer{position:sticky;bottom:0;background:#fff;border-top:1px solid var(--line);padding:12px 17px;display:flex;justify-content:flex-end;gap:8px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.span-2{grid-column:span 2}.form-section{border:1px solid var(--line);border-radius:12px;padding:13px;margin-top:13px}.form-section-title{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:11px}.form-section-title b{font-size:14px}.line-card{border:1px solid #d8e2ed;border-radius:11px;background:#fbfcfe;padding:12px;margin-bottom:10px}.line-grid{display:grid;grid-template-columns:1.5fr .85fr .75fr .75fr;gap:9px}.line-amount{display:flex;justify-content:flex-end;font-weight:800;color:#31445a;margin-top:9px}.checkbox-list{display:grid;gap:7px;max-height:220px;overflow:auto}.check-row{display:grid;grid-template-columns:auto 1fr auto;gap:9px;align-items:center;border:1px solid var(--line);border-radius:9px;padding:9px}.check-row input{width:auto}.check-row small{color:var(--muted)}
.mobile-home{display:none}.mobile-market{margin-bottom:12px}.voice-button{width:100%;min-height:92px;border:0;border-radius:18px;background:linear-gradient(135deg,#2468db,#1755bb);color:#fff;box-shadow:0 13px 30px rgba(36,104,219,.28);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;font-weight:900;font-size:20px}.voice-button span{font-size:12px;font-weight:500;opacity:.85}.voice-button.recording{background:linear-gradient(135deg,#c43e49,#9d2933);animation:pulse 1.1s infinite}@keyframes pulse{50%{transform:scale(.985);box-shadow:0 8px 20px rgba(196,62,73,.38)}}.mobile-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.mobile-action{min-height:95px;border:1px solid var(--line);border-radius:14px;background:#fff;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:14px;gap:5px}.mobile-action strong{font-size:17px}.mobile-action small{color:var(--muted)}
.upload-zone{border:2px dashed #bdcce0;border-radius:15px;padding:30px;text-align:center;background:#f9fbfe}.upload-zone input{margin-top:12px}.attachment-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.attachment-card{border:1px solid var(--line);border-radius:11px;background:#fff;padding:12px}.attachment-card b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attachment-card small{display:block;color:var(--muted);margin-top:6px}.toast{position:fixed;right:22px;bottom:22px;z-index:120;background:#17324d;color:#fff;border-radius:10px;padding:11px 15px;box-shadow:0 10px 30px rgba(4,21,38,.25);max-width:360px}.toast.error{background:#a92f3b}.config-note{font-size:12px;color:var(--muted);line-height:1.6;margin-top:13px}
@media(max-width:1180px){.metric-grid{grid-template-columns:repeat(3,1fr)}.chart-grid{grid-template-columns:1fr}.quick-grid{grid-template-columns:repeat(2,1fr)}.detail-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){body{background:#f1f5f9}.app-shell{display:block}.sidebar,.desktop-only{display:none!important}.main{display:block}.topbar{height:58px;padding:0 14px}.topbar h1{font-size:18px}.topbar p{display:none}.page{padding:12px 12px calc(88px + env(safe-area-inset-bottom))}.mobile-home{display:block}.desktop-dashboard{display:none}.section{border-radius:13px;padding:13px;margin-bottom:11px;box-shadow:0 4px 15px rgba(26,49,76,.05)}.metric-grid{grid-template-columns:1fr 1fr;gap:8px}.metric-card{min-height:90px;padding:12px}.metric-card strong{font-size:18px}.quick-grid{display:none}.chart-grid{display:none}.toolbar{align-items:stretch}.toolbar .search{min-width:100%}.toolbar select,.toolbar .btn{flex:1}.table-wrap{display:none}.mobile-card-list{display:flex;flex-direction:column;gap:9px}.mobile-record{border:1px solid var(--line);border-radius:12px;background:#fff;padding:13px;display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.mobile-record b{display:block}.mobile-record small{color:var(--muted);display:block;margin-top:4px}.mobile-bottom{position:fixed;left:0;right:0;bottom:0;height:70px;padding-bottom:env(safe-area-inset-bottom);background:#fff;border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(5,1fr);z-index:55}.mobile-bottom button{border:0;background:transparent;color:#69778a;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:11px}.mobile-bottom button span{font-size:16px;font-weight:900}.mobile-bottom button.active{color:var(--primary)}.drawer-panel{width:100vw}.drawer-head{padding:14px}.drawer-body{padding:12px}.detail-grid{grid-template-columns:1fr 1fr}.modal-backdrop{padding:0;place-items:end center}.modal,.modal.narrow{width:100%;max-height:95vh;border-radius:18px 18px 0 0}.modal-body{padding:14px}.form-grid{grid-template-columns:1fr}.span-2{grid-column:span 1}.line-grid{grid-template-columns:1fr 1fr}.line-grid .product-field{grid-column:span 2}.modal-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom))}.attachment-grid{grid-template-columns:1fr}.toast{left:12px;right:12px;bottom:82px;text-align:center}.auth-card{padding:22px}.section-heading{align-items:flex-start}.section-actions{justify-content:flex-start}}
@media(max-width:390px){.metric-grid,.detail-grid{grid-template-columns:1fr}.mobile-actions{grid-template-columns:1fr 1fr}.line-grid{grid-template-columns:1fr}.line-grid .product-field{grid-column:span 1}}

/* v3.0.1 hotfix: family account chooser and persistent-login notice */
.account-picker{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:14px 0}.account-choice{border:1px solid var(--line);background:#f7f9fc;color:#31445a;border-radius:10px;padding:10px 6px;font-weight:800;cursor:pointer}.account-choice.active{border-color:var(--primary);background:#eaf2ff;color:var(--primary)}.login-persist-note{font-size:12px;color:#43627d;background:#f0f7ff;border:1px solid #cfe2fa;border-radius:9px;padding:9px 10px}.muted{color:var(--muted)}
@media(max-width:420px){.account-picker{grid-template-columns:repeat(2,1fr)}}
