.detail-four-tabs:has(#costs) .detail-nav { grid-template-columns: repeat(5,minmax(0,1fr)); }
@media(min-width:721px) {
  .detail-four-tabs:has(#costs) .detail-tab-label { font-size:.75rem; }
}
#costs, .cost-dialog { color:#3a4143; font-variant-numeric:tabular-nums; }
#costs *, .cost-dialog { border-radius:0; box-sizing:border-box; }
#costs h2 { margin-bottom:12px; }
#costs h3 { font-size:1.22rem; color:#254d40; border-bottom:2px solid #396c58; padding-bottom:10px; margin:36px 0 10px; }
#costs h4 { font-size:1rem; margin:0; font-weight:600; display:flex; justify-content:space-between; gap:8px; padding:10px 14px; background:#eff5f1; }
#costs h4 output { white-space:nowrap; }
.cost-estimate-note,#costs .cost-band .cost-estimate-note { display:inline-block; margin-inline-start:.5em; white-space:nowrap; font-size:max(.78em,.6875rem); font-weight:400; color:#526358; }
#costs p { line-height:1.65; }
#costs .cost-notice { border-left:3px solid #71907d; padding:6px 12px; font-size:.9rem; background:#f4f6f3; }
.cost-mode { border:0; padding:0; margin:20px 0; display:flex; flex-wrap:wrap; gap:8px; }
.cost-mode legend { font-weight:600; margin-bottom:8px; }
.cost-mode label { display:flex; align-items:center; gap:8px; border:1px solid #b9c7c0; padding:8px 15px; cursor:pointer; min-height:44px; }
.cost-mode label:has(:checked) { border-color:var(--green); background:#eaf2ed; font-weight:600; }
.cost-mode input, .cost-choice input { accent-color:var(--green); width:18px; height:18px; flex:none; margin:0; }
#costs .cost-mode input[type="radio"] { appearance:none; border:1px solid #64806e; border-radius:0!important; background:white; }
#costs .cost-mode input[type="radio"]:checked { background:#24634f; box-shadow:inset 0 0 0 3px white; }
.cost-property, .cost-band { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px; background:#edf4ef; border-left:3px solid var(--green); }
.cost-property span,.cost-property small,.cost-property strong,.cost-band small { display:block; }
.cost-property span,.cost-property small,.cost-row small,.cost-band small { font-size:.8125rem; }
.cost-property b,.cost-band strong { font-size:1.35rem; }
.cost-jumps,.cost-actions,.cost-tools { display:flex; gap:8px 14px; flex-wrap:wrap; align-items:center; }
.cost-jumps { margin-top:12px; }
.cost-jumps button,.cost-tools button { background:none; border:0; padding:3px 0; color:var(--green); text-decoration:underline; font:inherit; cursor:pointer; }
.cost-jumps button { min-height:36px; }
.cost-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(160px,31%); align-items:start; gap:12px 18px; padding:16px 10px; border-bottom:1px solid var(--line); }
.cost-row p { margin:4px 0; font-size:.9rem; }
.cost-row label,.cost-row input { font-size:1rem; }
.cost-choice { display:inline-flex; gap:10px; align-items:center; min-height:36px; cursor:pointer; font-weight:600; }
.cost-picked { background:#f5f9f6; }
.cost-input { display:flex; align-items:center; gap:6px; }
.cost-input > span { white-space:nowrap; }
.cost-edit input,.cost-extra input { font:inherit; padding:8px 10px; background:white; color:#253d32; border:1px solid #93aa9c; width:100%; min-width:0; min-height:42px; }
.cost-edit input { text-align:right; }
.cost-edit input:disabled { background:#f3f4f3; color:#626963; }
.cost-tools { font-size:.82rem; margin:4px 0 0; }
.cost-tools button:disabled { color:#67736b; text-decoration:none; cursor:default; }
.cost-tools small,.cost-extra small { color:#75442c; }
.cost-off .cost-tools small { color:#5b645d; }
.cost-group { margin:14px 0; }
.cost-band { margin:16px 0; }
.cost-extra { display:grid; grid-template-columns:minmax(0,1fr) minmax(120px,30%) auto; align-items:end; gap:6px 10px; margin-bottom:12px; }
.cost-extra label { display:grid; gap:3px; }
.cost-extra small { grid-column:1/-1; }
#costs .cost-summary { background:#edf4ef; border-top:3px solid var(--green); padding:18px 20px; margin-top:26px; }
#costs .cost-summary h3 { color:#244a3b; border:0; margin:0; padding:0; }
.cost-summary [data-total] { font-size:clamp(1.45rem,4vw,2.4rem); color:#214d39; }
.cost-summary p { margin:4px 0; }
.cost-repayment { margin:12px 0; padding:10px 0 0; border-top:1px solid #c9d8ce; }
.cost-monthly-line { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:2px 8px; }
.cost-repayment [data-repayment-monthly] { font-size:1.35rem; color:#214d39; }
.cost-repayment [data-repayment-bonus],.cost-repayment [data-repayment-error],.cost-loan-note { font-size:.8125rem; color:#47564e; }
.cost-loan-terms { margin:8px 0 0; }
.cost-loan-terms div { display:flex; justify-content:space-between; gap:8px; }
.cost-loan-terms dd { margin:0; }
#costs .cost-repayment p,.cost-overview .cost-repayment p { margin:0; }
.cost-repayment p:empty,.cost-loan-fields small:empty { display:none; }
.button.cost-action { min-height:44px; padding:6px 8px; border-radius:0; font-size:.875rem; cursor:pointer; }
.cost-action[hidden] { display:none; }
.cost-repayment > .cost-action { margin-top:10px; }
.cost-loan-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.cost-loan-fields label { display:grid; gap:4px; align-content:start; }
.cost-loan-fields label:first-child,.cost-loan-fields label:last-child { grid-column:1/-1; }
.cost-loan-fields input { width:100%; min-width:0; min-height:44px; padding:8px; border:1px solid #93aa9c; border-radius:0; background:#fff; font-size:1rem; }
.cost-loan-fields input[aria-invalid=true] { border-color:#964323; }
.cost-loan-error { color:#964323; }
.cost-loan-dialog .cost-repayment { padding:12px; background:#edf4ef; }
.cost-overview,.cost-dock { display:none; }
body:has(#costs:not([hidden])) .quick-inquiry-mobile,
.detail-columns:has(#costs:not([hidden])) > .quick-inquiry-panel { display:none; }
@media(min-width:721px) {
  .detail-columns:has(#costs:not([hidden])) .cost-overview {
    --cost-overview-top:calc(var(--site-header-height) + var(--detail-tabs-height) + 12px);
    display:block; position:sticky; top:var(--cost-overview-top); align-self:start;
    max-height:calc(100dvh - var(--cost-overview-top) - 12px); overflow:auto;
    box-sizing:border-box; border:1px solid #c9d8ce; border-top:3px solid var(--green); padding:18px; color:#3a4143;
  }
  .cost-overview h2 { font-size:1.12rem; margin:0 0 12px; }
  .cost-overview h2 .cost-estimate-note { font-size:.75rem; }
  .cost-overview > dl { margin:0; }
  .cost-overview > dl div { display:flex; justify-content:space-between; gap:8px; border-bottom:1px solid var(--line); padding:7px 0; }
  .cost-overview dd { margin:0; text-align:right; }
  .cost-overview [data-overview-total] { display:block; color:var(--green); font-size:1.5rem; }
  .cost-overview p { margin:12px 0 0; }
  .cost-overview .cost-action { width:100%; }
}
#costs :focus-visible { outline:2px solid #236744; outline-offset:2px; }
#costs [id^="cost-"] { scroll-margin:100px 0; }
.cost-dialog,.cost-loan-dialog { padding:clamp(14px,3vw,30px); width:min(650px,calc(100% - 24px)); max-height:88dvh; border:1px solid #799282; border-radius:0; overflow-y:auto; }
:is(.cost-dialog,.cost-loan-dialog)::backdrop { background:#152b2399; }
.cost-dialog [data-back] { float:right; margin:0 0 10px 12px; }
.cost-dialog h2 { clear:both; }
.cost-dialog details { margin:12px 0 18px; border-block:1px solid #c9d8ce; padding:10px 0; }
.cost-dialog summary { cursor:pointer; color:var(--green); }
#costs .cost-dialog :is(.quick-inquiry-field, .quick-contact-method legend, .quick-contact-method label, .quick-inquiry-consent) { font-size:.875rem; }
#costs .cost-dialog :is(.quick-inquiry-field input, textarea) { font-size:1rem; min-height:44px; }
.cost-dialog pre { font:inherit; font-size:.92rem; line-height:1.8; white-space:pre-wrap; overflow-wrap:anywhere; padding-block:12px; }
@media(max-width:720px) {
  html:has(#costs:not([hidden])) { --cost-dock-clearance:var(--cost-dock-height,calc(60px + env(safe-area-inset-bottom))); scroll-padding-bottom:var(--cost-dock-clearance); }
  body:has(#costs:not([hidden])) { padding-bottom:var(--cost-dock-clearance); --page-top-bottom:calc(var(--cost-dock-clearance) + 8px); }
  .cost-dock {
    position:fixed; z-index:28; inset:auto 0 0; display:flex; flex-direction:column; gap:4px; padding:4px 12px calc(4px + env(safe-area-inset-bottom));
    max-height:min(65dvh,calc(100dvh - var(--site-header-height) - var(--detail-tabs-height) - 8px));
    background:#fff; border-top:1px solid #c9d8ce; box-shadow:0 -3px 12px #183c2512;
  }
  #costs:has(dialog[open],input[type=text]:focus) .cost-dock { display:none; }
  .cost-dock > details { min-height:0; overflow:auto; }
  .cost-dock-summary { display:flex; flex-wrap:wrap; align-items:center; gap:0 12px; min-height:44px; cursor:pointer; list-style:none; }
  .cost-dock-summary::-webkit-details-marker { display:none; }
  .cost-dock-value { display:flex; flex-wrap:wrap; flex:1 1 auto; align-items:baseline; justify-content:space-between; gap:0 8px; font-size:.875rem; }
  .cost-dock-value strong { color:#214d39; font-size:1.25rem; line-height:1.3; }
  .cost-dock-toggle { margin-left:auto; padding:6px 8px; color:var(--green); border:1px solid #93aa9c; font-size:.8125rem; white-space:nowrap; }
  .cost-dock details:not([open]) .cost-dock-collapse,.cost-dock details[open] .cost-dock-expand { display:none; }
  .cost-dock-breakdown { margin:4px 0 8px; padding:4px 0; border-block:1px solid #c9d8ce; font-size:.875rem; }
  .cost-dock-breakdown div { display:flex; justify-content:space-between; gap:8px; padding:2px 0; }
  .cost-dock-breakdown div:first-child { color:#214d39; font-weight:700; }
  .cost-dock-breakdown dd { margin:0; text-align:right; }
  .cost-dock-actions { display:grid; flex:none; gap:6px; }
  .cost-dock-actions:has([data-edit-loan]:not([hidden])) { grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr); }
  .cost-dock-actions .cost-action { font-size:.8125rem; min-width:0; }
  .cost-row,.cost-extra { grid-template-columns:minmax(0,1fr); }
  .cost-edit { width:100%; }
  .cost-row { padding:12px 4px; gap:7px; }
  .cost-input input { max-width:18rem; }
  .cost-property,.cost-band { align-items:flex-start; flex-direction:column; gap:6px; }
  .cost-extra button { justify-self:start; }
  .cost-actions { flex-direction:column; align-items:stretch; }
  .cost-mode label { padding:8px 10px; }
  #costs .cost-summary { padding:14px 12px; }
  .detail-four-tabs:has(#costs) .detail-nav a { row-gap:2px; }
  .detail-four-tabs:has(#costs) .detail-tab-icon { height:auto; }
  .detail-four-tabs:has(#costs) .detail-tab-label { min-height:0; padding-inline:0; overflow-wrap:anywhere; }
}
