/* House management: scoped workspace, preserving existing record editors. */
#houseDetailModal { padding: 20px; }
#houseDetailModal .hm-workspace { width: min(1380px, 100%); max-width: 1380px; height: calc(100dvh - 40px); max-height: none; display:flex; flex-direction:column; border-radius:18px; overflow:hidden; background:var(--card,#fff); }
#houseDetailModal .modal-header { flex-shrink:0; padding:22px 28px; border-bottom:1px solid var(--border); }
#houseDetailModal .hm-workspace { padding:0; margin:0; resize:none; }
#houseDetailModal .modal-header h2 { font-size:25px; letter-spacing:-.5px; }
.hm-workspace-body { display:grid; grid-template-columns:210px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; min-height:0; flex:1; }
.hm-house-details { grid-column:1/-1; padding:10px 28px; border-bottom:1px solid var(--border); font-size:12px; background:var(--bg,#f7f9fb); max-height:170px; overflow:auto; }
.hm-house-details summary { cursor:pointer; color:var(--muted); }
#houseDetailModal .hh-tabs { grid-column:1; grid-row:2; display:flex; flex-direction:column; flex-wrap:nowrap; align-items:stretch; gap:5px; padding:20px 14px; margin:0!important; border:0; border-right:1px solid var(--border); overflow:auto; background:var(--bg,#f7f9fb); }
#houseDetailModal .hh-tab { border:0; border-radius:8px; padding:12px 13px; display:flex; justify-content:space-between; align-items:center; gap:6px; text-align:left; font-size:13px; min-height:44px; color:var(--muted); }
#houseDetailModal .hh-tab.active { background:var(--navy,#0b2545); color:white; font-weight:650; }
#houseDetailModal .hh-tab:hover:not(.active) { background:var(--card,#fff); color:var(--ink); }
.hm-nav-count { border-radius:5px; padding:1px 6px; font-size:11px; background:rgba(120,140,150,.17); color:inherit; }
.hm-nav-count .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.hm-content { grid-column:2; grid-row:2; overflow:auto; padding:28px; min-width:0; background:var(--bg,#f6f8fa); }
.hm-intro { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:24px; }
.hm-eyebrow { font-size:10px!important; font-weight:750; letter-spacing:1.7px; color:var(--teal)!important; margin:0 0 8px!important; }
.hm-intro h3 { font-size:29px; letter-spacing:-.8px; color:var(--navy); margin:0 0 8px; }
.hm-intro p,.hm-section-heading p { font-size:13px; line-height:1.6; color:var(--muted); margin:0; }
.hm-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.hm-stat { background:var(--card,#fff); border:1px solid var(--border); border-radius:12px; padding:20px; display:flex; flex-direction:column; align-items:flex-start; gap:5px; font:inherit; color:var(--ink); text-align:left; }
.hm-stat strong { font-size:30px; line-height:1.15; font-weight:650; color:var(--navy); }
.hm-stat span { font-size:12px; color:var(--muted); }
.hm-stat-late { border-left:3px solid #bd634c; }
.hm-stat-late strong { color:#a34c38; }
button.hm-stat { cursor:pointer; }
.hm-columns { display:grid; grid-template-columns:1.15fr 1fr; gap:20px; margin-bottom:24px; }
.hm-card { padding:20px; border:1px solid var(--border); border-radius:12px; background:var(--card,#fff); min-width:0; }
.hm-card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.hm-card-head h4 { margin:0; font-size:15px; color:var(--navy); font-weight:650; }
.hm-card-head>span { font-size:11px; color:var(--muted); }
.hm-help { font-size:11px; color:var(--muted); line-height:1.6; margin:7px 0 14px; }
.hm-record { display:flex; width:100%; align-items:center; justify-content:space-between; gap:12px; background:transparent; border:0; border-top:1px solid var(--border); padding:14px 0; text-align:left; font:inherit; color:var(--ink); cursor:pointer; }
.hm-record:hover { background:var(--bg,#f7f9fb); }
.hm-record>span:first-child { min-width:0; flex:1; }
.hm-record strong { display:block; font-size:12px; font-weight:600; line-height:1.5; overflow-wrap:anywhere; }
.hm-record small { display:block; font-size:10.5px; line-height:1.6; color:var(--muted); margin-top:4px; }
.hm-tag { display:inline-block; border-radius:5px; padding:4px 7px; background:#edf3f4; color:#37666a; font-size:10px; white-space:nowrap; }
.hm-tag-late { background:#fcf0eb; color:#a34c38; }
.hm-section-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.hm-section { border:1px solid var(--border); border-radius:8px; background:transparent; padding:15px; cursor:pointer; text-align:left; color:var(--ink); font:inherit; }
.hm-section:hover { border-color:var(--teal); background:var(--bg,#f7f9fb); }
.hm-section strong { display:flex; justify-content:space-between; gap:6px; font-size:12px; margin-bottom:8px; }
.hm-section strong span { color:var(--teal); }
.hm-section small { display:block; font-size:11px; line-height:1.55; color:var(--muted); }
.hm-directory { margin-bottom:16px; }
.hm-empty { font-size:13px; line-height:1.6; padding:16px 0; color:var(--muted); }
.hm-warning { border:1px solid #e8cf93; background:#fff9eb; border-radius:8px; padding:13px; margin-bottom:18px; font-size:12px; line-height:1.6; color:#765716; }
.hm-section-heading { margin-bottom:24px; }
.hm-section-heading h3 { font-size:24px; color:var(--navy); margin:0 0 8px; }
#houseDetailModal .modal-actions { grid-column:1/-1; margin:0; padding:12px 28px; border-top:1px solid var(--border); background:var(--card,#fff); display:flex; align-items:center; justify-content:space-between; }
.hm-admin-options { font-size:12px; color:var(--muted); }
.hm-admin-options summary { cursor:pointer; }
.hm-admin-options[open] { display:flex; }
.hm-filters { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; padding:16px; margin-bottom:20px; border:1px solid var(--border); border-radius:10px; background:var(--card,#fff); }
.hm-filters label { display:flex; flex-direction:column; gap:6px; font-size:11px; color:var(--muted); }
.hm-filters label:first-child { flex:1; min-width:180px; }
.hm-filters input,.hm-filters select { width:100%; min-height:40px; font:inherit; font-size:12px; padding:8px; border:1px solid var(--border); border-radius:6px; background:var(--card,#fff); color:var(--ink); }
.hm-filters>span { font-size:11px; color:var(--muted); flex-basis:100%; }
#houseDetailModal [hidden] { display:none!important; }
#houseDetailModal .hh-list-row { background:var(--card,#fff); margin-bottom:8px; padding:15px; border:1px solid var(--border); border-radius:8px; }
#houseDetailModal .hh-list-row-title { font-size:13px; }
#houseDetailModal .hh-list-row-meta { line-height:1.7; font-size:11px; }
#houseDetailModal .hh-list-row-actions { flex-wrap:wrap; }
#houseDetailModal .hh-tab-select { display:none; }
#houseDetailModal button:focus-visible,#houseDetailModal summary:focus-visible { outline:3px solid var(--teal,#207c81); outline-offset:3px; }
#houses .house-tile { padding:25px; border-radius:14px; border-top:3px solid var(--teal); }
#houses .house-tile-name { font-size:23px; }
.hm-med-filters { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.hm-med-filters label { display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); }
.hm-med-filters input,.hm-med-filters select { font:inherit; color:var(--ink); background:var(--card,#fff); border:1px solid var(--border); border-radius:8px; padding:10px; min-height:44px; max-width:100%; }
.hm-med-navigation { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.hm-med-day-title { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:24px 0 16px; }
.hm-med-day-title h4 { margin:0; font-size:19px; color:var(--navy); }
.hm-med-day-title span,[data-med-status] { font-size:12px; color:var(--muted); }
.hm-med-client { margin-bottom:16px; }
.hm-med-entry { border-top:1px solid var(--border); }
.hm-med-entry>summary { padding:16px 0; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; cursor:pointer; }
.hm-med-entry>summary>span:first-child { flex:1; min-width:0; }
.hm-med-entry>summary strong { display:block; font-size:13px; }
.hm-med-entry>summary small { display:block; font-size:11px; line-height:1.6; color:var(--muted); margin-top:6px; }
.hm-med-entry>summary::after { content:'⌄'; }
.hm-med-entry[open]>summary::after { content:'⌃'; }
.hm-med-detail { padding:14px 18px; margin-bottom:14px; background:var(--bg,#f7f8fa); border-radius:8px; font-size:13px; line-height:1.65; overflow-wrap:anywhere; }
.hm-med-detail ul { padding-left:20px; }
.hm-med-detail li { margin-bottom:12px; }
.hm-med-detail p { margin:7px 0; }
.hm-med-signature { width:260px; height:100px; max-width:100%; object-fit:contain; background:#fff; border:1px solid var(--border); }
@media(max-width:700px) {
 .hm-med-filters label { flex:1; min-width:130px; }
 .hm-med-filters button { width:100%; }
 .hm-med-day-title { flex-wrap:wrap; }
 .hm-med-entry>summary { flex-wrap:wrap; gap:8px; }
 .hm-med-entry>summary>span:first-child { flex-basis:100%; }
 .hm-med-detail { padding:12px; }
}
@media (max-width:1050px) {
 .hm-workspace-body { grid-template-columns:180px minmax(0,1fr); }
 .hm-columns { grid-template-columns:1fr; }
 .hm-section-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .hm-content { padding:20px; }
 .hm-stats { gap:8px; }
 .hm-stat { padding:14px; }
}
@media (max-width:700px) {
 #houseDetailModal { padding:0; }
 #houseDetailModal .hm-workspace { height:100dvh; max-height:100dvh; border-radius:0; }
 #houseDetailModal .modal-header { padding:16px; }
 .hm-workspace-body { display:flex; flex-direction:column; }
 .hm-house-details { padding:10px 16px; flex-shrink:0; }
 #houseDetailModal .hh-tabs { display:none; }
 #houseDetailModal .hh-tab-select { display:block; margin:12px 16px; width:calc(100% - 32px); min-height:44px; flex-shrink:0; }
 .hm-content { padding:16px; flex:1; }
 .hm-intro { flex-direction:column; gap:12px; }
 .hm-intro h3 { font-size:25px; }
 .hm-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .hm-card { padding:16px; }
 .hm-columns { gap:16px; }
 .hm-section-grid { gap:8px; }
 .hm-section { padding:12px; }
 .hm-record { align-items:flex-start; gap:7px; }
 .hm-tag { font-size:9px; }
 #houseDetailModal .modal-actions { padding:10px 16px; flex-shrink:0; }
 #houseDetailModal .hh-list-row { display:block; }
 #houseDetailModal .hh-list-row-actions { margin-top:12px; }
}
