:root{font-family:Inter,system-ui,-apple-system,"Segoe UI",Arial,sans-serif;color:#1c2d49;background:#f6f8fc;font-synthesis:none;--text:#1c2d49;--muted:#78869d;--line:#e7edf6;--blue:#366cf5;--bg:#f6f8fc;--white:#fff;--shadow:0 7px 24px rgba(35,61,107,.045)}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;font-size:13px;line-height:1.5}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.5}a{color:#356ee9}h1,h2,h3,p{margin:0}h1{font-size:24px;letter-spacing:-.6px}h2{font-size:15px;letter-spacing:-.16px}h3{font-size:13px}small,.muted{color:var(--muted)}[hidden]{display:none!important}.app-shell{min-height:100dvh;display:grid;grid-template-columns:224px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100dvh;background:#fff;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:28px 15px 20px}.brand{display:flex;align-items:center;gap:11px;padding:5px 11px 35px}.brand-icon{display:grid;place-items:center;background:#427aff;color:#fff;border-radius:12px;min-width:37px;width:37px;height:37px;font-size:26px;box-shadow:0 5px 14px #4379ff3d}.brand strong{font-size:17px;letter-spacing:-.4px}.brand small{display:block;font-size:10px;letter-spacing:.6px}.nav-label{color:#a0aabe;font-size:10px;font-weight:750;letter-spacing:1.2px;padding:0 14px 10px}.main-nav{display:flex;flex-direction:column;gap:5px}.sidebar button{border:0;background:transparent;text-align:left;width:100%;display:flex;align-items:center;gap:12px;border-radius:9px;padding:12px 11px;color:#5d6f87;font-weight:640;font-size:12px}.sidebar button span{font-size:21px;line-height:1;width:23px;text-align:center;color:#8290a5}.sidebar button:hover{background:#f2f6ff;color:#2b62e2}.sidebar button.selected{background:#edf3ff;color:#356bed}.sidebar button.selected span{color:#356bed}.sidebar-end{margin-top:auto;padding-top:20px;border-top:1px solid #edf1f8}.sidebar-end p{color:#a2acbe;font-size:10px;padding:12px}.main-shell{min-width:0}.topbar{height:77px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.96);display:flex;align-items:center;justify-content:space-between;padding:0 clamp(18px,3.3vw,45px);gap:10px;position:sticky;top:0;z-index:5}.topbar-title small{font-size:12px}.topbar-tools{display:flex;gap:9px;align-items:center}.topbar-tools label{display:flex;align-items:center;gap:8px;font-size:11px;color:#60738f}.topbar-tools input{border:1px solid var(--line);background:#fff;border-radius:8px;padding:8px;color:#223c62;max-width:145px}.topbar-tools button{border:1px solid var(--line);background:#fff;color:#4f6788;border-radius:8px;padding:8px 11px}.topbar-tools button:hover{background:#f4f8ff}.mobile-brand{display:none}.page{padding:25px clamp(18px,3.3vw,45px) 80px;max-width:1680px;margin:auto}.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:22px}.page-head p{color:#8895ac;font-size:12px;margin:5px 0 0}.page-actions,.tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.btn{border-radius:8px;border:1px solid #dce5f2;padding:9px 13px;font-weight:680;background:#fff;color:#4d6281;white-space:nowrap}.btn.primary{background:#3671f8;color:#fff;border-color:#3671f8;box-shadow:0 3px 8px #3671f82b}.btn.primary:hover{background:#225cde}.btn.ghost{background:#fff;color:#5e718f}.btn.soft{background:#ecf3ff;border-color:#d9e5ff;color:#2665e7}.btn.small{font-size:11px;padding:6px 9px}.btn.danger{color:#b44850;border-color:#f3d9da}.icon-btn{background:#fff;border:1px solid #e0e9f4;color:#6782a7;border-radius:8px;padding:5px 10px}.icon-btn:hover{background:#edf4ff}.card{background:#fff;border:1px solid #e8eef7;border-radius:12px;box-shadow:var(--shadow);padding:18px}.card+.card{margin-top:15px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:15px}.section-title small{font-size:11px}.section-title h2{font-size:14px}.section-sub{color:#93a0b2;font-size:11px;margin-top:3px}.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:17px}.metric{padding:17px 18px;border-radius:12px;min-height:110px;position:relative;overflow:hidden}.metric strong{display:block;font-size:23px;letter-spacing:-.7px;margin-top:12px;word-break:break-word}.metric small{font-size:11px}.metric.blue{background:#eaf2ff;color:#2256b2}.metric.green{background:#e9f8f1;color:#107b61}.metric.orange{background:#fff4e9;color:#ae6a25}.metric.purple{background:#f3edff;color:#7958bb}.metric .metric-icon{position:absolute;top:16px;right:16px;font-size:24px;opacity:.65}.layout-2{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(268px,.83fr);gap:16px;margin-bottom:16px}.layout-2.equal{grid-template-columns:repeat(2,minmax(0,1fr))}.stack{display:flex;flex-direction:column;gap:15px;min-width:0}.stack>.card{margin:0}.tbl-wrap{overflow:auto;border:1px solid #edf1f8;border-radius:9px;max-width:100%;scrollbar-width:thin}.tbl{width:100%;border-collapse:collapse;min-width:740px;font-size:11px;text-align:left}.tbl th{background:#f7f9fd;color:#7587a4;font-weight:680;font-size:10px;white-space:nowrap;padding:11px 10px;border-bottom:1px solid #e8edf5}.tbl td{border-bottom:1px solid #f0f3f8;padding:10px;vertical-align:middle}.tbl tr:last-child td{border-bottom:0}.tbl .num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.tbl strong{font-size:11px;font-weight:730;color:#273c5d}.tag{display:inline-block;font-size:10px;font-weight:760;border-radius:6px;padding:4px 6px;white-space:nowrap;background:#eff3fc;color:#5f769b}.tag.income{background:#e9f9f2;color:#18a178}.tag.expense{background:#ffeeeb;color:#de6a69}.tag.debt{background:#f0eaff;color:#8d62cb}.tag.goal{background:#eaf4ff;color:#357bd0}.negative{color:#ef6672!important}.positive{color:#119c77!important}.warning-text{color:#cb802e}.rowitem{display:flex;gap:12px;justify-content:space-between;align-items:center;padding:12px 0;border-bottom:1px solid #eef2f8}.rowitem:last-child{border-bottom:0}.rowitem strong{font-size:12px;word-break:break-word}.rowitem p,.rowitem small{font-size:11px;color:#8999ae}.rowitem .right{text-align:right;white-space:nowrap}.rowitem .right strong{font-variant-numeric:tabular-nums}.alert-row{display:flex;gap:11px;background:#fff9f0;border-radius:9px;padding:11px;margin-bottom:8px}.alert-row::before{content:"!";display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:7px;background:#fff0ce;color:#ba771f;font-weight:800}.alert-row p{color:#a47d53;font-size:11px;margin-top:3px}.alert-row strong{font-size:11px}.notice{padding:11px 13px;color:#5d7495;background:#f2f7ff;border:1px solid #e3edff;border-radius:9px;font-size:11px;line-height:1.7}.notice.warn{background:#fff7ed;color:#9f753e;border-color:#f3e5cf}.rate-line{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.rate-pill{padding:7px 9px;background:#f4f8ff;color:#4d6689;border:1px solid #e1eaf8;border-radius:7px;font-size:10px}.rate-pill b{color:#2c65ce}.empty{padding:22px;text-align:center;color:#8899b3;font-size:12px}.chart-box svg{display:block;width:100%;height:auto;max-height:300px}.chart-box .fin-graph-axis{font-size:12px;fill:#9baac0}.fin-graph-svg text{font-family:inherit}.fin-list-empty{padding:23px;color:#93a1b5;text-align:center;font-size:11px}.fin-donut-wrap{display:flex;align-items:center;gap:15px;flex-wrap:wrap}.fin-donut{height:152px;width:152px;border-radius:50%;display:grid;place-items:center;flex:none}.fin-donut>div{background:#fff;border-radius:50%;width:104px;height:104px;display:flex;align-items:center;justify-content:center;flex-direction:column}.fin-donut strong{font-size:17px}.fin-donut small{font-size:10px;text-align:center}.fin-donut-legend{flex:1;min-width:110px}.fin-donut-legend>div{display:flex;gap:7px;align-items:center;font-size:10px;margin-bottom:9px}.fin-donut-legend strong{margin-left:auto}.fin-donut-dot{height:8px;width:8px;border-radius:50%;flex:none}.progress{height:7px;background:#eef3fa;border-radius:9px;overflow:hidden;margin-top:9px}.progress>i{display:block;height:100%;background:#5b86ff;border-radius:9px;max-width:100%}.goal-card{padding:12px 0;border-bottom:1px solid #edf1f7}.goal-card:last-child{border-bottom:0}.goal-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.goal-card small{font-size:10px;color:#8e9bb0}.mini-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px}.mini-list>div{border:1px solid #e9eff8;border-radius:10px;padding:13px}.mini-list small{display:block}.mini-list strong{font-size:17px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.form-grid label,.editor label,.inline-form label{font-size:11px;font-weight:680;color:#5d708d;display:flex;flex-direction:column;gap:6px;min-width:0}.form-grid label.wide{grid-column:1/-1}.form-grid input,.form-grid select,.editor input,.editor select,.editor textarea,.inline-form input,.inline-form select{width:100%;background:#fff;border:1px solid #dfe7f2;border-radius:8px;padding:10px;font-size:12px;color:#233b5e;min-height:37px}.form-grid input:focus,.form-grid select:focus,.editor input:focus,.editor select:focus{outline:2px solid #d1e2ff;border-color:#83a9f4}.inline-form{display:flex;gap:10px;align-items:end;flex-wrap:wrap}.inline-form>*{flex:1}.inline-form button{flex:none}.editor{border:1px solid #e3eaf4;border-radius:15px;width:min(95vw,505px);max-height:90dvh;padding:0;box-shadow:0 24px 70px #1329422d;color:#193454}.editor::backdrop{background:#17283e80}.editor-header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #edf1f7;padding:16px 19px}.editor-header h2{font-size:16px}.editor-header button{border:0;background:#f1f5fa;width:30px;height:30px;border-radius:7px;color:#5c7396;font-size:21px}.editor #finance-fields{max-height:65dvh;overflow:auto;padding:18px 20px;display:grid;gap:13px}.editor label{font-size:12px}.editor label small{font-weight:400}.editor textarea{min-height:80px;resize:vertical}.editor-actions{padding:14px 20px;display:flex;justify-content:flex-end;gap:8px;border-top:1px solid #edf1f7}.editor .notice{margin:0}.editor .preview{padding:12px;border-radius:8px;background:#edf5ff;color:#2865bf;font-weight:690}.error{color:#b43c4d;background:#fff0f2;border:1px solid #f8d5db;border-radius:8px;padding:10px}.toast{position:fixed;z-index:15;right:20px;bottom:22px;padding:11px 16px;background:#24466c;color:#fff;border-radius:9px;box-shadow:0 6px 24px #1f41653b;max-width:330px}.login-screen{height:100dvh;display:grid;place-items:center;background:#f5f8fc;padding:15px}.login-card{width:min(420px,100%);display:grid;gap:14px;background:#fff;padding:32px;border:1px solid #e6edf6;border-radius:16px;box-shadow:0 16px 50px #173f6620}.login-card .brand-icon{width:50px;height:50px;font-size:30px}.login-card h1{font-size:26px}.login-card p{color:#7c90aa}.login-card label{display:grid;gap:6px;color:#56708e;font-weight:650}.login-card input{min-height:42px;border-radius:8px;padding:10px;border:1px solid #dbe5f3}.login-card button{width:100%}.login-card small{font-size:11px}.desktop-only{display:initial}.mobile-only{display:none}::-webkit-scrollbar{height:7px;width:7px}::-webkit-scrollbar-thumb{background:#d8e2f0;border-radius:10px}@media(max-width:1140px){.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.layout-2{grid-template-columns:minmax(0,1fr)}.mini-list{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:800px){.app-shell{grid-template-columns:1fr}.sidebar{position:fixed;top:auto;bottom:0;height:64px;left:0;right:0;z-index:8;background:#fff;border-top:1px solid #dce6f5;border-right:0;padding:2px 4px;box-shadow:0 -5px 20px #192d4d0d}.sidebar .brand,.sidebar .nav-label,.sidebar-end{display:none}.main-nav{height:100%;display:flex;flex-direction:row;justify-content:space-between;align-items:center;gap:2px}.main-nav button{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;align-items:center;justify-content:center;text-align:center;padding:5px 1px;font-size:9px;white-space:nowrap;line-height:1.25;min-height:53px}.main-nav button span{font-size:20px;width:auto}.topbar{height:65px;padding:0 14px}.page{padding:18px 13px 106px}.mobile-brand{display:block;font-weight:800;color:#376de9;margin-bottom:1px}.page-head{margin-bottom:15px}.page-head h1{font-size:20px}.card{padding:14px}.desktop-only{display:none}.mobile-only{display:initial}.sidebar button.selected{background:#f2f6ff}.topbar-tools input{max-width:130px}.topbar-tools button{padding:6px 8px}.toast{bottom:77px}.metrics{gap:9px;margin-bottom:12px}.metric{padding:14px;min-height:100px}.metric strong{font-size:20px;margin-top:8px}}@media(max-width:520px){.page-head{display:block}.page-actions{margin-top:12px}.topbar-title>small{display:none}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.metric strong{font-size:17px}.metric small{font-size:10px}.topbar-tools label{font-size:0}.topbar-tools input{font-size:11px;max-width:118px;padding:6px}.topbar-tools #finance-logout{font-size:0}.topbar-tools #finance-logout::after{content:"Thoát";font-size:10px}.layout-2.equal,.mini-list{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.fin-donut{width:132px;height:132px}.fin-donut>div{width:95px;height:95px}}@media(max-width:350px){.main-nav button{font-size:8px}.main-nav button span{font-size:18px}.topbar-tools{gap:3px}.topbar-tools input{max-width:104px}.page{padding-left:9px;padding-right:9px}.card{padding:11px}.metrics{gap:6px}.metric{padding:11px}.metric strong{font-size:16px}}
/* Single-owner debt/expense/savings planning: quiet, responsive form details. */
.fin-conditional{margin:0;padding:12px;border:1px solid #e2eaf5;border-radius:10px;display:grid;gap:12px;background:#f9fbff}.fin-conditional[hidden]{display:none!important}.finance-priority{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:14px}.finance-priority small{flex-basis:100%;color:#677b98}.rowitem .tools{justify-content:flex-end}.rowitem .tools .btn{white-space:nowrap}@media(max-width:520px){.rowitem .tools{flex-wrap:wrap;min-width:95px;max-width:170px}.finance-priority{gap:5px}}


/* Owner-only Finance Mentor: the same responsive DOM for desktop and mobile. */
.mentor-layout{grid-template-columns:minmax(0,1.25fr) minmax(300px,.85fr)}
.mentor-chat{display:flex;flex-direction:column;gap:12px;max-height:440px;min-height:265px;overflow:auto;
  padding:14px 10px;background:#fbfcff;border:1px solid #e9edf5;border-radius:12px;margin:13px 0}
.mentor-bubble{max-width:92%;padding:13px 15px;border:1px solid #e0eaf7;border-radius:14px;
  background:#fff;overflow-wrap:anywhere}
.mentor-bubble strong{font-size:12px;display:block;margin-bottom:5px}
.mentor-bubble p{font-size:12px;line-height:1.75;white-space:pre-wrap}
.mentor-bubble.mine{align-self:flex-end;background:#eaf1ff;border-color:#d7e4ff}
.mentor-bubble.advisor{align-self:flex-start;background:#f0f9f6;border-color:#d9eee7}
.mentor-prompts{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:12px}
.mentor-prompts button{white-space:normal;text-align:left;line-height:1.45}
.mentor-compose{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;align-items:end;margin-bottom:12px}
.mentor-compose textarea{min-height:86px;max-height:180px;resize:vertical;border:1px solid #dce6f3;
 border-radius:10px;color:#1b3558;padding:11px;width:100%;line-height:1.55}
.mentor-debt{padding:14px 0;display:flex;justify-content:space-between;gap:12px;
  align-items:center;border-bottom:1px solid #edf1f7}
.mentor-debt>div{min-width:0;flex:1}.mentor-debt strong{display:block;font-size:12px}
.mentor-debt p{font-size:11px;color:#778aa4;margin-top:4px}
.mentor-debt .btn{flex-shrink:0}
#mentor-terms-dialog textarea{min-height:95px}
@media(max-width:1140px){.mentor-layout{grid-template-columns:minmax(0,1fr)}}
@media(max-width:800px){
 .main-nav{overflow-x:auto;justify-content:flex-start;scrollbar-width:thin;overscroll-behavior-x:contain}
 .main-nav button{flex:0 0 75px}
 .mentor-chat{min-height:230px;max-height:385px}
}
@media(max-width:520px){
 .mentor-compose{grid-template-columns:minmax(0,1fr)}
 .mentor-compose>.btn{justify-self:stretch}
 .mentor-debt{align-items:flex-start}
 .mentor-debt .btn{white-space:normal}
 .mentor-prompts{display:grid;grid-template-columns:1fr}
}


/* Finance Mentor report: responsive day-by-day funding, displayed with AI disabled. */
.topbar{background:#fff;box-shadow:0 1px 2px #1837590a}
.mentor-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.mentor-controls label{display:inline-flex;align-items:center;gap:9px;color:#60738f;font-size:12px;font-weight:650}
.mentor-controls select{height:34px;border:1px solid #dce6f3;border-radius:9px;background:#fff;color:#24446d;padding:4px 9px}
.mentor-report-intro{padding:11px 0 4px;color:#486080}
.mentor-report-intro strong{font-size:14px;color:#183857;display:block;margin-bottom:8px}
.mentor-report-intro p{font-size:12px;line-height:1.8}
.mentor-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-bottom:14px}
.mentor-metric{padding:13px 14px;border:1px solid #e4ecf7;border-radius:10px;background:#f8faff;min-width:0}
.mentor-metric small{font-size:11px;display:block;color:#6782a3;line-height:1.45}
.mentor-metric strong{font-size:16px;font-variant-numeric:tabular-nums;display:block;overflow-wrap:anywhere;margin-top:7px;color:#284875}
.mentor-metric.warning{background:#fff7ea;border-color:#f6dfb7}
.mentor-metric.warning strong{color:#a86e28}
.mentor-metric.danger{background:#fff2f0;border-color:#f6d8d7}
.mentor-metric.danger strong{color:#b7474d}
.mentor-subtitle{font-size:12px;margin:15px 0 7px}
.mentor-analysis-alert{background:#fff8ed;border-left:3px solid #e8a847;padding:11px 12px;margin-top:9px;border-radius:5px}
.mentor-analysis-alert strong{color:#92672e;font-size:12px}
.mentor-analysis-alert p{font-size:12px;color:#956f46;line-height:1.65;margin-top:4px;white-space:pre-wrap}
.mentor-action{padding:10px 0;border-bottom:1px solid #edf2f9}
.mentor-action:last-of-type{border-bottom:0}
.mentor-action>div{min-width:0}
.mentor-action small{display:block;font-size:10px}
.mentor-action strong{font-size:12px;display:block;margin-top:3px;color:#294267}
.mentor-action p{font-size:11px;line-height:1.75;margin-top:4px;color:#5d728f}
.mentor-assumptions{margin-top:12px;background:#f5f8fd;border-radius:9px;padding:12px;color:#59708e}
.mentor-assumptions summary{font-size:12px;font-weight:700;cursor:pointer}
.mentor-assumptions p{font-size:11px;margin-top:8px;line-height:1.6}
.mentor-chat{min-height:145px;max-height:330px}
.mentor-layout .card{min-width:0}
.mentor-layout .notice{overflow-wrap:anywhere}
.mentor-debt p{font-size:12px;line-height:1.65}
.mentor-debt strong{font-size:13px}
.mentor-debt{padding:13px 0}
@media(max-width:800px){
 .mentor-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
 .mentor-chat{min-height:135px;max-height:320px}
}
@media(max-width:520px){
 .mentor-metrics{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px}
 .mentor-metric{padding:11px}
 .mentor-metric strong{font-size:14px}
 .mentor-metric small{font-size:10px}
 .mentor-controls{margin-bottom:12px}
 .mentor-chat{min-height:120px;max-height:275px}
 .mentor-layout .section-title{flex-wrap:wrap}
 .mentor-layout .section-title .btn{white-space:normal}
}


/* Finance Sheet: responsive Excel-like planner, no shared Kitchen grid styles */
.finance-sheet{min-width:0;max-width:100%;display:grid;gap:12px}
.sheet-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}
.sheet-tool-main,.sheet-tool-filter{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.sheet-tool-filter input,.sheet-tool-filter select{height:33px;border:1px solid #dce5f2;border-radius:8px;padding:5px 9px;color:#344865;background:#fff;min-width:0}
.sheet-tool-filter input{width:175px}
.sheet-tool-filter select{max-width:158px}
.sheet-scroller{max-width:100%;overflow:auto;border:1px solid #e4eaf4;border-radius:10px;scrollbar-width:thin;overscroll-behavior-inline:contain}
.sheet-table{border-spacing:0;border-collapse:separate;min-width:990px;width:100%;font-size:12px;color:#34506f}
.sheet-table thead th{position:sticky;top:0;z-index:1;background:#f0f5fc;border-bottom:1px solid #d9e5f5;text-align:left;color:#60758f;font-size:11px;font-weight:700;padding:11px 9px;white-space:nowrap}
.sheet-table td{padding:4px 6px;border-bottom:1px solid #edf1f7;border-right:1px solid #eff3f9;vertical-align:middle;height:39px}
.sheet-table tbody tr:nth-child(even){background:#fbfcfe}
.sheet-table tbody tr:hover{background:#f3f7ff}
.sheet-table td:last-child{border-right:0}
.sheet-table input:not([type=checkbox]),.sheet-table select{border:1px solid transparent;border-radius:5px;padding:7px 6px;min-height:32px;width:100%;min-width:0;background:transparent;color:#253d60;font-size:12px;text-overflow:ellipsis}
.sheet-table input:not([type=checkbox]):hover,.sheet-table select:hover{background:#fff;border-color:#dfe8f6}
.sheet-table input:focus,.sheet-table select:focus{background:#fff!important;border-color:#4b7bf2!important;outline:2px solid #4b7bf23b;position:relative;z-index:2}
.sheet-table input[type=checkbox]{cursor:pointer;accent-color:#3f71ed;width:15px;height:15px}
.sheet-table .sheet-selector{text-align:center;width:34px}
.sheet-table th:first-child{text-align:center;width:34px}
.sheet-table .sheet-date{width:64px}
.sheet-table .sheet-date input{width:60px}
.sheet-table .sheet-label{min-width:170px;max-width:260px}
.sheet-table .sheet-memo{min-width:150px;max-width:260px}
.sheet-table td.num,.sheet-table th.num{text-align:right;font-variant-numeric:tabular-nums;min-width:94px}
.sheet-table .sheet-readonly{color:#657c9a;font-size:11px;display:block;overflow-wrap:anywhere}
.sheet-table .sheet-linked{display:block;font-size:10px;color:#8396b0;margin-top:2px}
.sheet-table .sheet-deleted{opacity:.55;text-decoration:line-through;background:#fff4f4!important}
.sheet-table .sheet-new{background:#edf8f4!important}
.sheet-table .sheet-new td:first-child{font-weight:800;color:#15865d;text-align:center}
.sheet-table button.btn{font-size:10px}
.sheet-paste{display:grid;gap:9px;background:#f7faff;border:1px dashed #a9c3e9;border-radius:9px;padding:12px}
.sheet-paste label{font-weight:680;font-size:12px}
.sheet-paste textarea{width:100%;border:1px solid #cedbec;border-radius:7px;min-height:90px;padding:9px;font:12px/1.6 ui-monospace,Consolas,monospace;resize:vertical}
.sheet-status{font-size:11px;color:#697e9b;display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px}
.finance-sheet .btn:disabled{opacity:.45}
@media(max-width:800px){
 .finance-sheet{gap:9px}
 .sheet-toolbar{align-items:stretch}
 .sheet-tool-main{overflow-x:auto;flex-wrap:nowrap;padding-bottom:6px;scrollbar-width:thin}
 .sheet-tool-main .btn{flex:none}
 .sheet-tool-filter{display:grid;grid-template-columns:minmax(110px,1fr) 110px 130px;gap:6px}
 .sheet-tool-filter input{width:100%}
 .sheet-tool-filter select{width:100%}
 .sheet-table{min-width:940px}
 .sheet-status{line-height:1.7}
}
@media(max-width:400px){.sheet-tool-filter{grid-template-columns:minmax(0,1fr) 100px}.sheet-tool-filter #sheet-sort{grid-column:1/-1;max-width:none}.sheet-table{min-width:900px}}

/* Unallocated master debts/goals are reference-only until a monthly fund is created. */
.sheet-table tr:has(.sheet-row-check:disabled){background:#fffaf2}
.sheet-table .sheet-row-check:disabled{opacity:.26;cursor:not-allowed}
.sheet-table .sheet-missing-allocation{font-size:11px;color:#926528;font-weight:650;white-space:nowrap}
.sheet-table .sheet-readonly[title*="tham khảo"]{color:#465c77;font-weight:650;font-variant-numeric:tabular-nums}
.sheet-table .sheet-linked{overflow-wrap:anywhere}


/* Finance Planning v2: Super Admin responsive/component contract.
   Single DOM + single database semantics for PC, laptop, mobile and landscape.
   Only presentation changes; owner-scoped PostgreSQL remains canonical. */
.finance-sheet{
  --sheet-ink:#213a58;--sheet-muted:#64748b;--sheet-line:#dce7f3;
  --sheet-soft:#f6f9fe;--sheet-focus:#2c69dc;--sheet-selected:#eef5ff;
  gap:14px;min-width:0;width:100%;
}
.finance-sheet .sheet-intro{display:flex;justify-content:space-between;align-items:center;gap:12px;
 background:linear-gradient(120deg,#f5f9ff,#fff);border:1px solid var(--sheet-line);
 padding:14px 16px;border-radius:12px;min-width:0}
.sheet-intro strong{font-size:13px;color:var(--sheet-ink)}
.sheet-intro p{margin-top:4px;color:var(--sheet-muted);font-size:12px;line-height:1.55;overflow-wrap:anywhere}
.sheet-intro>span{flex:0 1 225px;font-size:11px;color:#3d6f9e;text-align:right;line-height:1.5;overflow-wrap:anywhere}
.finance-sheet .sheet-toolbar{align-items:stretch;gap:12px}
.finance-sheet .sheet-tool-main,.finance-sheet .sheet-tool-filter{gap:8px;align-items:center}
.finance-sheet .sheet-tool-main .btn{min-height:38px;border-radius:9px;padding:8px 12px}
.finance-sheet .sheet-tool-main [data-sheet-action=save]:not(:disabled){
 background:#205da8;color:#fff;border-color:#205da8}
.finance-sheet .sheet-tool-main [data-sheet-action=remove]:not(:disabled){
 border-color:#efd6d6;color:#9e4b49}
.finance-sheet .sheet-tool-filter input,
.finance-sheet .sheet-tool-filter select{height:39px;font-size:12px;padding:8px 10px;
 background:#fff;border-radius:9px;border:1px solid var(--sheet-line)}
.finance-sheet .sheet-tool-filter input:focus-visible,
.finance-sheet .sheet-tool-filter select:focus-visible,
.finance-sheet .btn:focus-visible{outline:2px solid var(--sheet-focus);outline-offset:2px}
.sheet-selection-bar{display:flex;justify-content:flex-end;align-items:center;gap:10px;min-height:20px}
.sheet-select-mobile{display:none}
.sheet-selection-summary{font-size:11px;color:var(--sheet-muted)}
.sheet-scroller{border:1px solid var(--sheet-line);border-radius:12px;
 box-shadow:0 4px 14px rgb(28 63 110 / 4%);max-width:100%}
.finance-sheet .sheet-table{table-layout:auto;min-width:1080px;border-collapse:separate;
 border-spacing:0;font-size:12px}
.finance-sheet .sheet-table thead th{padding:12px 10px;font-size:11px;color:#526d8e;
 background:#f2f6fc;border-bottom:1px solid #dce7f3;z-index:2}
.finance-sheet .sheet-table td{padding:6px 9px;min-height:44px;height:auto;line-height:1.5;
 border-color:#edf1f8;overflow-wrap:anywhere}
.finance-sheet .sheet-table td.sheet-actions{min-width:106px}
.finance-sheet .sheet-table .sheet-label{min-width:150px;max-width:300px}
.finance-sheet .sheet-table .sheet-memo{min-width:145px;max-width:260px}
.finance-sheet .sheet-table .sheet-amount{min-width:126px}
.finance-sheet .sheet-table .sheet-base{min-width:115px}
.finance-sheet .sheet-table .sheet-currency{min-width:78px}
.finance-sheet .sheet-table input:not([type=checkbox]),
.finance-sheet .sheet-table select{border-radius:8px;min-height:35px;padding:7px 8px;
 font-size:12px;white-space:normal;line-height:1.3}
.finance-sheet .sheet-table .sheet-selector{min-width:39px}
.finance-sheet .sheet-table input[type=checkbox],
.finance-sheet .sheet-select-mobile input{width:18px;height:18px;accent-color:#2868df}
.finance-sheet .sheet-table tbody tr.sheet-selected:not(.sheet-deleted) td{background:var(--sheet-selected)}
.finance-sheet .sheet-table tbody tr.sheet-reference td{background:#fffcf5}
.finance-sheet .sheet-table tbody tr.sheet-new td{background:#f1fbf6}
.finance-sheet .sheet-table tbody tr.sheet-deleted td{background:#fff1f2}
.finance-sheet .sheet-table .sheet-linked{margin-top:4px;line-height:1.5}
.finance-sheet .sheet-table .sheet-readonly{font-size:12px;line-height:1.5}
.finance-sheet .sheet-table .btn{font-size:11px;min-height:35px;
 padding:7px 10px;white-space:normal;line-height:1.3}
.finance-sheet .sheet-status{padding:0 2px;color:#617792;font-size:11px;line-height:1.5}
.finance-sheet .sheet-paste{min-width:0;border-radius:12px}
.finance-sheet .sheet-paste textarea{min-width:0;max-width:100%;font-size:14px}

/* Super Admin breakpoint parity: <=359, 360-389, 390-429, 430-599,
   600-760, laptop, full desktop and short-height phone landscape. */
@media(max-width:1100px){
 .finance-sheet .sheet-toolbar{display:grid;grid-template-columns:minmax(0,1fr)}
 .finance-sheet .sheet-tool-main{flex-wrap:wrap}
 .finance-sheet .sheet-tool-filter{justify-content:stretch}
 .finance-sheet .sheet-tool-filter input{flex:1 1 250px;width:auto}
 .finance-sheet .sheet-tool-filter select{flex:1 1 140px;max-width:none}
}
@media(max-width:760px){
 #finance-content,.page-head,.page-actions,.card{min-width:0}
 .finance-sheet{gap:12px}
 .finance-sheet .sheet-intro{align-items:flex-start;flex-direction:column;padding:13px}
 .finance-sheet .sheet-intro>span{flex:auto;text-align:left;width:100%}
 .finance-sheet .sheet-toolbar{display:grid;gap:10px}
 .finance-sheet .sheet-tool-main{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
   gap:8px;overflow:visible;padding:0;max-width:100%}
 .finance-sheet .sheet-tool-main .btn{min-height:44px;width:100%;min-width:0;
   padding:9px 10px;white-space:normal;overflow-wrap:anywhere;font-size:12px}
 .finance-sheet .sheet-tool-main [data-sheet-action=add],
 .finance-sheet .sheet-tool-main [data-sheet-action=save]{grid-column:auto}
 .finance-sheet .sheet-tool-filter{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .finance-sheet .sheet-tool-filter input{grid-column:1/-1;width:100%;font-size:16px;min-height:44px}
 .finance-sheet .sheet-tool-filter select{width:100%;max-width:none;min-height:44px;font-size:16px}
 .finance-sheet .sheet-selection-bar{justify-content:space-between;align-items:center;
   gap:10px;border:1px solid var(--sheet-line);border-radius:11px;background:var(--sheet-soft);
   padding:10px 12px;flex-wrap:wrap}
 .sheet-select-mobile{display:flex;gap:9px;align-items:center;min-height:28px;
   color:#294f78;font-size:12px;font-weight:700;cursor:pointer}
 .sheet-selection-summary{flex:1 1 100%;font-size:11px;line-height:1.5}
 .finance-sheet .sheet-scroller{overflow:visible;border:0;box-shadow:none;border-radius:0}
 .finance-sheet .sheet-table{display:block;min-width:0;width:100%;border-collapse:separate}
 .finance-sheet .sheet-table thead{display:none}
 .finance-sheet .sheet-table tbody{display:grid;gap:12px;min-width:0;width:100%}
 .finance-sheet .sheet-table tbody tr{display:grid;width:100%;min-width:0;
   grid-template-columns:repeat(2,minmax(0,1fr));gap:0 10px;padding:12px;
   border-radius:13px;background:#fff;border:1px solid var(--sheet-line);
   box-shadow:0 3px 14px rgb(25 57 92 / 5%);overflow:visible}
 .finance-sheet .sheet-table tbody tr.sheet-selected{border-color:#83a8eb;
   box-shadow:0 0 0 2px #9dc4ff66}
 .finance-sheet .sheet-table tbody tr.sheet-reference{border-color:#ead7af;background:#fffdf8}
 .finance-sheet .sheet-table tbody tr.sheet-new{border-color:#c4e4d1;background:#f7fcf9}
 .finance-sheet .sheet-table tbody tr.sheet-deleted{background:#fff7f8}
 .finance-sheet .sheet-table tbody tr td,
 .finance-sheet .sheet-table tbody tr td:last-child{display:flex;flex-direction:column;align-items:stretch;
   gap:5px;min-width:0;width:auto;height:auto;max-width:none;min-height:0;
   background:transparent!important;border:0;border-bottom:1px solid #edf1f8;
   padding:10px 0 11px;line-height:1.55;text-align:left}
 .finance-sheet .sheet-table tbody tr td::before{content:attr(data-label);
   color:#6e849f;font-size:11px;font-weight:730;line-height:1.4}
 .finance-sheet .sheet-table tbody tr td.sheet-selector{order:0;grid-column:1/-1;
   display:flex;flex-direction:row;align-items:center;justify-content:space-between;
   padding:2px 0 10px;border-bottom:1px solid #e5ecf6}
 .finance-sheet .sheet-table tbody tr td.sheet-selector::before{content:"Chọn khoản này";font-size:12px}
 .finance-sheet .sheet-table tbody tr td.sheet-label{order:1;grid-column:1/-1;
   padding-top:12px}
 .finance-sheet .sheet-table tbody tr td.sheet-label strong{font-size:15px;color:#213d5b}
 .finance-sheet .sheet-table tbody tr td.sheet-date{order:2}
 .finance-sheet .sheet-table tbody tr td.sheet-kind{order:3}
 .finance-sheet .sheet-table tbody tr td.sheet-amount{order:4}
 .finance-sheet .sheet-table tbody tr td.sheet-currency{order:5}
 .finance-sheet .sheet-table tbody tr td.sheet-base{order:6;grid-column:1/-1}
 .finance-sheet .sheet-table tbody tr td.sheet-memo{order:7;grid-column:1/-1}
 .finance-sheet .sheet-table tbody tr td.sheet-actions{order:8;grid-column:1/-1;
   padding-bottom:2px;border-bottom:0}
 .finance-sheet .sheet-table tbody tr td.sheet-actions button{min-height:44px;width:100%;
   font-size:13px;text-align:center}
 .finance-sheet .sheet-table .sheet-readonly,.finance-sheet .sheet-table .sheet-missing-allocation{
   white-space:normal;overflow-wrap:anywhere;font-size:13px;text-align:left}
 .finance-sheet .sheet-table tbody tr td.sheet-base.num{text-align:left}
 .finance-sheet .sheet-table tbody tr td input:not([type=checkbox]),
 .finance-sheet .sheet-table tbody tr td select{font-size:16px;min-height:44px;width:100%;
   max-width:100%;padding:9px 10px;border:1px solid #d8e5f3;background:#fff}
 .finance-sheet .sheet-table tbody tr td input[type=checkbox]{width:20px;height:20px;
   min-width:20px}
 .finance-sheet .sheet-table .sheet-date input{width:100%}
 .finance-sheet .sheet-table .sheet-selector{min-width:0}
 .finance-sheet .sheet-status{display:flex;flex-direction:column;gap:4px;line-height:1.6}
 .finance-sheet .sheet-paste textarea{font-size:16px;min-height:105px}
 .finance-sheet .sheet-paste .tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 .finance-sheet .sheet-paste .tools .btn{min-width:0;min-height:44px;white-space:normal}
 .sidebar{height:calc(66px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
 .page{padding-bottom:calc(104px + env(safe-area-inset-bottom))}
}
@media(max-width:429px){
 .finance-sheet .sheet-tool-main{gap:6px}
 .finance-sheet .sheet-tool-main .btn{font-size:11px;padding:9px 7px}
 .finance-sheet .sheet-table tbody tr{padding:11px;gap:0 8px}
}
@media(max-width:359px){
 .finance-sheet .sheet-tool-main .btn{font-size:11px;min-height:46px;padding:8px 6px}
 .finance-sheet .sheet-tool-filter{gap:6px}
 .finance-sheet .sheet-table tbody tr{padding:10px}
 .finance-sheet .sheet-table tbody tr td{padding:9px 0}
 .finance-sheet .sheet-intro{padding:11px}
}
@media(max-width:760px) and (max-height:520px) and (orientation:landscape){
 .finance-sheet .sheet-tool-main{grid-template-columns:repeat(3,minmax(0,1fr))}
 .finance-sheet .sheet-table tbody tr{grid-template-columns:repeat(2,minmax(0,1fr))}
 .finance-sheet .sheet-status{padding-bottom:12px}
}
@media(prefers-reduced-motion:reduce){.finance-sheet *, .finance-sheet *::before{scroll-behavior:auto!important;transition:none!important}}

@media(max-width:760px){
 .finance-sheet .sheet-table tbody tr.sheet-reference td.sheet-selector::before{content:"Nợ/mục tiêu gốc · Không thể xóa"}
 .finance-sheet .sheet-table tbody tr.sheet-new td.sheet-selector::before{content:"Dòng mới · Chưa lưu"}
 .finance-sheet .sheet-table tbody tr.sheet-new td.sheet-selector{color:#24714f;font-weight:750}
}


/* Finance OS shell parity with Super Admin: all navigation and month controls
   remain touch-accessible at 320px without clipping or off-screen logout. */
@media(max-width:760px){
 .app-shell,.main-shell,#finance-content{min-width:0;max-width:100%}
 .main-nav{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));
   align-items:stretch;justify-content:stretch;gap:1px}
 .main-nav button{width:100%;min-width:0;max-width:100%;min-height:60px;
   white-space:normal;overflow-wrap:anywhere;line-height:1.15;font-size:9px;
   gap:2px;padding:5px 2px;text-align:center}
 .main-nav button span{font-size:18px;line-height:1.1;min-height:20px}
 .sidebar{height:calc(72px + env(safe-area-inset-bottom));padding:3px 3px env(safe-area-inset-bottom)}
 .page{padding-bottom:calc(116px + env(safe-area-inset-bottom))}
 .page-head,.page-head p,.section-title,.card,.rowitem{max-width:100%;overflow-wrap:anywhere}
 .editor{max-width:calc(100vw - 18px)}
 .topbar{max-width:100%;min-width:0}
 .topbar-tools{min-width:0}
 .topbar-tools input{min-width:0}
 .topbar-tools button{min-height:38px;flex:none}
 .toast{bottom:calc(83px + env(safe-area-inset-bottom))}
}
@media(max-width:520px){
 .topbar{min-height:92px;height:auto;flex-wrap:wrap;align-content:center;gap:5px;
   padding:7px 12px}
 .topbar-title{width:100%;min-height:19px;display:flex;align-items:center}
 .topbar-title .mobile-brand{font-size:12px}
 .topbar-tools{width:100%;justify-content:space-between;gap:6px}
 .topbar-tools label{flex:1 1 auto;min-width:0}
 .topbar-tools input{width:100%;max-width:none;font-size:13px;min-height:38px}
 .topbar-tools button{min-width:32px;padding:6px 9px}
 .page-head .page-actions .btn{min-height:41px;white-space:normal;overflow-wrap:anywhere}
}
@media(max-width:359px){
 .topbar{padding:6px 9px}
 .topbar-tools{gap:4px}
 .topbar-tools button{padding:5px 7px}
 .main-nav button{font-size:8.5px;padding-inline:1px}
 .main-nav button span{font-size:17px}
}


/* Differentiate monthly funding from the linked debt/goal master. */
.finance-sheet .sheet-row-actions{display:flex;align-items:center;flex-wrap:wrap;gap:5px;min-width:0}
.finance-sheet .sheet-row-actions .btn{white-space:nowrap;min-height:30px}
.finance-sheet .sheet-reference .sheet-row-actions .btn:last-child{border-color:#d2e0f8}
@media(max-width:760px){
 .finance-sheet .sheet-row-actions{gap:6px}
 .finance-sheet .sheet-row-actions .btn{min-height:35px;flex:1 0 auto}
}


/* Existing-creditor fund allocation: principal balance is reference, not planned spending. */
.finance-sheet .sheet-debt-amount{display:grid;gap:5px;min-width:0}
.finance-sheet .sheet-debt-amount select{background:#fff;border-color:#b6ccef;font-weight:600;min-width:175px}
.finance-sheet .sheet-debt-amount>small{display:block;color:#5b7392;font-size:11px;line-height:1.5}
.finance-sheet .sheet-debt-amount>small strong{color:#233e64;font-variant-numeric:tabular-nums}
.finance-sheet .sheet-debt-amount>label{display:grid;gap:3px;font-size:11px;font-weight:650;color:#536b90}
.finance-sheet .sheet-debt-amount>label input{background:#fff;border:1px solid #d3e1f2;padding:8px}
.finance-sheet tr.sheet-new:has(.sheet-debt-amount) td{vertical-align:top;min-height:80px}
@media(max-width:760px){
 .finance-sheet .sheet-debt-amount select{width:100%;min-width:0}
 .finance-sheet .sheet-debt-amount>label input{min-height:44px}
}


/* Finance CRUD actions stay usable on both Desktop and compact mobile screens. */
.rowitem .tools,.tbl .tools{display:flex;gap:5px;align-items:center;justify-content:flex-end;flex-wrap:wrap}
.rowitem .right{white-space:normal;min-width:0}
.rowitem .right>.tools{margin-top:7px}
.rowitem .tools .btn,.tbl .tools .btn{white-space:nowrap}
.tbl td:last-child .tools{min-width:124px}
@media(max-width:520px){
 .rowitem{align-items:flex-start;flex-wrap:wrap}
 .rowitem>.tools{margin-left:auto;max-width:100%;justify-content:flex-start}
 .rowitem>.right{flex:1 1 100%;text-align:left}
 .rowitem .right>.tools{justify-content:flex-start}
 .tbl td:last-child .tools{justify-content:flex-start}
}
