/* PennyTrack lane/oldbrand (client decision 20 Nov): the OLD brand look lives in app.css/cloud.css (restored from V1) + oldbrand.css. This file keeps ONLY the v2 functional/layout pieces. */
/* tables on phones */
.tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;}

/* help, tour, modals */

/* sub-tabs inside a consolidated destination */
.subtabs{display:flex;gap:var(--space-1);flex-wrap:wrap;border-bottom:1px solid var(--color-border);margin:0 0 var(--space-6);}
.subtab{border:none;background:none;font:inherit;font-size:var(--fs-small);font-weight:500;color:var(--color-text-muted);padding:0 var(--space-4);min-height:44px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:calc(var(--space-1) * -1);}
.subtab:hover{color:var(--color-text);}
.subtab.active{color:var(--color-primary);font-weight:600;border-bottom-color:var(--color-accent);}

/* overview */
.ov-hero{background:var(--color-surface-feature);border-radius:var(--radius-xl);padding:var(--space-8);display:flex;justify-content:space-between;gap:var(--space-6);flex-wrap:wrap;align-items:flex-end;}
.ov-hero .l{font-size:var(--fs-small);color:var(--color-text);font-weight:500;}
.ov-hero .amt{font-size:var(--text-3xl);font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;margin:var(--space-1) 0;}
.ov-hero .amt.neg{color:var(--color-danger)!important;}
.ov-hero .s{font-size:var(--fs-small);color:var(--color-text);}
.ov-status{font-size:var(--fs-small);color:var(--color-text-muted);margin:0 0 var(--space-4);display:flex;gap:var(--space-2);align-items:center;flex-wrap:wrap;}
.ov-att{display:grid;gap:var(--space-3);}
.ov-att .it{display:flex;gap:var(--space-3);align-items:flex-start;justify-content:space-between;padding:var(--space-3) var(--space-4);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);flex-wrap:wrap;}
.ov-att .it .li{color:var(--color-warning);margin-top:var(--space-1);flex:none;}
.ov-att .it.bad .li{color:var(--color-danger);}
.ov-att .it .tx{flex:1 1 220px;font-size:var(--fs-small);}
.ov-rank{display:grid;gap:var(--space-3);}
.ov-rank .r{display:grid;grid-template-columns:minmax(110px,1fr) 2fr auto auto;gap:var(--space-3);align-items:center;font-size:var(--fs-small);}
.ov-rank .r .b{height:8px;border-radius:99px;background:var(--color-surface-muted);overflow:hidden;} .ov-rank .r .b i{display:block;height:100%;border-radius:99px;background:var(--color-chart-spend);}
.ov-rank .r .v{font-variant-numeric:tabular-nums;font-weight:500;text-align:right;} .ov-rank .r .p{color:var(--color-text-muted);font-variant-numeric:tabular-nums;min-width:40px;text-align:right;}
.ov-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-5);}
.ov-quick{display:flex;gap:var(--space-3);flex-wrap:wrap;margin-top:var(--space-8);}

/* brand: logo */
.logo-h{display:inline-flex;align-items:center;text-decoration:none;}
.logo-h img{display:block;height:40px;width:auto;border-radius:8px;}

/* mobile shell */
.m-head,.tabbar,.qa-sheet{display:none;}
.li{vertical-align:-3px;flex:none;}
@media (max-width:900px){
  .main{padding:calc(var(--space-12) + var(--space-2) + env(safe-area-inset-top)) var(--space-4) calc(var(--space-20) + var(--space-2) + env(safe-area-inset-bottom));}
  .m-head{display:flex;position:fixed;top:0;left:0;right:0;z-index:35;height:calc(var(--space-12) + var(--space-2) + env(safe-area-inset-top));padding:env(safe-area-inset-top) var(--space-2) 0;align-items:center;justify-content:space-between;background:var(--side-bg);color:var(--side-ink);border-bottom:none;}
  .m-head button{width:44px;height:44px;border:none;background:none;color:var(--side-ink);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;border-radius:var(--radius-md);}
  .burger{display:none!important;}
  .tabbar{display:grid;grid-template-columns:repeat(4,1fr);position:fixed;left:0;right:0;bottom:0;z-index:35;background:var(--color-canvas);border-top:1px solid var(--color-border);padding:var(--space-1) var(--space-2) calc(var(--space-1) + env(safe-area-inset-bottom));}
  .tabbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);min-height:52px;border:none;background:none;color:var(--color-text-muted);font:inherit;font-size:var(--fs-meta);font-weight:500;cursor:pointer;border-radius:var(--radius-md);}
  .tabbar button .li{color:currentColor;}
  .tabbar button.on{color:var(--color-primary);font-weight:600;}
  .tabbar button.add .pl{width:44px;height:44px;border-radius:50%;background:var(--color-primary);color:var(--hc-fff);display:inline-flex;align-items:center;justify-content:center;margin-top:calc(var(--space-4) * -1);box-shadow:var(--shadow-raised);}
  .qa-sheet{position:fixed;inset:0;z-index:60;align-items:flex-end;}
  .qa-sheet.open{display:flex;}
  .qa-sheet .ov{position:absolute;inset:0;background:rgba(36,53,56,.45);}
  .qa-sheet .sh{position:relative;width:100%;background:var(--color-surface);border-radius:var(--radius-2xl) var(--radius-2xl) 0 0;padding:var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));box-shadow:var(--shadow-modal);display:grid;gap:var(--space-2);}
  .qa-sheet .sh h3{margin:0 0 var(--space-2);font-size:var(--fs-h3);}
  .qa-sheet .sh button.qa{display:flex;gap:var(--space-3);align-items:center;min-height:52px;border:1px solid var(--color-border);background:var(--color-surface);border-radius:var(--radius-md);font:inherit;font-size:var(--fs-body);font-weight:500;padding:0 var(--space-4);cursor:pointer;color:var(--color-text);text-align:left;}
  .qa-sheet .sh button.qa .li{color:var(--color-primary);}
  .sidebar{width:min(300px,86vw);box-shadow:none;z-index:50;}
  .sidebar.open{box-shadow:var(--shadow-modal);}
  .scrim.show{z-index:45;background:rgba(36,53,56,.45);}
  .topbar{padding:var(--space-5) 0 var(--space-3);}
  .greeting{display:none;}
  .ov-two{grid-template-columns:1fr;}
  .ov-hero{padding:var(--space-5);} .ov-hero .amt{font-size:var(--fs-money);}
  .ov-rank .r{grid-template-columns:1fr auto auto;} .ov-rank .r .b{grid-column:1/-1;order:3;}
  .sel.loc{display:none;}
  h1.page-title{font-size:var(--fs-h1);}
  .g4{grid-template-columns:1fr 1fr;}
}
@media (max-width:560px){
  .kpi .v{font-size:var(--fs-money);}
  .g4{grid-template-columns:1fr;}
  .card{padding:var(--space-4);}
  .section{margin-top:var(--space-8);}
}
@media (max-width:359px){ .main{padding-left:var(--space-3);padding-right:var(--space-3);} }
@media (max-width:900px){ #toast{bottom:calc(76px + env(safe-area-inset-bottom))!important;} }
html{scroll-padding-top:72px;scroll-padding-bottom:88px;}
body{overflow-x:hidden;}

/* fixes after first render */
.mode-sw button{display:flex;align-items:center;justify-content:center;gap:var(--space-2);}
.nav-toggle{position:absolute;top:var(--space-5);right:var(--space-2);width:40px;height:40px;}
@media (min-width:901px){ .sidebar{position:sticky;} } /* desktop only: on phones the sidebar is a fixed off-canvas drawer (app.css 900px rule) */
.demo-note{align-items:center;gap:var(--space-3);flex-wrap:wrap;}
.demo-note .tx{flex:1 1 240px;}
.ov-goal{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);font-weight:600;flex-wrap:wrap;}
.ov-goal .nm{display:flex;align-items:center;}
@media (max-width:560px){ .demo-note .btn{width:100%;} .ov-hero .btn{width:100%;} }
.stepper{min-height:48px;} .stepper button,.stepper .st-lbl{min-height:44px;height:44px;}
@media (max-width:900px){ .cell,.card input[type=text],.card input[type=number],.card input[type=date],.card select{min-height:44px;} .nav-toggle{display:none;} }

/* country picker + chip (Phase 2) */
.country-chip{display:inline-flex;align-items:center;gap:var(--space-2);min-height:44px;padding:0 var(--space-3);cursor:pointer;font:inherit}
.country-chip .cc-cur{color:var(--color-text-muted)}
.country-grid{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-3)}
.country-card{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-2);text-align:left;padding:var(--space-4);border:1px solid var(--color-border-strong);border-radius:var(--radius-lg);background:var(--color-surface);color:var(--color-text);font:inherit;cursor:pointer;min-height:44px}
.country-card:hover,.country-card.on{border-color:var(--color-accent);box-shadow:0 0 0 2px var(--color-accent)}
.country-card span{font-size:var(--fs-small);color:var(--color-text-muted)}
@media(max-width:480px){.country-grid{grid-template-columns:1fr}}

/* Phase 2 fixes */
/* (a) the sidebar colour runs the full page height: the grid column itself carries the background, the sticky sidebar sits on top */
@media (min-width:901px){
  .app{position:relative;}
  .app::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var(--sidebar-w,var(--sidebar-width));background:var(--side-bg);z-index:0;transition:width .2s ease;}
  body.nav-min .app::before{width:72px;}
  .sidebar{z-index:40;}
}
/* (c) names in the planned-costs tables are never cut: the name column takes the free width, amounts stay narrow */
.tbl input.cell[type=text]{min-width:11ch;width:100%;text-overflow:ellipsis;}
.tbl td:first-child{min-width:150px;}
.tbl input.cell.num{min-width:64px;}
.how-calc summary{cursor:pointer;font-weight:600;min-height:44px;display:flex;align-items:center;}
.how-calc{margin:0;}
.pro-lines td.r{width:1%;white-space:nowrap}.pro-lines input.cell.num{width:76px}.pro-lines td:first-child{min-width:190px}
.start-grid{display:grid;gap:var(--space-3)}.start-grid .country-card{flex-direction:column}
/* editable names are never cut off (B-10/E-10): the cell is as wide as the longest usual label; tables scroll inside their wrapper, not the page */
.tbl input.cell[type=text],td input.cell[type=text]{min-width:38ch;}
.tbl td:first-child{min-width:0;}
.pocket .top{flex-wrap:wrap;gap:var(--space-2)}.pocket .top>div[style*='flex:1']{flex:1 1 100% !important;min-width:0}.pocket input.cell[type=text]{width:100%}
.tbl.pro-lines td input.cell[type=text]:not(.num){min-width:14ch}.tbl.pro-lines td:first-child{min-width:0}.tbl.pro-lines td input.cell.num{min-width:84px;width:84px}
/* R3f: opacity .8/.85 pushed muted text under 4.5:1 */
.help-btn{opacity:1;}
.bk-foot{opacity:1;}

/* B-02: every figure in the app shell uses tabular numerals (bold figures, negative spans, table headers, chart text) */
main,#sidebar,#tabbar,.tbl{font-variant-numeric:tabular-nums;}
svg text{font-variant-numeric:tabular-nums !important;}
/* pocket icon picker (icons shown as line icons, never as words) */
.ic-pick{display:inline-flex;gap:var(--space-1);flex-wrap:wrap;align-items:center}
.ic-pick .ic-opt{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--color-border);border-radius:var(--radius-md,8px);background:var(--color-surface,var(--hc-fff));color:var(--color-text-muted,var(--hc-555));cursor:pointer}
.ic-pick .ic-opt.on{border-color:var(--color-primary);color:var(--color-primary);background:var(--color-primary-soft,rgba(0,0,0,.04))}

/* lane/calc: "How we got this" disclosure under a figure */
details.how{margin-top:var(--space-2);font-size:var(--text-xs,12px);font-weight:400;color:var(--ink-soft)}
details.how>summary{cursor:pointer;color:var(--ink-soft);text-decoration:underline;text-underline-offset:2px;list-style:none;min-height:24px;display:inline-flex;align-items:center}
details.how>summary::-webkit-details-marker{display:none}
details.how>p{margin:var(--space-1) 0 0;line-height:1.45}
.how-card .tbl td{padding:var(--space-2) var(--space-3)}
/* Dark mode: V1 night look, flat solid surfaces (no blur/gradients) so contrast is real and measurable */
html[data-theme=dark] body{background:var(--color-canvas);}
html[data-theme=dark] :is(.card,.stepper,.sel.loc,.note){background:var(--color-surface)!important;backdrop-filter:none;-webkit-backdrop-filter:none;border-color:var(--color-border)!important;}
html[data-theme=dark] .card .card,html[data-theme=dark] .card.flat{background:var(--color-surface-muted)!important;}
html[data-theme=dark] .btn.primary,html[data-theme=dark] .tab.active,html[data-theme=dark] .tabbar button.add .pl,html[data-theme=dark] .qa-sheet .sh button.qa .li{color:var(--hc-0e1112)!important;}
html[data-theme=dark] .qa-sheet .sh button.qa .li{color:var(--color-primary)!important;}
html[data-theme=dark] .btn.primary:hover{color:var(--hc-0e1112)!important;}
html[data-theme=dark] .bar>i.over{background:var(--color-danger);}
html[data-theme=dark] #tip{background:var(--color-text);color:var(--color-canvas);}

/* nav counters: a warning symbol marks an alert; clicking jumps to the section and highlights it */
.nav-badge.alert .li{color:inherit;}
@keyframes ptHl{0%,60%{box-shadow:0 0 0 3px var(--color-warning)}100%{box-shadow:0 0 0 0 transparent}}
.hl{animation:ptHl 2.4s ease-out;border-radius:var(--radius-md);}
@media (prefers-reduced-motion:reduce){.hl{animation:none;box-shadow:0 0 0 3px var(--color-warning);}}
/* error banner: warning + message, then the retry button on its own line on a phone */
.err-banner .note{flex-wrap:wrap;align-items:flex-start;gap:var(--space-3);}
.err-banner .note .tx{flex:1 1 220px;}
@media (max-width:560px){ .err-banner .note{flex-wrap:nowrap;align-items:center;} .err-banner .note .btn{flex:0 0 auto;} }

/* lane/mobile 19 Nov: phone = the key content in the first screen (V1 look, colours and fonts unchanged) */
.ph-flow{display:flex;flex-direction:column}.ph-first{order:-1}.ph-late{order:1}.ec-sum-ph{display:none} /* PE-0230: the pockets (key block) come before the safety-cushion questions on desktop too */
@media (max-width:900px){
  .main{padding-top:calc(var(--space-12) + env(safe-area-inset-top));}
  .topbar{padding:var(--space-3) 0 var(--space-2);}
  .topbar>div:first-child{display:block;}
  h1.page-title{font-size:24px;line-height:1.15;}
  .page-sub{margin:2px 0 0;font-size:13px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;}
  .controls{margin-top:var(--space-2);}
  .stepper{min-height:44px;padding:2px;} .stepper button,.stepper .st-lbl{min-height:40px;height:40px;}
  .section{margin-top:var(--space-5);}
  .subtabs{margin:0 0 var(--space-3);overflow-x:auto;flex-wrap:nowrap;white-space:nowrap;}
  .subtab{padding:0 var(--space-3);}
  /* sample-data banner: one compact line */
  .demo-note{padding:var(--space-2) var(--space-3);gap:var(--space-2);flex-wrap:nowrap;margin-bottom:var(--space-3);}
  .demo-note .ic,.demo-note .dn-long{display:none;}
  .demo-note .tx{flex:1 1 auto;min-width:0;}
  .demo-note .tx .chip{margin-right:0!important;}
  .demo-note .btn{width:auto;min-height:44px;flex:none;}
  /* compact 2-column KPI grids */
  .g3,.g4{grid-template-columns:1fr 1fr!important;gap:var(--space-3);}
  .g3>.kpi:last-child:nth-child(odd){grid-column:1/-1;}
  .kpi{padding:var(--space-3);}
  .kpi .v{font-size:20px;} .kpi .l{font-size:12px;} .kpi .d{font-size:12px;}
  .ov-hero{padding:var(--space-4);gap:var(--space-3);} .ov-hero .amt{font-size:30px;}
  .ov-status{margin:0 0 var(--space-2);font-size:12px;}
  /* goals: progress first, the safety-cushion questionnaire after it */
  .ph-flow{display:flex;flex-direction:column;} .ec-sum-ph{display:block;order:-2;margin-bottom:var(--space-4)} .ph-first{order:-1;} .ph-late{order:1;}
}
@media (max-width:560px){ .g3>.kpi:last-child:nth-child(odd){grid-column:auto;} .g3>.kpi:last-child:nth-child(odd){grid-column:1/-1;} }
@media (max-width:900px){ .sec-head h2{font-size:20px;} .sec-head{margin-bottom:var(--space-2);} }
@media (max-width:900px){
  h1.page-title{hyphens:none;-webkit-hyphens:none;overflow-wrap:normal;}
  h1.page-title .help-btn{white-space:nowrap;margin-left:4px;}
  .card select,.card .sel{width:100%;max-width:100%;font-size:14px;text-overflow:ellipsis;}
  .form-row select{flex:1 1 100%;}
}
@media (max-width:900px){ .form-row label.lbl{flex:1 1 100%;min-width:0;} }
@media (max-width:900px){ .subtab{flex:none;} }
@media (max-width:900px){
  .demo-note .tx{flex:none;} .demo-note .tx .chip{white-space:nowrap;}
  .demo-note .btn{flex:1 1 auto;white-space:normal;line-height:1.2;padding:0 var(--space-3);font-size:13px;}
  .card select{padding-left:10px;padding-right:6px;font-size:13px;}
}

/* R2 fix 8: phone income rows show name, type AND amount on one card row */
@media(max-width:700px){
  .tbl-income thead{display:none}
  .tbl-income tbody tr{display:grid;grid-template-columns:1fr 112px 36px;grid-template-areas:'n n x' 'k a a';gap:6px 8px;padding:10px 0;border-bottom:1px solid var(--line)}
  .tbl-income tbody td{display:block;padding:0;border:0}
  .tbl-income .in-name{grid-area:n}.tbl-income .in-kind{grid-area:k}.tbl-income .in-amt{grid-area:a;text-align:left}
  .tbl-income tbody td:last-child{grid-area:x;text-align:right}
  .tbl-income .cell,.tbl-income select.cell{width:100%;min-height:44px;box-sizing:border-box}
  .tbl-income tfoot td{display:inline-block;padding:10px 0}
}
@media(max-width:700px){.tbl-income tfoot tr{display:flex;justify-content:space-between;align-items:center}.tbl-income tfoot td{padding:10px 0}}

/* annual totals: one month at a time on phones, the full table collapsed */
.yt-phone{display:none}
@media (max-width:820px){ .yt-phone{display:block;margin-bottom:var(--space-3)} .yt-det>summary{cursor:pointer;font-weight:700;min-height:44px;display:flex;align-items:center;color:var(--color-primary)} }
@media (min-width:821px){ .yt-det>summary{display:none} }
.ytm-h{font-size:var(--text-xs);color:var(--ink-soft);margin:var(--space-3) 0 var(--space-1)}
.ytm-row{display:flex;justify-content:space-between;gap:var(--space-3);padding:var(--space-2) 0;border-bottom:1px solid var(--color-border,var(--hc-e5e0d6));min-height:40px;align-items:center}
.ytm-row.b{font-weight:800}
.card.ob .bar{height:10px}
.yt-phone select{font:inherit;font-size:var(--text-sm);width:100%;min-height:44px;padding:var(--space-2) var(--space-3);border:1px solid var(--line-2);border-radius:12px;background:var(--surface);color:var(--ink);margin-top:var(--space-1)}


/* kept from the v2 app.css rewrite */
.tr-prog{height:4px;border-radius:4px;background:var(--color-border,var(--hc-e5e0d6));margin:0 0 var(--space-2);overflow:hidden}.tr-prog i{display:block;height:100%;background:var(--accent)}
.tr-foot>span:first-child{font-size:var(--text-sm);font-weight:700;color:var(--ink)}
body:has(#tour-root .tr-ov) #pt-consent{display:none}
/* PE-0066/0086: phone income grid never forces the page wider (FR 320): inputs shrink inside the grid cell */
@media(max-width:700px){.tbl-income td{min-width:0}.tbl-income input.cell[type=text],.tbl-income input.cell.num,.tbl-income select.cell{min-width:0;width:100%}.tbl-income tbody tr{grid-template-columns:minmax(0,1fr) minmax(0,112px) 36px}}
@media(max-width:700px){.stat-row.three .s .l{white-space:normal;overflow-wrap:anywhere;font-size:10px}.stat-row.three .s .v{font-size:14px;overflow-wrap:anywhere}}
/* PE-0250 grouped unresolved actions */
.ov-groups{gap:var(--space-5);}
.ov-grp{display:grid;gap:var(--space-2);}
.ov-grp-h{display:flex;align-items:center;gap:var(--space-2);margin:0;font-size:var(--fs-small);font-weight:700;color:var(--color-text-muted);}
.ov-grp-n{font-family:var(--font-mono),monospace;font-variant-numeric:tabular-nums;font-size:14px;padding:1px 8px;border-radius:999px;background:var(--color-surface-muted);color:var(--color-text);}
