/* v1.6.43 — global visual hard pass + overlap/spacing hardening */

/* Structural safety: every flex/grid child may shrink instead of overlapping neighbors. */
.homeaid-system *,
.homeaid-system *::before,
.homeaid-system *::after{box-sizing:border-box}
.homeaid-system .app-shell,
.homeaid-system .app-content,
.homeaid-system .content-frame,
.homeaid-system .dashboard,
.homeaid-system .premium-card,
.homeaid-system .premium-card-head,
.homeaid-system .premium-card-body,
.homeaid-system .premium-page-head,
.homeaid-system .premium-page-title,
.homeaid-system .premium-page-actions,
.homeaid-system .header-left,
.homeaid-system .header-actions,
.homeaid-system .detail-grid,
.homeaid-system .deployment-grid,
.homeaid-system .premium-metrics,
.homeaid-system .row,
.homeaid-system [class*="col-"]{min-width:0}
.homeaid-system img,.homeaid-system svg,.homeaid-system video,.homeaid-system canvas{max-width:100%}
.homeaid-system pre,.homeaid-system code,.homeaid-system .machine-code-emphasis,.homeaid-system .deployment-sha{overflow-wrap:anywhere;word-break:break-word}

/* Page rhythm. */
.homeaid-system .app-content{padding:clamp(1rem,2.2vw,1.75rem) var(--ha-content-gutter) clamp(2rem,4vw,3rem)}
.homeaid-system .content-frame{padding-inline:0}
.homeaid-system .dashboard{display:block;min-width:0}
.homeaid-system .dashboard>section+section,
.homeaid-system .dashboard>div+section,
.homeaid-system .dashboard>section+div{margin-top:1rem}
.homeaid-system .premium-page-head{align-items:flex-end;flex-wrap:wrap;row-gap:1rem;margin-bottom:1.25rem}
.homeaid-system .premium-page-title{flex:1 1 520px;max-width:min(100%,900px)}
.homeaid-system .premium-page-title h1{margin:0;line-height:1.12}
.homeaid-system .premium-page-title>p{max-width:880px;margin:.55rem 0 0;line-height:1.6}
.homeaid-system .premium-page-actions{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;gap:.625rem;row-gap:.625rem;max-width:100%;flex-wrap:wrap}
.homeaid-system .premium-page-actions>*{max-width:100%}
.homeaid-system .premium-kicker{flex-wrap:wrap;row-gap:.4rem}

/* Header: prevent top-right controls from crowding/overlapping. */
.homeaid-system .app-header{height:auto;min-height:var(--ha-header-height);padding-block:.65rem}
.homeaid-system .header-left{flex:1 1 auto;overflow:hidden}
.homeaid-system .header-copy{min-width:0}
.homeaid-system .header-title,.homeaid-system .header-caption{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.homeaid-system .header-actions{flex:0 0 auto;justify-content:flex-end;gap:.55rem}
.homeaid-system .header-actions>.btn,.homeaid-system .header-actions>.dropdown,.homeaid-system .header-actions>.workspace-status{flex:0 0 auto}
.homeaid-system .btn-icon,.homeaid-system .avatar-button{flex:0 0 40px;min-width:40px}
.homeaid-system .app-icon{flex:0 0 auto}
.homeaid-system .dropdown-menu{z-index:1085;max-width:min(92vw,360px)}
.homeaid-system .dropdown-menu.show{margin-top:.4rem!important}

/* Cards: consistent spacing and headers that wrap instead of collide. */
.homeaid-system .premium-card{overflow:visible}
.homeaid-system .premium-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;row-gap:.75rem;flex-wrap:wrap;padding:1rem 1.1rem}
.homeaid-system .premium-card-head>div:first-child{display:flex;align-items:flex-start;gap:.75rem;min-width:0;flex:1 1 360px}
.homeaid-system .premium-card-head>div:first-child>div:last-child{min-width:0;flex:1 1 auto}
.homeaid-system .premium-card-head h2,.homeaid-system .premium-card-head h3{margin:0 0 .25rem;line-height:1.3}
.homeaid-system .premium-card-head p{margin:0;max-width:920px;line-height:1.55}
.homeaid-system .premium-card-head>.status-pill,.homeaid-system .premium-card-head>.mini-chip{flex:0 1 auto;max-width:100%}
.homeaid-system .premium-card-body{padding:1rem 1.1rem}
.homeaid-system .section-icon{flex:0 0 auto}
.homeaid-system .premium-metrics{gap:.85rem}
.homeaid-system .premium-metric{min-width:0;height:100%}
.homeaid-system .premium-metric>div{min-width:0}
.homeaid-system .premium-metric strong,.homeaid-system .premium-metric small{overflow-wrap:anywhere}

/* Buttons and action toolbars. */
.homeaid-system form{min-width:0}
.homeaid-system .btn{max-width:100%;white-space:normal;text-align:center;line-height:1.25}
.homeaid-system .btn>.app-icon,.homeaid-system .btn>i{flex:0 0 auto}
.homeaid-system .dealer-actions,
.homeaid-system .smtp-diagnostic-actions,
.homeaid-system .deployment-diagnostic-actions,
.homeaid-system .deployment-profile-actions,
.homeaid-system .email-pref-actions,
.homeaid-system .modal-footer,
.homeaid-system .panel-header{gap:.625rem;row-gap:.625rem;flex-wrap:wrap}
.homeaid-system .deployment-diagnostic-actions>form,
.homeaid-system .deployment-profile-actions>form{margin:0}
.homeaid-system .deployment-action-group{display:flex;justify-content:flex-end;align-items:center;gap:.5rem;flex-wrap:wrap;min-width:max-content}
.homeaid-system .deployment-action-group form{margin:0}
.homeaid-system .deployment-release-actions{min-width:185px}

/* Form spacing: nested labels/help/error messages stay visually attached to their field. */
.homeaid-system .form-label{display:block;width:100%;margin-bottom:.9rem;line-height:1.35}
.homeaid-system .form-label>.form-control,
.homeaid-system .form-label>.form-select,
.homeaid-system .form-label>textarea,
.homeaid-system .form-label>.input-group{margin-top:.4rem}
.homeaid-system .form-label>.fine,
.homeaid-system .form-label>small{display:block;margin-top:.4rem;line-height:1.45}
.homeaid-system .form-control,.homeaid-system .form-select,.homeaid-system textarea{max-width:100%}
.homeaid-system textarea.form-control{resize:vertical}
.homeaid-system .input-group{flex-wrap:nowrap;max-width:100%}
.homeaid-system .form-validation-summary,.homeaid-system .modal-form-alert{margin:0 0 1rem}
.homeaid-system .is-invalid~.invalid-feedback,.homeaid-system .field-error{margin-top:.35rem}

/* Table/DataTable containment. */
.homeaid-system .dealer-table-wrap,
.homeaid-system .table-responsive,
.homeaid-system .deployment-diagnostic-table-wrap{width:100%;max-width:100%;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}
.homeaid-system .premium-table{width:100%;margin-bottom:0;vertical-align:middle}
.homeaid-system .premium-table th,.homeaid-system .premium-table td{padding:.78rem .8rem;line-height:1.35}
.homeaid-system .premium-table td{overflow-wrap:anywhere}
.homeaid-system .premium-table th{white-space:nowrap}
.homeaid-system .dt-container{width:100%;min-width:0}
.homeaid-system .dt-container .dt-layout-row{display:flex;align-items:center;justify-content:space-between;gap:.65rem 1rem;flex-wrap:wrap;margin:.8rem 0}
.homeaid-system .dt-container .dt-layout-cell{min-width:0;max-width:100%}
.homeaid-system .dt-container .dt-search,.homeaid-system .dt-container .dt-length{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap}
.homeaid-system .dt-container .dt-search input{max-width:min(100%,320px);margin:0}
.homeaid-system .dt-container .dt-length select{margin:0}
.homeaid-system .dt-container .dt-paging{max-width:100%;overflow-x:auto;padding-bottom:.1rem}
.homeaid-system .dt-container .dt-paging nav{display:flex;gap:.25rem;flex-wrap:wrap}

/* Status/badges: allow long labels without covering adjacent content. */
.homeaid-system .status-pill,.homeaid-system .mini-chip,.homeaid-system .release-chip,.homeaid-system .smtp-stage-code{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:center;line-height:1.25}
.homeaid-system .deployment-check-label{display:flex;align-items:center;gap:.4rem .55rem;flex-wrap:wrap}

/* Modals: true viewport-safe scroll with sticky chrome and no clipped action rows. */
.homeaid-system .modal{overflow-x:hidden;overflow-y:auto;padding:0!important}
.homeaid-system .modal-dialog{width:auto;max-width:min(960px,calc(100vw - 2rem));margin:1rem auto}
.homeaid-system .modal-dialog.modal-lg{max-width:min(980px,calc(100vw - 2rem))}
.homeaid-system .modal-dialog.modal-xl{max-width:min(1180px,calc(100vw - 2rem))}
.homeaid-system .modal-dialog-scrollable{height:auto;max-height:calc(100dvh - 2rem)}
.homeaid-system .modal-dialog-scrollable .modal-content{max-height:calc(100dvh - 2rem);overflow:hidden}
.homeaid-system .modal-content{max-width:100%;min-width:0}
.homeaid-system .modal-header{position:relative;z-index:2;display:flex;align-items:flex-start;gap:.75rem;padding:1rem 1.1rem;background:var(--bs-body-bg);border-bottom:1px solid var(--bs-border-color)}
.homeaid-system .modal-header>div,.homeaid-system .modal-title{min-width:0}
.homeaid-system .modal-header .btn-close{flex:0 0 auto;margin:0 0 0 auto}
.homeaid-system .modal-body{min-height:0;overflow-y:auto;padding:1rem 1.1rem;overscroll-behavior:contain}
.homeaid-system .modal-footer{position:relative;z-index:2;padding:.9rem 1.1rem;background:var(--bs-body-bg);border-top:1px solid var(--bs-border-color)}
.homeaid-system .modal-footer>*{margin:0}
.homeaid-system .modal .nav-tabs{gap:.25rem .4rem;flex-wrap:wrap}
.homeaid-system .modal .tab-content{min-width:0}

/* Toasts/alerts never cover the sticky header or viewport edges. */
.homeaid-system .app-toast-container{top:calc(var(--ha-header-height) + .75rem);right:max(.75rem,env(safe-area-inset-right));left:auto;width:min(390px,calc(100vw - 1.5rem));max-height:calc(100dvh - var(--ha-header-height) - 1.5rem);overflow-y:auto;z-index:1095}
.homeaid-system .alert,.homeaid-system .notice,.homeaid-system .error{overflow-wrap:anywhere}

/* Deployment dry-run UI. */
.deployment-dry-run-result{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:flex-start;gap:.85rem;padding:1rem 1.1rem;margin:0 0 1rem;border:1px solid color-mix(in srgb,#198754 38%,var(--bs-border-color));border-radius:1rem;background:color-mix(in srgb,#198754 8%,var(--bs-body-bg));box-shadow:0 10px 30px rgba(0,0,0,.035)}
.deployment-dry-run-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:.8rem;background:color-mix(in srgb,#198754 14%,var(--bs-body-bg));color:#198754}
.deployment-dry-run-icon .app-icon{width:1rem;height:1rem}
.deployment-dry-run-copy{min-width:0}
.deployment-dry-run-title{display:flex;align-items:center;justify-content:space-between;gap:.6rem;flex-wrap:wrap}
.deployment-dry-run-copy p{margin:.35rem 0 .55rem;line-height:1.5}
.deployment-dry-run-copy>small{display:block;color:var(--bs-secondary-color);overflow-wrap:anywhere}
.deployment-dry-run-metrics{display:flex;gap:.45rem;flex-wrap:wrap;margin-bottom:.5rem}
.deployment-dry-run-metrics span{display:inline-flex;align-items:center;gap:.32rem;padding:.35rem .55rem;border:1px solid var(--bs-border-color);border-radius:.6rem;background:var(--bs-body-bg);font-size:.78rem}
.deployment-dry-run-metrics b{font-size:.85rem}
.deployment-center-v1643 .deployment-overall-banner,.deployment-center-v1643 .deployment-action-error-panel,.deployment-center-v1643 .deployment-dry-run-result{max-width:100%}
.deployment-center-v1643 .deployment-health-grid,.deployment-center-v1643 .deployment-self-test-grid{align-items:stretch}
.deployment-center-v1643 .deployment-health-item,.deployment-center-v1643 .deployment-self-test article{min-width:0;height:100%}
.deployment-center-v1643 .deployment-health-footer{gap:.6rem 1rem;flex-wrap:wrap}

/* Tablet hardening. */
@media(max-width:1199.98px){
 .homeaid-system .workspace-status{display:none!important}
 .homeaid-system .premium-page-head{align-items:flex-start}
 .homeaid-system .premium-page-actions{justify-content:flex-start;width:100%}
 .homeaid-system .premium-card-head{align-items:flex-start}
 .homeaid-system .deployment-grid,.homeaid-system .detail-grid{grid-template-columns:minmax(0,1fr)!important}
 .homeaid-system .premium-metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* Mobile hardening. */
@media(max-width:767.98px){
 :root{--ha-content-gutter:clamp(.75rem,3.5vw,1rem)}
 .homeaid-system .app-header{gap:.55rem;padding-block:.55rem}
 .homeaid-system .header-left,.homeaid-system .header-actions{gap:.45rem}
 .homeaid-system .header-title{font-size:.93rem}
 .homeaid-system .btn-icon,.homeaid-system .avatar-button{width:38px;height:38px;min-width:38px;flex-basis:38px;border-radius:.68rem}
 .homeaid-system .header-actions #pwaInstallBtn{min-width:38px;padding:.45rem .6rem}
 .homeaid-system .premium-page-head{margin-bottom:1rem}
 .homeaid-system .premium-page-title{flex-basis:100%}
 .homeaid-system .premium-page-title h1{font-size:clamp(1.55rem,7vw,2rem)}
 .homeaid-system .premium-page-actions{width:100%;justify-content:flex-start}
 .homeaid-system .premium-page-actions .btn:not(.btn-icon){flex:1 1 150px}
 .homeaid-system .premium-card-head,.homeaid-system .premium-card-body{padding:.9rem}
 .homeaid-system .premium-card-head>div:first-child{flex-basis:100%}
 .homeaid-system .premium-card-head>.status-pill,.homeaid-system .premium-card-head>.mini-chip{align-self:flex-start}
 .homeaid-system .premium-metrics{grid-template-columns:minmax(0,1fr)!important;gap:.7rem}
 .homeaid-system .premium-table th,.homeaid-system .premium-table td{padding:.68rem .7rem;font-size:.82rem}
 .homeaid-system .dt-container .dt-layout-row{align-items:stretch}
 .homeaid-system .dt-container .dt-layout-cell,.homeaid-system .dt-container .dt-search,.homeaid-system .dt-container .dt-length{width:100%}
 .homeaid-system .dt-container .dt-search input{width:100%;max-width:none}
 .homeaid-system .deployment-diagnostic-actions,.homeaid-system .deployment-profile-actions,.homeaid-system .email-pref-actions{align-items:stretch}
 .homeaid-system .deployment-diagnostic-actions>form,.homeaid-system .deployment-profile-actions>form{flex:1 1 190px}
 .homeaid-system .deployment-diagnostic-actions .btn,.homeaid-system .deployment-profile-actions .btn{width:100%}
 .homeaid-system .deployment-action-group{justify-content:flex-start;min-width:0}
 .homeaid-system .deployment-action-group form{flex:1 1 110px}
 .homeaid-system .deployment-action-group .btn{width:100%}
 .homeaid-system .deployment-release-actions{min-width:220px}
 .homeaid-system .modal-dialog,.homeaid-system .modal-dialog.modal-lg,.homeaid-system .modal-dialog.modal-xl{max-width:calc(100vw - 1rem);margin:.5rem auto}
 .homeaid-system .modal-dialog-scrollable,.homeaid-system .modal-dialog-scrollable .modal-content{max-height:calc(100dvh - 1rem)}
 .homeaid-system .modal-header,.homeaid-system .modal-body,.homeaid-system .modal-footer{padding:.85rem}
 .homeaid-system .modal-footer{align-items:stretch}
 .homeaid-system .modal-footer .btn:not(.btn-icon){flex:1 1 140px}
 .homeaid-system .offcanvas.app-mobile-sidebar{width:min(88vw,360px)}
 .homeaid-system .app-toast-container{top:calc(var(--ha-header-height) + .45rem);right:.5rem;width:calc(100vw - 1rem)}
 .deployment-dry-run-result{grid-template-columns:1fr;padding:.9rem}
 .deployment-dry-run-icon{width:38px;height:38px}
}

/* Narrow phones: stack controls and protect horizontal space. */
@media(max-width:479.98px){
 .homeaid-system .header-caption{display:none!important}
 .homeaid-system .header-copy{max-width:calc(100vw - 190px)}
 .homeaid-system .premium-kicker{font-size:.62rem;letter-spacing:.09em}
 .homeaid-system .premium-page-actions>.status-pill{width:100%;justify-content:center}
 .homeaid-system .premium-card-head{gap:.65rem}
 .homeaid-system .premium-card-head>.status-pill,.homeaid-system .premium-card-head>.mini-chip{width:100%;justify-content:center}
 .homeaid-system .form-label{margin-bottom:.8rem}
 .homeaid-system .deployment-overall-banner{gap:.7rem}
 .homeaid-system .deployment-overall-banner .fallback-state{width:100%;justify-content:center}
 .homeaid-system .deployment-dry-run-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
 .homeaid-system .deployment-dry-run-metrics span{justify-content:center;text-align:center}
 .homeaid-system .modal-footer .btn:not(.btn-icon){width:100%;flex-basis:100%}
}

/* Avoid clipping focused controls behind sticky surfaces. */
.homeaid-system :where(input,select,textarea,button,a):focus-visible{scroll-margin-top:calc(var(--ha-header-height) + 1rem)}
