/* v0.9.37: scoped finance geometry. No changes to financial values or formulas. */
#tab-finance {min-width:0;max-width:100%;}
#tab-finance :is(.finance-settings-card,.finance-subtab-panel,.sub-card,.finance-source-calc-card,.finance-calc-details-body,.finance-inline-details,.finance-inline-details-body) {min-width:0;max-width:100%;box-sizing:border-box;}
#tab-finance .fin37-frame {min-width:0;width:100%;max-width:100%;box-sizing:border-box;margin:12px 0;}
#tab-finance .fin37-tools {display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:8px;min-width:0;}
#tab-finance .fin37-caption {font-size:12px;color:var(--muted);flex:1 1 220px;min-width:0;overflow-wrap:anywhere;}
#tab-finance .fin37-tools .button {flex:0 0 auto;min-height:36px;white-space:normal;}
#tab-finance .fin37-scroll {position:relative;isolation:isolate;overflow:auto;min-width:0;max-width:100%!important;width:100%!important;box-sizing:border-box;padding:0!important;scroll-padding:0;overscroll-behavior:contain;}
#tab-finance .fin37-table {border-collapse:separate;border-spacing:0;margin:0!important;}
#tab-finance .fin37-table thead th {position:sticky;top:0;z-index:4;background:#f2f3f4;background-clip:border-box;}
#tab-finance .fin37-table .fin37-frozen {position:sticky;left:0;z-index:3;background:#fff;background-clip:border-box;box-shadow:1px 0 0 #dce0e3;}
#tab-finance .fin37-table thead .fin37-frozen {z-index:8;background:#f2f3f4;}
#tab-finance .fin37-table tr:is(.finance-source-total-row,.finance-total-row,.strong-row,.total-row) .fin37-frozen {background:#fff0b0;}
#tab-finance .fin37-table tr.future-rate-row .fin37-frozen {background:#fff7dd;}
#tab-finance .fin37-table tr.warning-row .fin37-frozen {background:#fff8e6;}
#tab-finance .finance-rate-source-header th[data-rate-group] {background:#222;color:#fff;}
#tab-finance .finance-rate-subgroup-header th[data-rate-group] {background:#f4e7b0;color:#4f3e00;}
#tab-finance .finance-rate-field-header th[data-rate-group] {background:#fff8dd;}
/* Headers of lower rate rows must not freeze horizontally in the Period column. */
#tab-finance .fin37-table .finance-rate-subgroup-header th,
#tab-finance .fin37-table .finance-rate-field-header th {left:auto;}
#tab-finance .finance-rate-table-scroll {max-height: min(560px,65vh);border:1px solid var(--border);border-radius:9px;}
#tab-finance .finance-rates-section {padding-right:18px;}
#tab-finance .finance-rate-add-year-rail {position:static;transform:none;writing-mode:horizontal-tb;flex-direction:row;min-height:38px;width:auto;padding:8px 14px;border-radius:8px;box-shadow:none;}
#tab-finance .finance-rate-group-toolbar {margin-top:12px;}
#tab-finance .fin37-add-tools {display:flex;align-items:center;gap:12px;justify-content:flex-end;flex-wrap:wrap;margin:12px 0;}
#tab-finance .finance-parameter-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:16px 14px;align-items:start;}
#tab-finance .finance-parameter-grid .finance-param-field {min-width:0;max-width:100%;}
#tab-finance .finance-param-field > .finance-param-label-line {height:auto!important;display:flex;align-items:flex-end;gap:8px;line-height:1.35;overflow-wrap:anywhere;box-sizing:border-box;}
#tab-finance .finance-param-label-line > span {min-width:0;flex:1;}
#tab-finance .finance-param-field :is(input,select) {box-sizing:border-box;min-width:0;width:100%;}
#tab-finance .finance-param-help {flex:0 0 auto;}
#tab-finance .fin37-disclosure-label {margin-left:auto;flex:0 0 auto;font-size:12px;font-weight:700;color:#986800;white-space:nowrap;}
#tab-finance :is(.finance-calc-details,.finance-inline-details) > summary {display:flex;align-items:center;gap:12px;flex-wrap:wrap;cursor:pointer;}
#tab-finance .finance-calc-chevron {display:none;}
#tab-finance .fin37-dialog {padding:0;border:1px solid #d0d4d8;border-radius:12px;max-width:none;max-height:none;width:calc(100vw - 24px);height:calc(100dvh - 24px);box-sizing:border-box;margin:auto;box-shadow:0 14px 50px #0004;background:#fff;color:var(--text,#303338);}
#tab-finance .fin37-dialog[open] {display:flex;flex-direction:column;}
#tab-finance .fin37-dialog::backdrop {background:#2229;}
#tab-finance .fin37-dialog-head {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-bottom:1px solid #dce0e3;background:#fff9e9;flex:0 0 auto;}
#tab-finance .fin37-dialog-head strong {min-width:0;overflow-wrap:anywhere;}
#tab-finance .fin37-dialog-body {flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;padding:0 16px 16px;}
#tab-finance .fin37-dialog-body > .fin37-frame {flex:1;display:flex;flex-direction:column;min-height:0;margin:10px 0 0;}
#tab-finance .fin37-dialog .fin37-scroll {flex:1 1 0;min-height:0;max-height:none!important;}
#tab-finance .fin37-dialog .fin37-expand {display:none;}
#tab-finance .fin37-dialog #financeRateScheduleCard {display:flex;flex-direction:column;flex:1;min-height:0;margin:0;padding:12px 0 0;}
#tab-finance .fin37-dialog #financeRateScheduleCard > .fin37-frame {flex:1;min-height:100px;display:flex;flex-direction:column;margin-bottom:0;}
body.fin37-modal-open {overflow:hidden!important;}
/* Keep add-year child dialog within the viewport and above the fullscreen table. */
#financeRateYearDialog {width:min(560px,calc(100vw - 32px));max-width:none;box-sizing:border-box;}
#financeRateYearDialog .dialog-content {width:100%;min-width:0;max-width:100%;box-sizing:border-box;}
@media(max-width:1400px){#tab-finance .finance-parameter-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media(max-width:1000px){#tab-finance .finance-parameter-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:640px){#tab-finance .finance-parameter-grid{grid-template-columns:minmax(0,1fr);}#tab-finance .fin37-dialog-head{flex-wrap:wrap;}#tab-finance .fin37-caption{flex-basis:120px;}}

body.fin37-active {min-width:0;}
