:root{
  color-scheme:light;--ink:#101b2d;--navy:#122944;--muted:#586778;--line:#e0e6ec;
  --nickel:#f2f5f8;--blue:#315578;--green:#126247;--red:#a12738;--radius:17px;
  font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI",sans-serif;font-optical-sizing:auto;
}
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:#fff;color:var(--ink);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit}
button{cursor:pointer;border:1px solid transparent;border-radius:11px;padding:10px 15px;min-height:43px;background:var(--nickel);color:var(--ink);font-weight:600}
button:hover{filter:brightness(.97)}
button:disabled{opacity:.48;cursor:default}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.primary{background:var(--navy);color:#fff}
.outline{background:#fff;border-color:var(--line);color:var(--navy)}
.danger,.error{color:var(--red)}
.error:empty{display:none}
.verified,.green{color:var(--green)}
.muted{color:var(--muted)}
.small{font-size:13px}
h1,h2,h3,p{margin:0}
h2{font-size:clamp(21px,2.5vw,28px);font-weight:675;letter-spacing:-.03em;line-height:1.2}
h3{font-size:16px;letter-spacing:-.014em;font-weight:650}
a{color:#224877}
.app-header{width:min(1130px,100%);min-height:88px;margin:0 auto;padding:16px clamp(16px,4vw,38px);display:flex;align-items:center;justify-content:space-between;gap:14px}
.identity{display:flex;align-items:center;gap:8px;min-width:0}
.brand-icon{width:48px;height:48px;flex:none;position:relative;overflow:hidden;background:#fff}
.brand-icon img{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:115px;height:115px;max-width:none;mix-blend-mode:multiply}
.wordmark{display:block;white-space:nowrap;font-size:clamp(16px,2.3vw,23px);font-weight:650;letter-spacing:-.045em;color:#09264a;line-height:1.1}
.header-controls{display:flex;align-items:center;gap:7px;flex:none}
.header-controls select{width:auto;padding:6px 9px;min-height:38px;letter-spacing:.035em;font-size:13px;font-weight:650}
.header-controls button{min-height:38px;min-width:0;font-size:13px;padding:6px 11px}
main{max-width:1130px;margin:0 auto;padding:12px clamp(16px,4vw,38px) 120px}
.sectionhead{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin:22px 0 12px}
main>.sectionhead:first-child{margin-top:6px}
.card{padding:18px;border:1px solid var(--line);border-radius:var(--radius);background:white;box-shadow:0 1px 3px #142b4410;min-width:0}
.card>h3{margin-bottom:9px}
.card + .card{margin-top:14px}
.grid{display:grid;gap:12px;margin:16px 0}
.grid .card+.card,.split .card+.card{margin-top:0}
.stats{grid-template-columns:repeat(3,minmax(0,1fr))}
.stats .card{background:#f8fafb}
.actions{grid-template-columns:repeat(4,minmax(0,1fr))}
.action{display:flex;align-items:center;justify-content:center;gap:7px;background:#f5f7fa;border-color:var(--line);padding:12px 7px}
.action svg{width:20px;height:20px;color:#2d5277;flex:none}
.split{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:17px 0}
.split>div{min-width:0}
.metric,.money,.chart-label b,.row strong{font-variant-numeric:tabular-nums}
.metric{font-size:clamp(18px,2.5vw,27px);overflow-wrap:anywhere;margin:7px 0 2px;font-weight:650;letter-spacing:-.04em}
.hero{border-radius:22px;padding:clamp(17px,3vw,26px);color:white;background:linear-gradient(128deg,#12243c,#21405f);box-shadow:0 7px 20px #1b35582a}
.hero .muted,.hero label{color:#d8e4ed}
.hero-top,.hero-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.hero-bottom{border-top:1px solid #ffffff38;margin-top:18px;padding-top:14px}
.hero-bottom strong{font-size:clamp(19px,3vw,28px);color:#caebdc}
.money{font-size:clamp(33px,7vw,63px);line-height:1.03;letter-spacing:-.06em;font-weight:700;padding:7px 0 10px}
.row{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:13px 0;border-bottom:1px solid #e8edf1;overflow-wrap:anywhere}
.row:first-child{padding-top:3px}
.row:last-child{border-bottom:0;padding-bottom:3px}
.right{text-align:right;min-width:0}
.right button{margin:4px 0 0 6px}
.pill{display:inline-block;font-size:12px;font-weight:650;border-radius:999px;color:#314b66;background:#edf2f7;padding:2px 8px;margin:4px 0}
.pill.paid{background:#e6f5ed;color:#116344}
.empty,.guidance{color:var(--muted);font-size:13px}
.empty{padding:8px 0}
.guidance{margin:10px 0 0;line-height:1.55}
.note{padding:12px 15px;background:#f4f7fa;border-radius:13px;margin:10px 0;border:1px solid var(--line)}
.toolbar{display:flex;flex-wrap:wrap;gap:7px;margin:5px 0 12px}
.sectionhead .toolbar{margin:0}
.period-tools{display:flex;gap:6px;flex-wrap:wrap;align-items:end}
.period-tools label{margin:0;font-size:11px}
.period-tools input,.period-tools select{min-height:37px;padding:5px 8px;font-size:13px}
.chart-item{margin:13px 0}
.chart-label{display:flex;justify-content:space-between;gap:10px;font-size:14px;margin-bottom:5px}
.bar{height:6px;background:#edf1f5;border-radius:999px;overflow:hidden}
.bar span{display:block;height:100%;background:#315578;border-radius:999px}
.bar .bar-negative{background:#a24554}
label{display:grid;gap:5px;margin:10px 0;color:#35475e;font-size:13px;font-weight:550;min-width:0}
input,select,textarea{border:1px solid #cdd7e2;border-radius:10px;background:#fff;color:var(--ink);padding:10px 11px;min-height:43px;width:100%;font-weight:450}
input[readonly]{background:#f5f7f9;color:var(--muted)}
textarea{resize:vertical;min-height:74px}
summary{cursor:pointer;color:#344c63;font-weight:600;margin:7px 0}
.search{margin:0 0 10px;max-width:430px}
.fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,145px),1fr));gap:8px}
.linetop{display:flex;align-items:end;gap:8px}.linetop label{flex:1;margin-bottom:0}
.lineitem{border-radius:13px;background:#f5f7f9;padding:10px 12px;margin:10px 0}
.total{font-size:16px;font-weight:650;margin:10px 0}
.auth{max-width:410px;margin:32px auto;padding:clamp(19px,5vw,33px)}
.auth h2{font-size:30px;margin-bottom:8px}
.auth form{margin-top:18px}
.wide{width:100%;margin-top:9px}
.account-panel{max-width:760px;margin:auto}
.account-panel .card{margin-bottom:14px}
.account-panel .card>p{margin-bottom:7px}
.account-panel .card form+form{margin-top:14px}
.monthly-plan{padding:12px;border:1px solid var(--line);border-radius:12px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0 10px}
nav{position:fixed;z-index:10;left:0;right:0;bottom:0;display:flex;justify-content:center;gap:6px;padding:8px 5px max(8px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fffffff2;backdrop-filter:blur(20px)}
nav button{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;background:transparent;color:#35475e;font-size:13px}
nav button svg{width:20px;height:20px;flex:none}
nav button.active{background:var(--navy);color:white}
dialog{border:1px solid var(--line);border-radius:20px;padding:0;width:min(620px,calc(100% - 24px));max-height:92dvh;color:var(--ink);box-shadow:0 20px 70px #12294438}
dialog::backdrop{background:#10213a66}
.dialoghead,.formfoot{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#fff;border-bottom:1px solid var(--line)}
.dialoghead{position:sticky;top:0;z-index:2}
.formfoot{justify-content:flex-end;position:sticky;bottom:0;border-bottom:0;border-top:1px solid var(--line)}
#formbody,#formerror{padding:0 16px}
#formbody{padding-bottom:12px}
#formerror{padding-bottom:12px}
.toast{position:fixed;z-index:15;bottom:78px;left:50%;transform:translateX(-50%);background:#112943;color:#fff;padding:11px 16px;border-radius:11px;font-size:14px;max-width:min(520px,92vw)}
.hide{display:none}
.loading{text-align:center;padding:70px 0;color:var(--muted)}
.spinner{display:inline-block;width:23px;height:23px;border:2px solid #dfE5eb;border-top-color:#2b527c;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media(max-width:620px){
  .app-header{min-height:68px;padding:10px 13px;gap:6px}
  .identity{gap:3px}.brand-icon{width:34px;height:34px}.brand-icon img{width:82px;height:82px}
  .wordmark{font-size:clamp(13px,3.7vw,20px)}
  .header-controls{gap:4px}.header-controls button{padding:6px 7px;font-size:12px}.header-controls select{padding:6px}
  main{padding:7px 13px 110px}.card{padding:13px}
  .split{grid-template-columns:1fr;gap:11px}
  .stats{gap:6px}.stats .card{padding:11px 7px}.stats .muted{font-size:11px}.metric{font-size:clamp(15px,4.8vw,21px)}
  .actions{gap:6px}.action{font-size:12px;flex-direction:column;padding:8px 2px}
  nav{gap:2px}nav button{flex:1;flex-direction:column;gap:2px;padding:5px 1px;font-size:clamp(8px,2.7vw,12px)}
  input,select,textarea,.period-tools input,.period-tools select{font-size:16px}
  .hero .period-tools select,.hero .period-tools input{max-width:145px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important}}
/* BM Intelligence: conversation, with a single-line person + title item. */
nav button[data-page="intelligence"]{flex-direction:row;white-space:nowrap;max-width:none;flex-shrink:0;gap:7px;padding-inline:12px;font-size:13px}
.chat-shell{max-width:870px;margin:0 auto;height:calc(100dvh - 178px);min-height:440px;display:flex;flex-direction:column}
.chat-header{padding:14px 0 22px;border-bottom:1px solid var(--line)}
.chat-identity{display:flex;gap:12px;align-items:center}.chat-identity h2{font-size:22px;white-space:nowrap}
.assistant-avatar{display:inline-flex;align-items:center;justify-content:center;width:60px;height:60px;border:1px solid #dce4ed;border-radius:20px;background:#f3f6f9;color:#09264a;flex:none}
.assistant-avatar svg{width:29px;height:29px}.small-avatar{width:43px;height:43px;border-radius:14px}.small-avatar svg{width:22px;height:22px}
.chat-transcript{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:24px 2px;scroll-behavior:smooth}
.chat-welcome{max-width:650px;margin:16px auto 24px;text-align:center}.chat-welcome h2{font-size:clamp(23px,3.3vw,32px);margin:20px 0 10px}.chat-welcome p{color:var(--muted)}
.chat-suggestions{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin-top:26px}.chat-suggestions button{font-size:13px;font-weight:500}
.chat-message{max-width:86%;margin-bottom:24px}.chat-author{display:block;font-size:11px;color:var(--muted);margin:0 0 7px 2px}.chat-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;font-size:15px}
.from-user{margin-left:auto}.from-user .chat-author{text-align:right}.from-user .chat-text{border-radius:18px 18px 4px 18px;background:#eff3f7;padding:12px 17px;color:#122944}
.from-assistant{margin-right:auto;padding:2px}.chat-wait{font-size:13px;color:var(--muted);padding:12px 0}
.chat-composer-area{margin-top:auto;padding-top:14px;background:white;flex:none}.chat-input-label{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}
.chat-input-wrap{display:flex;align-items:flex-end;gap:10px;border:1px solid #d6e0e9;border-radius:20px;padding:10px;background:#fff;box-shadow:0 3px 16px #10294408}
.chat-input-wrap:focus-within{border-color:#315578;box-shadow:0 0 0 2px #31557812}.chat-input-wrap textarea{resize:none;max-height:160px;min-height:55px;border:0;background:transparent;padding:7px 6px;outline:0;box-shadow:none;flex:1;width:0;margin:0;font-size:15px}.chat-input-wrap textarea:focus-visible{outline:none}
.chat-send{width:39px;height:39px;min-height:39px;padding:8px;border-radius:12px;flex:none}.chat-send svg{width:22px;height:22px;display:block}
.chat-context{display:flex;align-items:center;gap:7px;margin:12px 4px 5px;font-size:12px;color:var(--muted)}.chat-context input{width:15px;height:15px;min-height:0;padding:0;margin:0;accent-color:#122944}
.chat-caption{color:var(--muted);font-size:11px;margin:0 4px}.chat-connection{padding:9px 12px;margin-bottom:12px;font-size:13px;color:#586778;background:#f4f6f9;border-radius:10px}
#chat-error{font-size:13px;margin:8px 4px}
@media(max-width:620px){nav button[data-page="intelligence"]{min-width:139px;font-size:12px;flex:0 0 auto}.chat-shell{height:calc(100dvh - 165px);min-height:430px}.chat-header{padding:8px 0 15px}.chat-identity h2{font-size:20px}.chat-transcript{min-height:0;padding:18px 0}.chat-welcome{margin:20px auto 26px}.chat-message{max-width:94%}.chat-input-wrap textarea{font-size:16px}.chat-suggestions{gap:6px}.chat-suggestions button{font-size:12px;padding:8px 10px}.chat-caption{font-size:10px}}
@media(max-width:620px){nav{overflow-x:auto;justify-content:flex-start}nav button{min-width:52px;flex:1 0 52px;white-space:nowrap}nav button[data-page="intelligence"]{min-width:139px;flex:0 0 auto}}

/* Balanced brand and compact subscription cards. */
.identity{text-decoration:none;gap:10px;color:inherit;border-radius:6px}
.identity:focus-visible{outline:2px solid #284e7c;outline-offset:5px}
.brand-icon{width:40px;height:40px}.brand-icon img{width:96px;height:96px}
.wordmark{font-size:clamp(16px,2.1vw,21px);font-weight:500;letter-spacing:-.025em;line-height:1.2}
.subscription-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:20px 0}
.subscription-plan{position:relative;border:1px solid #dce2e9;border-radius:16px;padding:24px;display:flex;flex-direction:column;align-items:flex-start}
.subscription-plan h4{margin:0 0 12px;font-size:17px;font-weight:500}.subscription-plan.annual{border-color:#9bafc5;background:#f7f9fc}
.discount-badge{position:absolute;right:16px;top:16px;padding:4px 9px;background:#e8f5ee;color:#197248;border-radius:20px;font-size:12px;font-weight:600}
.compare-price{min-height:22px;color:#7c8796;font-size:14px}.subscription-price{font-size:32px;font-weight:500;letter-spacing:-.035em}.subscription-price span{font-size:23px}
.subscription-plan .muted{margin:4px 0}.subscription-plan .saving{font-size:13px;margin:16px 0 20px}.subscription-plan.annual .saving{color:#197248;font-weight:500}.subscription-plan button{margin-top:auto}
.expense-item{position:relative;overflow:clip;touch-action:pan-y}.expense-content{position:relative;background:white;transition:transform .18s ease}.expense-content .row{overflow:visible}.expense-item.revealed .expense-content{transform:translateX(-90px)}
.expense-delete{position:absolute;right:0;top:0;bottom:0;width:90px;border:0;border-radius:0;background:#ad2738;color:white;font-size:12px}.expense-menu{display:inline-block;position:relative;margin-left:12px;text-align:left}.expense-menu summary{cursor:pointer;list-style:none;padding:6px 10px;font-size:22px;line-height:1}.expense-menu summary::-webkit-details-marker{display:none}.expense-menu[open]{z-index:5}.expense-menu .danger{position:absolute;right:0;bottom:100%;min-width:150px;color:#a32536;background:white;box-shadow:0 4px 20px #102b4920;z-index:6}.expense-item:has(details[open]){overflow:visible}
@media(max-width:620px){.brand-icon{width:32px;height:32px}.brand-icon img{width:77px;height:77px}.wordmark{font-size:clamp(13px,3.5vw,18px);font-weight:500}.identity{gap:7px}.subscription-plan{padding:20px 16px}.subscription-price{font-size:28px}}
@media(max-width:420px){.subscription-grid{grid-template-columns:1fr}.subscription-plan{padding:22px}}
@media(prefers-reduced-motion:reduce){.expense-content{transition:none}}

.signin-link{display:block;text-align:center;text-decoration:none;padding:14px;border-radius:12px;background:#082343;color:#fff}
