/* StroyKalk v472 — container-aware layout and stage navigation */
#calculator,#calculator *{box-sizing:border-box}
#calculator :where(section,article,aside,div,label,fieldset,form,[class*="grid"],[class*="card"],[class*="panel"],[class*="controls"],[class*="live"],[class*="report"],[class*="result"],[class*="summary"]){min-width:0}
#calculator :where(h1,h2,h3,h4,h5,h6,p,li,label,legend,b,strong,small,span,button,a,th,td,summary){word-break:normal;overflow-wrap:break-word;hyphens:none}
#calculator :where([class*="choice"],[class*="layout-card"],[class*="type-card"],[class*="scheme"],[class*="mode-card"],[class*="option-card"]) :where(b,strong,small,span,p){white-space:normal;word-break:normal!important;overflow-wrap:normal!important;hyphens:none!important}
#calculator :where(input,select,textarea,button){min-width:0;max-width:100%}
#calculator :where(img,picture,video,svg,canvas){max-width:100%}
#calculator .calc-adaptive-grid-v143{width:100%;max-width:100%}
#calculator .calc-adaptive-grid-v143>*{min-width:0!important;max-width:100%}
#calculator .calc-adaptive-grid-v143>:where(button,label,article,div){overflow-wrap:break-word;word-break:normal}
#calculator .calc-text-wrap-v143{white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important;hyphens:none!important;min-width:0!important;max-width:100%!important}
#calculator :where(.table-wrap,.table-scroll-v173,[class*="table-wrap"],[class*="table-scroll"],[class*="report-table-wrap"]){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
#calculator .ledger-tabs-wrap-v142,#calculator .ledger-tabs-v142{max-width:100%;min-width:0}
#calculator .ledger-tabs-v142 button{min-width:0}

/* Stage cards: always wrap as a grid. The runtime chooses the column count
   from the actual calculator container width and never allows a carousel. */
#calculator .calc-stage-responsive-v472{
  display:grid!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  grid-auto-flow:row!important;
  overflow:visible!important;
  overflow-x:visible!important;
  overflow-y:visible!important;
  scroll-snap-type:none!important;
  -webkit-overflow-scrolling:auto!important;
  box-sizing:border-box!important;
  align-items:stretch!important;
}
#calculator .calc-stage-responsive-v472>:where(button,[role="tab"],a){
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  flex:none!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  hyphens:none!important;
  overflow:visible!important;
  text-overflow:clip!important;
  box-sizing:border-box!important;
  scroll-snap-align:none!important;
  line-height:1.2!important;
}
#calculator .calc-stage-responsive-v472>:where(button,[role="tab"],a) :where(b,strong,small){
  max-width:100%!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  hyphens:none!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
#calculator .calc-stage-responsive-rich-v472>:where(button,[role="tab"],a){min-height:72px!important}

@media(max-width:767px){
  html{scroll-padding-top:72px}
  #calculator :where(input,select,textarea){font-size:16px!important}
  #calculator :where(button,[role="button"],summary){min-height:42px}
  #calculator :where([class*="choice"],[class*="layout-card"],[class*="type-card"],[class*="mode-card"]) :where(b,strong){line-height:1.24}
  #calculator :where([class*="choice"],[class*="layout-card"],[class*="type-card"],[class*="mode-card"]) :where(small,p){line-height:1.38}
  #calculator :where([class*="actions"],[class*="step-actions"]){max-width:100%}
  #calculator .calc-stage-responsive-v472{gap:7px!important}
  #calculator .calc-stage-responsive-v472>:where(button,[role="tab"],a){padding-left:10px!important;padding-right:10px!important}
}
@media(max-width:370px){
  #calculator .calc-stage-responsive-v472{grid-template-columns:1fr!important}
}
@media(max-width:420px){#calculator :where(.ledger-tabs-v142 button){max-width:86vw}}
@media print{.calc-text-wrap-v143{white-space:normal!important}}

/* CSS safety net for modern browsers: even before the runtime controller
   initializes, a stage navigation with 3+ direct stage buttons cannot become
   a one-line horizontal carousel. Runtime JS will subsequently choose a more
   balanced column count. */
@supports selector(:has(> button:nth-of-type(3))){
  #calculator :where([class*="stagebar"],[class*="stage-nav"],[class*="stage-tabs"],[class*="stepper"]):has(> button:nth-of-type(3)){
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(min(100%,178px),1fr))!important;
    grid-auto-flow:row!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow:visible!important;
    overflow-x:visible!important;
    scroll-snap-type:none!important;
  }
  #calculator :where([class*="stagebar"],[class*="stage-nav"],[class*="stage-tabs"],[class*="stepper"]):has(> button:nth-of-type(3))>button{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    flex:none!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }
  #calculator :where([class*="stagebar"],[class*="stage-nav"],[class*="stage-tabs"],[class*="stepper"]):has(> button:nth-of-type(3))>button :where(b,strong,small){
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    overflow-wrap:break-word!important;
    word-break:normal!important;
  }
}
