/* Loans polish: measured fixes from deliverables/loans-polish-review, numbered as in its REVIEW.md. */

/* 1. "Coming up" is a plain card: surface, hairline, 20px corners, 16px padding (it had a beige fill and an amber edge). */
html[data-theme] .private-workspace .private-reminders{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-card);padding:16px;box-shadow:none}

/* 2. Overdue states are soft fills, not red outlines. */
html[data-theme] .private-workspace .private-due-badge.overdue{display:inline-flex;align-items:center;min-height:24px;padding:2px 10px;border:0;border-radius:var(--radius-pill);background:var(--expense-soft);color:var(--expense);white-space:nowrap}
html[data-theme] .private-workspace .private-unpaid-interest.is-overdue{border:0;border-radius:12px;padding:12px 16px;background:color-mix(in srgb,var(--expense-soft) 75%,transparent)}
html[data-theme] .private-workspace .private-unpaid-interest.is-overdue>:first-child{color:var(--expense)}

/* 3. One corner scale: cards 20px, boxes inside them 12px. */
html[data-theme] .private-workspace :is(.private-loan-hero,.private-month-summary,.private-overview,.private-strategy-fold,.private-analytics,.loan-sheet-card,.loan-sheet-table-wrap,.loan-sheet-alloc){border-radius:var(--radius-card)}
html[data-theme] .private-workspace :is(.private-payoff-estimate,.private-unpaid-interest){border-radius:12px}

/* 4, 5. Plan rows ("Best way to pay off", "What if the rate was…", "Plan an EMI loan") are cards with a chevron; one title scale. */
html[data-theme] .private-workspace .private-strategy-fold{background:var(--surface);border:1px solid var(--border);box-shadow:none}
html[data-theme] .private-workspace .private-strategy-fold>summary{position:relative;display:block;padding:16px 44px 16px 16px;font-size:var(--text-lg);font-weight:600;list-style:none;cursor:pointer}
html[data-theme] .private-workspace .private-strategy-fold>summary::-webkit-details-marker{display:none}
html[data-theme] .private-workspace .private-strategy-fold>summary :is(small,.small){display:block;margin-top:2px;font-size:var(--text-sm);font-weight:400}
html[data-theme] .private-workspace .private-month-summary h3{font-size:var(--text-lg);font-weight:600}
html[data-theme] .private-workspace :is(.private-analytics,.private-consolidated details,.private-help)>summary{font-size:var(--text-base);font-weight:500}

/* 6. Detail links read as links: blue-ink with an underline in light, the theme's link colour in dark. */
html[data-theme] .private-workspace :is(.private-history-completeness .text-button,[data-action=private-method],[data-action=private-history-scope]){color:var(--loan-link,color-mix(in srgb,var(--reference-blue) 55%,var(--text)));text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
html:is([data-theme=dark],[data-theme=grey-glass]) .private-workspace :is(.private-history-completeness .text-button,[data-action=private-method],[data-action=private-history-scope]){--loan-link:var(--link)}

/* 8. Repayment breakdown: label left, value right in tabular figures. */
html[data-theme] .private-payment-result>span{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:4px 0;color:var(--muted);font-size:var(--text-sm)}
html[data-theme] .private-payment-result>span>strong{margin:0;padding:0;color:var(--text);font-size:var(--text-base);font-weight:600;font-variant-numeric:tabular-nums;text-align:right}

/* 9. Storage form: a small inline lock, not a boxed button-like square. */
html[data-theme] .private-access-form .private-locked-symbol{width:auto;height:auto;min-height:0;margin:0 0 8px;padding:0;border:0;background:none;box-shadow:none;color:var(--muted)}
html[data-theme] .private-access-form .private-locked-symbol svg{width:20px;height:20px}

/* 10. Light mode keeps its yellow + blue: the Interest by lender icon and chart line use the yellow, not orange. */
:root[data-theme=light]{--sheet-line:#d99a32;--sheet-fill:#ffbb6a3d}

/* 11, 12. Loans content: cards pad 16px so text starts on one edge; one 16px gap between blocks. */
html[data-theme] .private-workspace .private-list-workspace{display:flex;flex-direction:column;gap:16px}
html[data-theme] .private-workspace .private-list-workspace>*{margin-block:0}
html[data-theme] .private-workspace :is(.private-overview,.private-month-summary){padding:16px}
html[data-theme] .private-workspace .private-list-workspace>.private-loan-list{margin-top:-4px}

/* 13. The inline "Review history coverage" link keeps a 44px tap area without stretching its line. */
html[data-theme] .private-history-completeness .text-button{display:inline;position:relative;min-height:0;padding:0;line-height:inherit}
html[data-theme] .private-history-completeness .text-button::after{content:"";position:absolute;inset:-12px -4px}

/* 14. Desktop: Loans gets room for its table. */
@media (min-width:1024px){html[data-theme] dialog:is(.private-workspace,:has(.private-workspace)){width:min(720px,calc(100vw - 64px));max-width:720px}}

/* 16. Not changed: the repayment sheet stays full height on purpose (#editor :has(.private-pay-form) uses --keyboard-height) so the amount field stays above the phone keyboard. */

/* 18. The row -> detail morph runs on the existing flight layer; nothing to style here. */

/* 20. Interest by lender opens and closes on the motion tokens. */
@media (prefers-reduced-motion:no-preference){
 ::view-transition-group(loan-sheet){animation-duration:300ms;animation-timing-function:var(--ease-move)}
 ::view-transition-old(loan-sheet){animation-duration:140ms;animation-timing-function:var(--motion-ease)}
 ::view-transition-new(loan-sheet){animation-duration:200ms;animation-timing-function:var(--motion-ease)}
 /* 21. After a filter change the rows fade up in a short stagger (first six rows). */
 .private-loan-list.is-filtering>.private-loan-row{animation:loans-row-in 200ms var(--motion-ease) both}
 .private-loan-list.is-filtering>.private-loan-row:nth-child(2){animation-delay:20ms}.private-loan-list.is-filtering>.private-loan-row:nth-child(3){animation-delay:40ms}
 .private-loan-list.is-filtering>.private-loan-row:nth-child(4){animation-delay:60ms}.private-loan-list.is-filtering>.private-loan-row:nth-child(5){animation-delay:80ms}
 .private-loan-list.is-filtering>.private-loan-row:nth-child(6){animation-delay:100ms}
}
@keyframes loans-row-in{from{opacity:0;transform:translateY(4px)}}

/* 15. Add loan: Calculation method and EMI under one "More details" disclosure. */
html[data-theme] .private-more-details{margin:4px 0 12px;padding:0 12px;border:1px solid var(--border);border-radius:12px}
html[data-theme] .private-more-details>summary{display:flex;flex-direction:column;justify-content:center;min-height:52px;font-weight:600;cursor:pointer}
html[data-theme] .private-more-details>summary small{color:var(--muted);font-size:var(--text-xs);font-weight:400}
html[data-theme] .private-more-details[open]{padding-bottom:12px}

/* Phone Loans: whole phrases and amounts get room before they wrap. */
@media (max-width:639px){
 html[data-theme] .private-workspace .private-filters>button{padding-inline:4px;gap:4px;white-space:nowrap}
 html[data-theme] .private-workspace .private-search{box-sizing:border-box}
 html[data-theme] .private-workspace .private-search input{font-size:16px}
 html[data-theme] .private-workspace .private-loan-open{grid-template-columns:minmax(0,1fr) 16px;gap:12px}
 html[data-theme] .private-workspace .private-row-name{grid-column:1;grid-row:1}
 html[data-theme] .private-workspace .private-row-amount{grid-column:1;grid-row:2;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;max-width:none;text-align:left}
 html[data-theme] .private-workspace .private-row-chevron{grid-column:2;grid-row:1/3}
 html[data-theme] .private-workspace .private-row-interest{flex-basis:100%;white-space:normal}
 html[data-theme] .private-workspace .private-row-meta{display:flex;flex-wrap:wrap;gap:0 4px}
 html[data-theme] .private-workspace :is(.private-row-meta>.private-rate-band,.private-row-cost){white-space:nowrap}
 html[data-theme] .private-workspace .private-row-name>:is(.private-due-badge,.private-cost-tag){justify-self:start;max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:normal;word-break:normal}
 html[data-theme] .private-workspace .private-card-footer{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
 html[data-theme] .private-workspace .private-row-pay{width:100%;white-space:nowrap}
 html[data-theme] .private-workspace .strategy-options{grid-template-columns:minmax(0,1fr)}
 html[data-theme] .private-workspace .whatif-chart-heading{flex-wrap:wrap}
 html[data-theme] .private-workspace .whatif-chart-heading>div{flex-basis:100%}
 html[data-theme] .private-workspace :is(.private-overview strong,.private-overview-figures dd,.private-row-amount>strong,.private-loan-total,.private-loan-metrics dd,.private-payment-split dd,.private-payment-result strong,.rate-whatif-outcomes dd,.whatif-chart-heading strong,.loan-option-equation strong,.loan-option-outcomes dd,.private-emi-head>strong,.strategy-option strong){white-space:nowrap;overflow-wrap:normal;word-break:normal}
 html[data-theme] .private-workspace :is(.whatif-chart-heading strong,.private-loan-total){font-size:clamp(18px,6vw,28px)}
 html[data-theme] .private-workspace :is(.private-planning-footer,dialog:has(.private-loan-hero)>.dialog-footer){display:flex;flex-direction:column;align-items:stretch}
 html[data-theme] .private-workspace :is(.private-planning-footer,dialog:has(.private-loan-hero)>.dialog-footer)>.button{width:100%;white-space:nowrap}
 html[data-theme] .private-workspace .private-overview-head{flex-wrap:wrap}
 html[data-theme] .private-workspace :is(.private-statement-preview pre,.private-loan-since){overflow-wrap:normal;word-break:normal}
}
@media (max-width:360px){
 html[data-theme] .private-workspace :is(.private-overview-figures,.private-loan-metrics,.rate-whatif-outcomes,.loan-option-outcomes){grid-template-columns:minmax(0,1fr)}
}

@media (max-width:639px){
 html[data-theme] .private-workspace .private-loan-hero{min-width:0}
 html[data-theme] .private-workspace .private-loan-hero .private-due-badge{max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:normal}
 html[data-theme] .private-workspace .private-detail-balance>*{min-width:0}
 html[data-theme] .private-workspace .rate-whatif-mode>button{padding-inline:4px;white-space:nowrap}
 html[data-theme] .private-workspace .private-row-since>.private-row-emi{display:inline-block;white-space:nowrap}
}

@media (max-width:639px){
 html[data-theme] .private-workspace .loan-option-equation strong{white-space:normal}
 html[data-theme] .private-workspace .loan-option-money{display:inline-block;white-space:nowrap}
 html[data-theme] .private-workspace [data-loan-option-example]{white-space:nowrap;padding-inline:8px}
}
@media (max-width:360px){
 html[data-theme] .private-workspace :is(.loan-payment-modes,.loan-option-chart-controls){grid-auto-flow:row;grid-template-columns:minmax(0,1fr)}
 html[data-theme] .private-workspace :is(.loan-payment-modes,.loan-option-chart-controls)>.chip{white-space:nowrap}
}

/* Shared disclosure chevrons own the arrow; avoid a second CSS arrow. */
html[data-theme] .private-workspace .private-strategy-fold>summary::after{content:none}
.private-payments-view{display:flex;gap:4px;padding:4px;margin:12px 0;border-radius:12px;background:var(--subtle)}
.private-payments-view button{flex:1;min-height:44px;padding:8px;border:0;border-radius:9px;font-size:var(--text-sm);color:var(--muted);background:none}
.private-payments-view button[aria-pressed=true]{color:var(--text);background:var(--sw-thumb,var(--decorative))}
.private-payments-panel[hidden]{display:none}
.private-payments-panel:not([hidden]){animation:loan-panel-enter 200ms var(--motion-ease)}
.rate-whatif-analysis>h4,.strategy-more>h4{margin:18px 0 12px;font-size:16px}
@keyframes loan-panel-enter{from{opacity:.4;transform:translateY(6px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.private-payments-panel:not([hidden]){animation:none}}
html[data-theme] .private-workspace .private-strategy-fold>summary>.disclosure-chevron{position:absolute;right:16px;top:20px;margin:0}

.rate-whatif-calculation>h5{font-size:var(--text-sm);margin:16px 0 8px}

/* Calm ledger: a padded summary, then one level of report rows. */
html[data-theme] .private-workspace .private-consolidated{display:grid;gap:14px;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
html[data-theme] .private-workspace .private-ledger-summary{min-width:0;padding:20px;border:1px solid var(--border);border-radius:18px;background:var(--surface)}
.private-ledger-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.private-ledger-heading h3{margin:0;font-size:18px;font-weight:600;line-height:1.4}
.private-summary-actions{position:relative;flex:none}
.private-summary-actions>summary{display:grid;place-items:center;width:44px;min-height:44px;list-style:none;border-radius:10px;font-size:24px;cursor:pointer;color:var(--muted)}
.private-summary-actions>summary::-webkit-details-marker{display:none}
.private-summary-actions>summary>.disclosure-chevron{display:none}
.private-summary-actions[open]>summary{background:var(--subtle);color:var(--text)}
.private-summary-actions>div{position:absolute;right:0;top:48px;z-index:5;min-width:210px;padding:6px;border:1px solid var(--border);border-radius:12px;background:var(--surface);box-shadow:0 8px 24px #00000014}
.private-summary-actions[open]>div{animation:loan-panel-enter 160ms var(--motion-ease)}
.private-summary-actions [data-action=private-export]{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:8px 12px;font-size:var(--text-sm);text-align:left;white-space:nowrap}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px 16px;margin:0}
.private-ledger-summary .private-overall-metrics>div{display:flex;flex-direction:column;justify-content:space-between;min-width:0}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics dt{font-size:var(--text-sm);line-height:1.4;color:var(--muted);overflow-wrap:normal;word-break:normal}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics dd{margin:7px 0 0;font-size:clamp(18px,5.3vw,24px);font-weight:550;line-height:1.25;font-variant-numeric:tabular-nums;white-space:nowrap;overflow-wrap:normal;word-break:normal}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics>div:first-child dd{font-size:clamp(20px,6vw,28px);font-weight:650}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics>div.private-metric-wide dd{font-size:clamp(12px,4vw,18px)}
.private-ledger-summary .private-overall-metrics>.private-metric-long{grid-column:1/-1}
html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics>div.private-metric-long dd{font-size:clamp(12px,5vw,24px)}
.private-ledger-repaid{margin-top:20px;padding-top:16px;border-top:1px solid var(--divider,var(--border))}
.private-ledger-repaid p{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;margin:0;font-size:var(--text-sm);line-height:1.6}
.private-ledger-repaid strong{white-space:nowrap;font-size:16px;font-weight:600}
.private-ledger-repaid .small{display:block;margin-top:4px}
.private-ledger-repaid .private-ledger-allocation{display:flex;justify-content:flex-start;gap:4px 16px}
.private-ledger-allocation>span{white-space:nowrap}
.private-ledger-scope{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 16px;margin-top:14px;font-size:var(--text-xs);line-height:1.6;color:var(--muted)}
html[data-theme] .private-workspace .private-ledger-reports{min-width:0;border:1px solid var(--border);border-radius:18px;background:var(--surface);overflow:hidden}
html[data-theme] .private-workspace .private-ledger-reports>.private-report{margin:0;padding:0 16px;border:0;border-top:1px solid var(--divider,var(--border));border-radius:0;background:transparent;box-shadow:none}
html[data-theme] .private-workspace .private-ledger-reports>.private-report:first-child{border-top:0}
html[data-theme] .private-workspace .private-ledger-reports>.private-report[open]{padding-bottom:16px}
html[data-theme] .private-workspace .private-ledger-reports>.private-report>summary{display:flex;align-items:center;gap:12px;min-height:76px;margin:0 -16px;padding:14px 16px;font-size:16px;font-weight:500;line-height:1.4}
.private-ledger-reports>.private-report>summary::after{content:none}
.private-ledger-row-title{display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;overflow-wrap:normal;word-break:normal}
.private-ledger-row-title>small{font-size:var(--text-xs);font-weight:400;line-height:1.5;color:var(--muted)}
.private-ledger-reports>details>summary>.count{flex:none;margin:0;font-size:var(--text-xs)}
.private-ledger-reports>details>summary>.disclosure-chevron{flex:none;margin:0}
@media(max-width:639px){html[data-theme] .private-workspace .private-ledger-summary{padding:16px}}
@media(min-width:768px){html[data-theme] .private-workspace .private-ledger-summary .private-overall-metrics{grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}.private-ledger-scope{margin-top:16px}}
@media(prefers-reduced-motion:reduce){.private-summary-actions[open]>div{animation:none}}

/* Actionable schedules stay separate from balances and forecasts. */
html[data-theme] .private-workspace .private-next-payments{padding:16px;border:1px solid var(--border);border-radius:18px;background:var(--surface)}
.private-next-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:12px}
.private-next-heading h3,.private-planning-hub>h3{margin:0;font-size:18px;font-weight:600}
.private-next-heading p{margin:4px 0 0}
.private-next-heading>.icon{flex:none;color:var(--muted);margin-top:2px}
.private-next-range{margin-bottom:12px}
.private-next-item{border-top:1px solid var(--divider,var(--border));min-width:0}
.private-next-item>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:82px;padding:12px 0;list-style:none;cursor:pointer}
.private-next-item>summary::-webkit-details-marker{display:none}
.private-next-item>summary>span:first-child{display:flex;flex-direction:column;gap:4px;min-width:0}
.private-next-item strong{font-size:16px;font-weight:600;overflow-wrap:normal;word-break:normal}
.private-next-item small{font-size:var(--text-xs);line-height:1.5;color:var(--muted)}
.private-next-item .private-next-when{display:flex;flex-wrap:wrap;gap:0 8px}
.private-next-when time{white-space:nowrap}
.private-next-item[data-next-state=overdue] .private-next-status{color:var(--expense)}
.private-next-amount{display:flex;align-items:center;gap:8px;flex:none;white-space:nowrap;font-size:18px;font-weight:600;font-variant-numeric:tabular-nums}
.private-next-amount>.icon{width:16px;height:16px;color:var(--muted);transition:transform 200ms var(--motion-ease)}
.private-next-item>summary[aria-expanded=true] .private-next-amount>.icon{transform:rotate(180deg)}
.private-next-item>summary>.disclosure-chevron{display:none}
.private-next-item .home-disclosure-clip{padding-bottom:14px}
.private-next-actions{display:flex;flex-wrap:wrap;gap:8px}
.private-next-actions>.button,.private-next-actions>.text-button{min-height:44px;font-size:var(--text-sm)}
.private-schedule-missing{padding-top:8px;border-top:1px solid var(--divider,var(--border))}
.private-schedule-missing>.text-button{display:block;min-height:44px;max-width:100%;text-align:left;font-size:var(--text-sm)}
.private-workspace .private-row-next{display:block;font-size:var(--text-sm);line-height:1.5;font-weight:500;color:var(--text);overflow-wrap:normal;word-break:normal}
.private-trust-note{font-size:var(--text-sm);color:var(--muted);line-height:1.6;margin:12px 0}
.private-detail-next{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:12px 0;border-top:1px solid var(--divider,var(--border))}
.private-detail-next>strong{font-size:var(--text-base);font-weight:500;line-height:1.5}
.private-schedule-fields,.private-allocation-fields{min-width:0}
[data-schedule-preview]{font-size:var(--text-sm);line-height:1.6;color:var(--muted)}
.private-planning-hub{padding-top:8px;margin-top:8px;min-width:0}
.private-planning-hub>p{margin:6px 0 14px}
.private-planning-tabs{margin-bottom:12px}
.private-planning-panes>details[hidden]{display:none}
.private-planning-panes .home-disclosure-clip{min-width:0}
.private-planning-panes .private-strategy-fold{margin:0}
.private-payments-view>button{font-size:var(--text-sm);white-space:nowrap;padding-inline:4px}
@media(max-width:360px){.private-next-item>summary{align-items:flex-start;flex-wrap:wrap}.private-next-amount{flex-basis:100%;justify-content:space-between}.private-next-actions>.button{width:100%}.private-planning-tabs>button{font-size:var(--text-sm);padding-inline:3px}}
@media(prefers-reduced-motion:no-preference){::view-transition-group(loan-next),::view-transition-group(loan-payment),::view-transition-group(loan-plan-pane){animation-duration:280ms;animation-timing-function:var(--motion-ease)}}
@media(prefers-reduced-motion:reduce){.private-next-amount>.icon{transition:none}::view-transition-group(loan-next),::view-transition-group(loan-payment),::view-transition-group(loan-plan-pane){animation:none}}

.private-payments-panel>.private-analytics{border:0;padding:0;background:none;box-shadow:none}
.private-schedule-dot{display:inline-block;width:6px;height:6px;border:1px solid var(--link);border-radius:50%;background:transparent}

/* Keep header controls on one optical centre, including inside detail/report headers. */
html[data-theme] .private-workspace>.dialog-heading{align-items:center;gap:6px}
html[data-theme] .private-workspace>.dialog-heading>h2{margin:0;overflow-wrap:normal;word-break:normal;line-height:1.3}
html[data-theme] .private-workspace>.dialog-heading :is(.icon-button,.private-header-lock,.private-session-menu>summary){box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex:none;min-width:44px;min-height:44px;height:44px;margin:0;line-height:1.25}
html[data-theme] .private-workspace>.dialog-heading :is(.icon-button,.private-session-menu>summary){width:44px;padding:10px}
html[data-theme] .private-workspace>.dialog-heading .private-header-lock{width:auto;padding:8px 12px;white-space:nowrap}
html[data-theme] .private-workspace>.dialog-heading .private-session-menu{margin:0}
html[data-theme] .private-workspace>.dialog-heading .private-session-menu>summary>.disclosure-chevron{display:none}
html[data-theme] .private-workspace>.dialog-heading .icon{flex:none;width:20px;height:20px}
html[data-theme] .private-workspace>.dialog-heading:has(.private-session-menu){display:grid;grid-template-columns:minmax(0,1fr) 44px auto 44px}
html[data-theme] .private-workspace>.dialog-heading:has(.private-session-menu)>.sheet-drag-handle{display:none}

/* Morph wrappers retain the same inset as their original planning sections. */
html[data-theme] .private-workspace .private-strategy-fold>.home-disclosure-panel>.home-disclosure-clip>section{border:0;border-radius:0;background:none;padding:0 20px 20px}

/* Checkbox controls must not inherit the full width of amount/date inputs. */
html[data-theme] .private-workspace input[type=checkbox]{flex:0 0 22px;width:22px;height:22px;min-width:22px;min-height:22px;padding:0;margin:0}
html[data-theme] .private-workspace :is(.check-label,.private-import-confirm){display:flex;align-items:flex-start;gap:10px;min-height:44px;line-height:1.5}
html[data-theme] .private-workspace :is(.private-schedule-fields,.private-allocation-fields){margin:16px 0;padding:16px;border:1px solid var(--divider);border-radius:var(--radius-md);min-width:0}
html[data-theme] .private-workspace :is(.private-schedule-fields,.private-allocation-fields) legend{padding-inline:4px;font-size:var(--text-sm);font-weight:600}
html[data-theme] .private-workspace :is(.private-schedule-fields,.private-allocation-fields) label{margin:0 0 16px}
@media(max-width:639px){
 html[data-theme] .private-workspace>.dialog-heading:is(:has(.private-header-back),:has([data-action=private-sheet-close])) .private-header-lock{width:44px;min-width:44px;font-size:0;gap:0;padding:10px}
 html[data-theme] .private-workspace .private-strategy-fold>.home-disclosure-panel>.home-disclosure-clip>section{padding:0 16px 16px}
 html[data-theme] .private-workspace .loan-payment-modes .chip{font-size:var(--text-xs);white-space:nowrap;padding-inline:2px;min-width:0}
}

/* Tables can scroll; names and rupee values must remain readable inside them. */
html[data-theme] .private-workspace .loan-sheet-table{min-width:480px}
html[data-theme] .private-workspace .loan-sheet-table tbody th{min-width:180px}
html[data-theme] .private-workspace .loan-sheet-lender{padding:8px;gap:8px}
html[data-theme] .private-workspace .loan-sheet-lender strong{overflow-wrap:break-word;word-break:normal}
html[data-theme] .private-workspace .loan-sheet-table td{white-space:nowrap}
html[data-theme] .private-workspace .loan-sheet-metrics .chip{white-space:nowrap}

/* Approved dense lender ledger: identity + principal + paired interest figures. */
html[data-theme] .private-workspace .loan-sheet-table{min-width:0;width:100%;table-layout:fixed;font-size:var(--text-xs)}
html[data-theme] .private-workspace .loan-sheet-table-wrap{overflow:visible}
html[data-theme] .private-workspace .loan-sheet-table :is(.loan-sheet-rate,.loan-sheet-share){display:none}
html[data-theme] .private-workspace .loan-sheet-table :is(th,td){min-width:0;padding:10px 8px;vertical-align:top}
html[data-theme] .private-workspace .loan-sheet-table tr>:first-child{width:36%}
html[data-theme] .private-workspace .loan-sheet-table tr>:nth-child(3){width:30%}
html[data-theme] .private-workspace .loan-sheet-table tr>:nth-child(4){width:34%}
html[data-theme] .private-workspace .loan-sheet-table tbody th{min-width:0;padding:0}
html[data-theme] .private-workspace .loan-sheet-lender{min-height:60px;padding:10px 8px;gap:6px;align-items:flex-start}
html[data-theme] .private-workspace .loan-sheet-mark{width:4px;height:4px;border-radius:50%;margin:6px 0 0;flex:none}
html[data-theme] .private-workspace .loan-sheet-lender strong{font-size:var(--text-xs);line-height:1.4}
html[data-theme] .private-workspace .loan-sheet-lender small{display:flex;flex-wrap:wrap;gap:2px 6px;margin-top:3px;font-size:var(--text-xs);line-height:1.4}
html[data-theme] .private-workspace .loan-sheet-lender small>span{white-space:nowrap}
html[data-theme] .private-workspace .loan-sheet-share-inline{display:inline}
html[data-theme] .private-workspace .loan-sheet-table thead th{white-space:normal;font-size:var(--text-xs);line-height:1.4;font-weight:500}
html[data-theme] .private-workspace .loan-sheet-table thead button{font-size:inherit;line-height:1.4;min-height:44px;white-space:normal}
html[data-theme] .private-workspace .loan-sheet-table thead button small{display:block;font-size:inherit;color:var(--muted);font-weight:400;margin-top:3px}
html[data-theme] .private-workspace .loan-sheet-table :is(td,td small){font-size:var(--text-xs);font-variant-numeric:tabular-nums;white-space:nowrap}
html[data-theme] .private-workspace .loan-sheet-table td small{margin-top:4px}
html[data-theme] .private-workspace .loan-sheet-table thead th[aria-sort=descending] button::after{content:none}
/* Exceptionally large amounts wrap as whole cells below the lender identity. */
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] :is(thead,tbody,tfoot){display:block}
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] tr{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--divider);padding:10px 8px;gap:6px 12px}
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] tr>:first-child{grid-column:1/-1}
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] tr>:is(th,td){width:auto;border:0;padding:0}
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] .loan-sheet-lender{padding:0;min-height:44px}
html[data-theme] .private-workspace .loan-sheet-table[data-wide-money=true] tr>:nth-child(3){text-align:left}

/* Keep payment and its allocation together at the width available inside the loan sheet. */
.payoff-view-switch{margin-block:12px}
.payoff-projection{container-type:inline-size;min-width:0}
.payoff-schedule[data-payoff-panel]{border-top:0;margin-top:0}
.payoff-schedule[data-payoff-panel] caption{font-size:var(--text-xs);padding-bottom:10px}
.payoff-projection thead{background:color-mix(in srgb,var(--brand-soft) 38%,var(--surface))}
.payoff-projection tbody th{font-weight:600}
.payoff-projection tbody td{color:var(--muted)}
.payoff-projection tbody td:last-child{color:var(--link);font-weight:600}
.payoff-projection tbody tr:last-child>:is(th,td){border-bottom:0}
.payoff-projection-label{display:none}
@container (max-width:560px){
 .payoff-projection :is(table,caption,thead,tbody){display:block}
 .payoff-projection thead{border:1px solid var(--divider);border-bottom:0;border-radius:var(--radius-sm) var(--radius-sm) 0 0}
 .payoff-projection tbody{border:1px solid var(--divider);border-radius:0 0 var(--radius-sm) var(--radius-sm);background:var(--surface)}
 .payoff-projection tr{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1fr) minmax(0,1.2fr);gap:3px 6px;padding:8px 10px}
 .payoff-projection thead tr{padding-block:7px}
 .payoff-projection tbody tr+tr{border-top:1px solid var(--divider)}
 .payoff-projection tr>:is(th,td){padding:0;border:0;text-align:right;line-height:1.35;font-size:var(--text-xs)}
 .payoff-projection tr>:first-child{grid-column:span 2;text-align:left}
 .payoff-projection [data-wide-amounts=true] thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .payoff-projection [data-wide-amounts=true] tbody{border-radius:var(--radius-sm)}
 .payoff-projection [data-wide-amounts=true] tbody tr{display:flex;flex-wrap:wrap;gap:6px 8px}
 .payoff-projection [data-wide-amounts=true] tbody th{flex:1;align-self:center}
 .payoff-projection [data-wide-amounts=true] tbody td{flex:1 0 27%;text-align:left}
 .payoff-projection [data-wide-amounts=true] tbody td:nth-child(2){flex:0 0 50%;text-align:right}
 .payoff-projection [data-wide-amounts=true] .payoff-projection-label{display:block;color:var(--muted);font-weight:400}
}
/* Keep sideways table swipes local while allowing the loan sheet to scroll vertically. */
.private-workspace .payoff-table-scroll{overscroll-behavior-x:contain;overscroll-behavior-y:auto}

@media(max-width:639px){
 .private-workspace .private-plan-disclosure>summary{padding-inline:12px}
 .private-workspace .private-plan-disclosure>:not(summary){margin-inline:12px}
 .private-workspace .private-plan-disclosure .payoff-planner{padding:12px 0 0;border:0;border-radius:0;background:none}
}

.private-next-budget{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:4px 8px;margin-bottom:12px;padding:12px;border:1px solid var(--divider);border-radius:var(--radius-sm);background:var(--subtle)}
.private-next-budget>strong{white-space:nowrap;font-variant-numeric:tabular-nums}
.private-next-budget>p{grid-column:1/-1;margin:0}
