/* Shared NOMSO actions: pine primary, sage upload, quiet secondary. */
:root{--action-pine:#245b48;--action-pine-hover:#194735;--action-sage:#edf4ef;--action-border:#cbdcd1}
.button{border:1px solid transparent;border-radius:8px;padding:7px 12px;min-height:36px;font-size:13px;font-weight:600;line-height:20px;gap:6px;transition:background-color .15s,border-color .15s,box-shadow .15s}
.button:not(.secondary):not(.danger):not(.upload-button):not(.stage-done):not(.stage-pending):hover{background-color:var(--action-pine-hover)}
.button.secondary{background:#fff;color:#335b49;border-color:#d4e0d8}
.button.secondary:hover{background:#f0f5f1;border-color:#b8ccbf}
.button.small{padding:5px 10px;min-height:32px;font-size:12px}
.button.upload-button,.button.secondary.upload-button{background:var(--action-sage);border:1px solid var(--action-border);color:#285b45;border-radius:8px;padding:5px 11px;min-height:34px;font-size:13px;font-weight:600;line-height:20px;gap:6px}
.button.upload-button:hover,.button.secondary.upload-button:hover{background:#dfece3;border-color:#aac7b6}
.button.upload-button[type=submit]{background:var(--action-pine);border-color:var(--action-pine);color:#fff}
.button.upload-button[type=submit]:hover{background:var(--action-pine-hover);border-color:var(--action-pine-hover)}
.button.danger{background:#fbefec;border-color:#edd4cc;color:#9c4234}
.button.danger:hover{background:#f5e2dc}
.button:focus-visible,.button.upload-button:focus-visible,details.mortgage-block>summary:focus-visible{outline:3px solid #91b49e;outline-offset:3px}
.button:disabled{cursor:not-allowed;box-shadow:none}
.upload-plus{font-size:20px;line-height:18px}

/* Document groups and individual documents. */
.mortgage-summary{margin-bottom:14px}
.mortgage-block{margin:0 0 12px;border-left-width:4px;border-radius:10px}
details.mortgage-block>summary.panelhead{padding:12px 16px;min-height:52px;gap:10px}
details.mortgage-block>summary.panelhead h2{font-size:16px;line-height:1.4;letter-spacing:-.2px}
.mortgage-block>.panelbody{padding:12px 16px}
.mortgage-block .badge,.construction-list .badge{font-size:11px;line-height:17px;padding:3px 7px}
.mortgage-block-count{font-size:12px}
.mortgage-block .note,.mortgage-block .stage-problems{padding:9px 12px;margin-bottom:10px;font-size:12px;line-height:1.5}
.mortgage-block .mortgage-person{padding:12px;margin:12px 0;border-radius:8px}
.mortgage-person>h3{font-size:15px;line-height:1.4;margin:0 0 6px}
.mortgage-person>p.muted{font-size:12px;line-height:1.45;margin:0 0 8px}
.mortgage-block .mortgage-slot{padding:10px 0;margin:0}
.mortgage-block .mortgage-slot:last-child{border-bottom:0;padding-bottom:0}
.mortgage-slot-head{gap:8px}
.mortgage-slot-head>div:first-child{min-width:0;flex:1}
.mortgage-slot-head b{font-size:13px;line-height:1.5}
.mortgage-slot-head .actions{gap:6px;flex-wrap:wrap}
.mortgage-block .stage-facts{gap:8px 16px;margin:12px 0}
.mortgage-block .stage-facts div{padding-bottom:7px}
.mortgage-block .stage-facts dt{font-size:11px;margin-bottom:3px}
.mortgage-block .stage-facts dd{font-size:13px;line-height:1.5}
.mortgage-missing{padding:8px 10px;margin:0 0 10px;font-size:12px}
.mortgage-missing ul{margin:6px 0;padding-left:20px}
.mortgage-inn-form{margin:8px 0}
.mortgage-inn-form label{margin-bottom:4px;font-size:11px}
.mortgage-inn-controls input{min-height:34px;padding:6px 9px;font-size:13px}

/* File actions and delete remain separate, with no unused footer row. */
.mortgage-files{display:grid;grid-template-columns:repeat(auto-fill,minmax(245px,1fr));gap:8px;margin-top:8px}
.mortgage-files .mortgage-file,.mortgage-files .mortgage-file.has-deletion-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 16px;width:auto;min-width:0;padding:9px 11px;border-radius:8px;background:#fafcf9;align-content:start}
.mortgage-file>.document-file-name,.mortgage-file>small,.mortgage-file>.mortgage-photo{grid-column:1/-1}
.mortgage-file .document-file-name{font-size:13px;line-height:1.4;padding:0}
.mortgage-file small{font-size:11px;line-height:1.4;margin:0}
.mortgage-file .document-file-actions{grid-column:1;align-self:center;gap:14px;margin:2px 0 0;font-size:12px;align-items:center}
.mortgage-file .document-file-actions a{padding:3px 0;min-height:26px}
.mortgage-files .mortgage-file>.deletion-footer{grid-column:2;grid-row:3;align-self:center;width:auto;margin:0;padding:0}
.mortgage-file .deletion-footer .deletion-button{min-height:28px;min-width:28px;padding:2px 4px}
.mortgage-file .deletion-footer .upload-remove{font-size:20px}
.mortgage-files:empty{display:none}

/* Construction sections: less vertical repetition, paired finance panels. */
.construction-overview{padding:14px 16px;gap:8px 16px;margin-bottom:12px}
.construction-overview h2{font-size:18px;margin-bottom:5px}
.construction-overview p{font-size:12px;line-height:1.5}
.construction-overview strong{font-size:24px}
.construction-overview progress{height:8px}
.construction-list{gap:10px}
.construction-list>.panel{margin:0}
.construction-group>summary{padding:12px 16px;min-height:52px;gap:10px}
.construction-group>summary h2{font-size:16px;line-height:1.4;letter-spacing:-.2px}
.construction-count{font-size:12px}
.construction-children{padding:0 16px 6px}
.construction-nested{margin:8px 0}
.construction-nested>summary{padding:10px 12px}
.construction-nested>summary h2{font-size:14px}
.construction-step{padding:12px 0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px;min-width:0}
.construction-step>*{grid-column:1/-1;min-width:0}
.construction-step-head{gap:7px}
.construction-step-head h3{font-size:14px;min-width:140px;line-height:1.4}
.construction-facts{grid-template-columns:150px minmax(0,1fr);gap:8px 14px;margin:8px 0 0;font-size:13px}
.construction-facts dt{font-size:11px}
.construction-facts dd{margin-top:3px;line-height:1.45}
.construction-step>.construction-plan,.construction-children>.construction-plan{margin:8px 0!important;font-size:12px;line-height:1.6}
.construction-step>.muted{font-size:12px;line-height:1.5;margin:8px 0 3px}
.construction-step>a{margin-top:3px;font-size:12px}
.construction-step>.stage-responsibility{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin-top:8px;padding-top:8px;font-size:12px}
.stage-responsibility p{margin:0}
.stage-responsibility>.stage-assignment-history{flex-basis:100%;margin-top:2px;font-size:12px}
.construction-step>.stage-payments{grid-column:auto;align-self:start;margin-top:10px;padding:10px 12px;border:1px solid #e1e8e2;background:#fafcf9;border-radius:8px;font-size:12px}
.stage-payments .actions{gap:6px;flex-wrap:wrap}
.stage-payments .actions b{font-size:12px}
.stage-payments p{margin:6px 0 0;font-size:12px;line-height:1.45}
.stage-payments-list{margin-top:8px}
.stage-payments-list table{font-size:12px}
.stage-payments-list td,.stage-payments-list th{padding:6px 8px}
.construction-photos{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;margin-top:8px}
.construction-photos .upload-thumb-media{height:100px}
.construction-photos small{font-size:11px;margin-top:4px}

/* Related forms and upload dialogs. */
#modal:has(#mortgage-upload-form,#mortgage-personal-form,#mortgage-stage-form,#construction-form) .modal-head{padding:14px 18px}
#modal:has(#mortgage-upload-form,#mortgage-personal-form,#mortgage-stage-form,#construction-form) .modal-head h2{font-size:18px;line-height:1.4}
#modal:has(#mortgage-upload-form,#mortgage-personal-form,#mortgage-stage-form,#construction-form) .modal-body{padding:16px 18px}
#mortgage-upload-form>p.muted{margin:6px 0 10px;font-size:12px;line-height:1.5}
#mortgage-upload-form>.error:empty,#mortgage-upload-status:empty{display:none}
#mortgage-upload-form>[type=submit]{margin-top:12px}
#mortgage-stage-form .formgrid{margin-top:12px}
#mortgage-stage-form .field,#mortgage-personal-form .field,#construction-form .field{margin-bottom:12px}
#mortgage-stage-form textarea,#construction-form textarea{min-height:70px}
#mortgage-personal-form .mortgage-person{padding:12px;margin:10px 0}
#construction-form>section{margin:12px 0}
#construction-form h3{font-size:14px;margin-bottom:8px}
#construction-form .formactions{margin-top:12px;display:flex;flex-wrap:wrap;gap:8px}
#construction-form .upload-previews{gap:10px;margin-top:10px}

@media(max-width:720px){
 .button,.button.small,.button.upload-button,.button.secondary.upload-button{min-height:44px;padding:8px 12px}
 details.mortgage-block>summary.panelhead{padding:10px 12px;gap:6px 10px;grid-template-columns:minmax(0,1fr) auto}
 details.mortgage-block>summary.panelhead h2{font-size:15px}
 details.mortgage-block>summary .mortgage-block-count{grid-column:1;grid-row:2;font-size:11px}
 details.mortgage-block>summary .badge{grid-column:2;grid-row:2;font-size:10px;justify-self:end}
 .mortgage-block>.panelbody{padding:10px 12px}
 .mortgage-block .mortgage-person{padding:10px;margin:10px 0}
 .mortgage-person>h3{font-size:14px}
 .mortgage-slot-head{flex-direction:row;align-items:center;gap:6px;flex-wrap:wrap}
 .mortgage-slot-head>div:first-child{flex:1 1 180px}
 .mortgage-slot-head>.actions{max-width:100%}
 .mortgage-files{grid-template-columns:minmax(0,1fr)}
 .mortgage-files .mortgage-file,.mortgage-files .mortgage-file.has-deletion-footer{padding:9px 10px;gap:2px 12px}
 .mortgage-file .document-file-actions a{min-height:44px;padding:12px 0}
 .mortgage-file .deletion-footer .deletion-button{min-width:44px;min-height:44px}
 .mortgage-inn-controls input{min-height:44px;font-size:16px}
 .construction-overview{padding:12px}
 .construction-group>summary{padding:10px 12px;gap:6px 8px;display:grid;grid-template-columns:minmax(0,1fr) auto}
 .construction-group>summary h2{font-size:15px;grid-column:1;grid-row:1}
 .construction-group>summary .badge{font-size:10px;grid-column:2;grid-row:2;justify-self:end}
 .construction-group>summary .construction-chevron{grid-column:2;grid-row:1;justify-self:end}
 .construction-count{font-size:11px;grid-column:1;grid-row:2;margin:0}
 .construction-children{padding:0 12px 4px}
 .construction-step{grid-template-columns:minmax(0,1fr);padding:10px 0}
 .construction-step-head h3{flex-basis:100%}
 .construction-step>.stage-payments{grid-column:1;margin-top:8px;padding:9px 10px}
 .stage-payments .actions{flex-direction:row;align-items:center}
 .construction-facts{grid-template-columns:minmax(0,1fr);gap:7px}
 .construction-step>.stage-responsibility{gap:6px;margin-top:6px}
 .construction-step>.construction-plan{margin:6px 0!important}
 #modal:has(#mortgage-upload-form,#mortgage-personal-form,#mortgage-stage-form,#construction-form) .modal-head,
 #modal:has(#mortgage-upload-form,#mortgage-personal-form,#mortgage-stage-form,#construction-form) .modal-body{padding:12px 14px}
}
@media(prefers-reduced-motion:reduce){.button{transition:none}}
