/* JKA Dealer Portal v1.6.23 — mixed-content grid + spacing hardening
   Final override loaded after v1.6.22. Equal-height behavior remains mandatory for
   homogeneous card rows (KPIs, repeated summaries), while mixed-purpose content
   grids use natural card heights to prevent dead/blank space. */

/* Mixed-purpose rows: align cards at the top and let each card size to its own content. */
body.homeaid-system .mixed-content-grid,
body.homeaid-system .email-compose-settings-grid{
  align-items:start!important;
  grid-auto-rows:auto!important;
}
body.homeaid-system .mixed-content-grid > .premium-card,
body.homeaid-system .email-compose-settings-grid > .premium-card{
  height:auto!important;
  align-self:start!important;
  min-height:0!important;
}
body.homeaid-system .mixed-content-grid > .premium-card > .premium-card-body,
body.homeaid-system .email-compose-settings-grid > .premium-card > .premium-card-body{
  flex:0 1 auto!important;
}

/* Email Center: keep the composer useful without allowing it to dominate the row. */
body.homeaid-system .email-compose-card .email-compose-message{
  min-height:138px!important;
  height:clamp(138px,18vh,190px)!important;
  max-height:260px!important;
  resize:vertical;
}
body.homeaid-system .email-compose-card .form-label:last-of-type{margin-bottom:.55rem!important}
body.homeaid-system .email-compose-card .btn.w-100{margin-top:.1rem!important}
body.homeaid-system .email-preferences-card .email-pref-actions{margin-top:.72rem!important}
body.homeaid-system .email-preferences-card hr{margin:.72rem 0!important}
body.homeaid-system .email-preferences-card .email-security-note{line-height:1.4!important}

/* Follow-on sections should sit tightly beneath mixed rows. */
body.homeaid-system .mixed-content-grid + .premium-card,
body.homeaid-system .email-compose-settings-grid + .premium-card{
  margin-top:.72rem!important;
}

/* Homogeneous KPI/summary groups remain equal-height and full-width. */
body.homeaid-system .premium-metrics{
  align-items:stretch!important;
  grid-auto-rows:1fr!important;
  grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))!important;
}
body.homeaid-system .premium-metrics > .premium-metric{
  height:100%!important;
  align-self:stretch!important;
}

@media(max-width:991.98px){
  body.homeaid-system .email-compose-card .email-compose-message{
    height:150px!important;
    min-height:130px!important;
  }
}

@media(max-width:575.98px){
  body.homeaid-system .mixed-content-grid,
  body.homeaid-system .email-compose-settings-grid{align-items:stretch!important}
  body.homeaid-system .mixed-content-grid > .premium-card,
  body.homeaid-system .email-compose-settings-grid > .premium-card{width:100%!important;height:auto!important}
  body.homeaid-system .email-compose-card .email-compose-message{
    height:132px!important;
    min-height:120px!important;
    max-height:220px!important;
  }
  body.homeaid-system .mixed-content-grid + .premium-card,
  body.homeaid-system .email-compose-settings-grid + .premium-card{margin-top:.62rem!important}
}
