/* JKA Dealer Portal v1.6.25 — structural card layout hardening
   This is a structural fix, not another generic height override. Explicit visual rows
   own their sizing so paired cards align exactly while useful controls consume any
   extra height. Stacked tablet/mobile cards always return to natural height. */

/* --------------------------------------------------------------------------
   GLOBAL VISUAL RHYTHM
   -------------------------------------------------------------------------- */
body.homeaid-system .dashboard{min-width:0!important}
body.homeaid-system .premium-card,
body.homeaid-system .settings-save-bar{min-width:0!important}
body.homeaid-system .premium-card-head,
body.homeaid-system .premium-card-body{min-width:0!important}
body.homeaid-system .premium-card-head{padding:.78rem .92rem!important}
body.homeaid-system .premium-card-body{padding:.86rem .92rem .92rem!important}
body.homeaid-system .premium-card-head p{margin:.08rem 0 0!important}
body.homeaid-system .premium-card-head h2,
body.homeaid-system .premium-card-head h3{margin:0!important}
body.homeaid-system .form-label{margin-bottom:.58rem!important}
body.homeaid-system .form-text{margin-top:.26rem!important}

/* --------------------------------------------------------------------------
   COMPANY & SYSTEM SETTINGS — EXPLICIT VISUAL ROWS
   -------------------------------------------------------------------------- */
body.homeaid-system .system-settings-page .settings-card-layout{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:.82rem!important;
  width:100%!important;
}
body.homeaid-system .system-settings-page .settings-card-pair{
  display:grid!important;
  align-items:stretch!important;
  gap:.82rem!important;
  min-width:0!important;
}
body.homeaid-system .system-settings-page .settings-identity-pair{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
body.homeaid-system .system-settings-page .settings-product-support-pair{
  grid-template-columns:minmax(0,7fr) minmax(0,5fr)!important;
}
body.homeaid-system .system-settings-page .settings-card-pair > [class*="col-"]{
  display:flex!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  padding:0!important;
  margin:0!important;
}
body.homeaid-system .system-settings-page .settings-card-pair .settings-card{
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  margin:0!important;
}
body.homeaid-system .system-settings-page .settings-card .premium-card-head{
  flex:0 0 auto!important;
}
body.homeaid-system .system-settings-page .settings-card .premium-card-body{
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.homeaid-system .system-settings-page .settings-fields{
  flex:1 1 auto!important;
  min-height:0!important;
  margin:0!important;
}

/* System identity has fewer controls than Company identity. Its description is
   the useful expandable control, so it absorbs the equal-height difference. */
body.homeaid-system .system-settings-page .settings-fields-system{
  display:grid!important;
  grid-template-columns:minmax(0,2fr) minmax(0,1fr)!important;
  grid-template-rows:auto minmax(132px,1fr) auto!important;
  column-gap:.72rem!important;
  row-gap:.72rem!important;
  height:100%!important;
  align-items:stretch!important;
}
body.homeaid-system .system-settings-page .settings-fields-system > *{
  width:auto!important;
  max-width:none!important;
  padding:0!important;
  margin:0!important;
}
body.homeaid-system .system-settings-page .settings-fields-system > .col-md-8{grid-column:1!important}
body.homeaid-system .system-settings-page .settings-fields-system > .col-md-4{grid-column:2!important}
body.homeaid-system .system-settings-page .settings-fields-system > .col-12{
  grid-column:1/-1!important;
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.homeaid-system .system-settings-page .settings-fields-system > .col-12 textarea{
  flex:1 1 auto!important;
  min-height:118px!important;
  height:100%!important;
  max-height:none!important;
}
body.homeaid-system .system-settings-page .settings-fields-system > .col-md-6{
  width:auto!important;
  max-width:none!important;
  padding:0!important;
  margin:0!important;
}

/* Company card remains the content-height reference for the first row. */
body.homeaid-system .system-settings-page .settings-fields-company{
  align-content:start!important;
  row-gap:.7rem!important;
  height:auto!important;
}
body.homeaid-system .system-settings-page .settings-fields-company textarea{
  min-height:76px!important;
}

/* Support has fewer controls than Product information. Spread the three real
   controls through the available body instead of leaving a dead block at bottom. */
body.homeaid-system .system-settings-page .settings-fields-support{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:repeat(3,minmax(0,1fr))!important;
  gap:.7rem!important;
  height:100%!important;
  align-items:center!important;
}
body.homeaid-system .system-settings-page .settings-fields-support > *{
  width:auto!important;
  max-width:none!important;
  padding:0!important;
  margin:0!important;
  align-self:center!important;
}
body.homeaid-system .system-settings-page .settings-fields-product{
  align-content:start!important;
  row-gap:.7rem!important;
}
body.homeaid-system .system-settings-page .settings-fields-product textarea{
  min-height:68px!important;
}

body.homeaid-system .system-settings-page .settings-save-bar{
  margin-top:.72rem!important;
  padding:.68rem .82rem!important;
}
body.homeaid-system .system-settings-page .notification-settings-card,
body.homeaid-system .system-settings-page .settings-branding-card{
  margin-top:.72rem!important;
}
body.homeaid-system .system-settings-page .notification-settings-card .premium-card-body{
  padding-top:.78rem!important;
}
body.homeaid-system .system-settings-page .notification-settings-card .row.g-4{
  --bs-gutter-x:.9rem!important;
  --bs-gutter-y:.72rem!important;
}
body.homeaid-system .system-settings-page .notification-channel-toggle{
  padding:.62rem .7rem!important;
}
body.homeaid-system .system-settings-page .notification-recipient-card{margin-bottom:.62rem!important}

/* --------------------------------------------------------------------------
   EMAIL CENTER — TRUE PAIRED ROW, NO DEAD SPACE
   -------------------------------------------------------------------------- */
body.homeaid-system .email-center-v1619 .email-compose-settings-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-auto-rows:1fr!important;
  align-items:stretch!important;
  gap:.72rem!important;
  margin-top:.72rem!important;
}
body.homeaid-system .email-center-v1619 .email-compose-settings-grid > .premium-card{
  display:flex!important;
  flex-direction:column!important;
  height:100%!important;
  min-height:0!important;
  align-self:stretch!important;
  margin:0!important;
}
body.homeaid-system .email-center-v1619 .email-compose-settings-grid > .premium-card > .premium-card-body{
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.homeaid-system .email-center-v1619 .email-compose-card .premium-card-body > form{
  display:grid!important;
  grid-template-rows:auto auto minmax(150px,1fr) auto!important;
  gap:.38rem!important;
  flex:1 1 auto!important;
  min-height:0!important;
  height:100%!important;
}
body.homeaid-system .email-center-v1619 .email-compose-card .premium-card-body > form > .form-label{
  margin:0!important;
}
body.homeaid-system .email-center-v1619 .email-compose-card .email-message-field{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.homeaid-system .email-center-v1619 .email-compose-card .email-compose-message{
  flex:1 1 auto!important;
  min-height:132px!important;
  height:100%!important;
  max-height:none!important;
  margin-bottom:0!important;
  resize:vertical!important;
}
body.homeaid-system .email-center-v1619 .email-compose-card .btn.w-100{
  margin:0!important;
  min-height:40px!important;
}
body.homeaid-system .email-center-v1619 .email-preferences-card .premium-card-body{
  justify-content:space-between!important;
}
body.homeaid-system .email-center-v1619 .email-preferences-form{
  display:grid!important;
  grid-template-rows:repeat(4,minmax(58px,1fr)) auto!important;
  gap:.42rem!important;
  flex:1 1 auto!important;
  min-height:0!important;
  margin:0!important;
}
body.homeaid-system .email-center-v1619 .email-pref-row{
  height:100%!important;
  min-height:58px!important;
  margin:0!important;
  padding:.58rem .72rem!important;
  align-items:center!important;
}
body.homeaid-system .email-center-v1619 .email-pref-actions{
  margin:.2rem 0 0!important;
  padding-top:.12rem!important;
}
body.homeaid-system .email-center-v1619 .email-preferences-card hr{
  margin:.52rem 0!important;
}
body.homeaid-system .email-center-v1619 .email-security-note{
  margin:0!important;
  line-height:1.35!important;
}
body.homeaid-system .email-center-v1619 .email-compose-settings-grid + .email-delivery-history-card{
  margin-top:.72rem!important;
}

/* --------------------------------------------------------------------------
   RESPONSIVE — NATURAL HEIGHT WHEN STACKED
   -------------------------------------------------------------------------- */
@media(max-width:1199.98px){
  body.homeaid-system .system-settings-page .settings-card-pair{
    grid-template-columns:minmax(0,1fr)!important;
    gap:.68rem!important;
  }
  body.homeaid-system .system-settings-page .settings-card-pair .settings-card{
    height:auto!important;
  }
  body.homeaid-system .system-settings-page .settings-fields-system{
    display:flex!important;
    height:auto!important;
    margin-left:calc(-.5 * var(--bs-gutter-x))!important;
    margin-right:calc(-.5 * var(--bs-gutter-x))!important;
  }
  body.homeaid-system .system-settings-page .settings-fields-system > *{
    padding-left:calc(var(--bs-gutter-x) * .5)!important;
    padding-right:calc(var(--bs-gutter-x) * .5)!important;
  }
  body.homeaid-system .system-settings-page .settings-fields-system > .col-12{display:block!important}
  body.homeaid-system .system-settings-page .settings-fields-system > .col-12 textarea{
    min-height:88px!important;
    height:auto!important;
  }
  body.homeaid-system .system-settings-page .settings-fields-support{
    display:flex!important;
    height:auto!important;
    margin-left:calc(-.5 * var(--bs-gutter-x))!important;
    margin-right:calc(-.5 * var(--bs-gutter-x))!important;
  }
  body.homeaid-system .system-settings-page .settings-fields-support > *{
    width:100%!important;
    padding-left:calc(var(--bs-gutter-x) * .5)!important;
    padding-right:calc(var(--bs-gutter-x) * .5)!important;
  }
}

@media(max-width:850px){
  body.homeaid-system .email-center-v1619 .email-compose-settings-grid{
    grid-template-columns:minmax(0,1fr)!important;
    grid-auto-rows:auto!important;
    gap:.62rem!important;
  }
  body.homeaid-system .email-center-v1619 .email-compose-settings-grid > .premium-card{height:auto!important}
  body.homeaid-system .email-center-v1619 .email-compose-card .premium-card-body > form{
    display:flex!important;
    flex-direction:column!important;
    gap:0!important;
    height:auto!important;
  }
  body.homeaid-system .email-center-v1619 .email-compose-card .email-compose-message{
    height:132px!important;
    min-height:120px!important;
    max-height:220px!important;
  }
  body.homeaid-system .email-center-v1619 .email-preferences-form{
    display:block!important;
  }
  body.homeaid-system .email-center-v1619 .email-pref-row{height:auto!important;margin-bottom:.46rem!important}
}

@media(max-width:575.98px){
  body.homeaid-system .premium-card-head{padding:.68rem .72rem!important}
  body.homeaid-system .premium-card-body{padding:.72rem!important}
  body.homeaid-system .system-settings-page .settings-card-layout{gap:.58rem!important}
  body.homeaid-system .system-settings-page .settings-card-pair{gap:.58rem!important}
  body.homeaid-system .system-settings-page .settings-save-bar,
  body.homeaid-system .system-settings-page .notification-settings-card,
  body.homeaid-system .system-settings-page .settings-branding-card{margin-top:.58rem!important}
}
