/* JKA Dealer Portal v1.6.21 — compact card density + uniform row hardening
   Keeps the compact metric-card character from v1.6.20, restores equal heights for
   sibling cards, and lets card rows automatically fill the available width based on
   the number of cards present. */

/* KPI / summary cards: content-sized instead of stretched/tall. */
body.homeaid-system .premium-metrics,
body.homeaid-system .stats{
  grid-template-columns:repeat(auto-fit,minmax(min(235px,100%),1fr))!important;
  align-items:stretch!important;
  grid-auto-rows:1fr!important;
  gap:.75rem!important;
  margin-bottom:.9rem!important;
}
body.homeaid-system .premium-metric{
  min-height:92px!important;
  height:100%!important;
  align-self:stretch!important;
  display:grid!important;
  grid-template-columns:38px minmax(0,1fr)!important;
  grid-template-rows:auto!important;
  align-items:center!important;
  justify-content:initial!important;
  align-content:center!important;
  column-gap:.72rem!important;
  row-gap:0!important;
  padding:.72rem .82rem!important;
  border-radius:.88rem!important;
  overflow:hidden;
}
body.homeaid-system .premium-metric>.metric-icon{
  grid-column:1!important;
  grid-row:1!important;
  width:38px!important;
  height:38px!important;
  min-width:38px!important;
  margin:0!important;
  border-radius:.72rem!important;
  align-self:center!important;
}
body.homeaid-system .premium-metric>div{
  grid-column:2!important;
  grid-row:1!important;
  min-width:0!important;
  align-self:center!important;
}
body.homeaid-system .premium-metric .metric-label{
  display:block!important;
  margin:0!important;
  line-height:1.2!important;
  font-size:.62rem!important;
  letter-spacing:.07em!important;
}
body.homeaid-system .premium-metric strong{
  display:block!important;
  margin:.16rem 0 .08rem!important;
  font-size:1.42rem!important;
  line-height:1!important;
  letter-spacing:-.035em!important;
}
body.homeaid-system .premium-metric small{
  display:-webkit-box!important;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  margin:0!important;
  font-size:.66rem!important;
  line-height:1.3!important;
}
body.homeaid-system .premium-metric:after{
  width:54px!important;
  height:54px!important;
  right:-20px!important;
  bottom:-22px!important;
  opacity:.5!important;
}

/* Legacy/simple dashboard stat cards receive the same compact vertical rhythm
   without assuming the premium-metric DOM structure. */
body.homeaid-system .stats>div,
body.homeaid-system .metric-card{
  min-height:92px!important;
  height:100%!important;
  align-self:stretch!important;
  padding:.78rem .9rem!important;
  border-radius:.88rem!important;
  justify-content:flex-start!important;
}
body.homeaid-system .metric-card .metric-top{margin-bottom:.48rem!important}
body.homeaid-system .metric-card .metric-value{font-size:1.5rem!important}
body.homeaid-system .metric-card .metric-label{margin-top:.3rem!important}
body.homeaid-system .metric-card .metric-note{margin-top:.12rem!important}

/* Regular content cards: keep the familiar premium design but remove surplus
   vertical air introduced by later hardening layers. */
body.homeaid-system .premium-card,
body.homeaid-system .panel-card,
body.homeaid-system .table-card,
body.homeaid-system .card{
  border-radius:.92rem!important;
}
body.homeaid-system .premium-card + .premium-card,
body.homeaid-system .card + .card{
  margin-top:.9rem!important;
}
body.homeaid-system .premium-card-head{
  padding:.82rem 1rem!important;
  gap:.78rem!important;
}
body.homeaid-system .premium-card-head>div:first-child{gap:.68rem!important}
body.homeaid-system .premium-card-head h2,
body.homeaid-system .premium-card-head h3{margin-bottom:.12rem!important}
body.homeaid-system .premium-card-head p{line-height:1.42!important}
body.homeaid-system .premium-card-body{padding:.92rem 1rem 1rem!important}
body.homeaid-system .section-icon{
  width:36px!important;
  height:36px!important;
  min-width:36px!important;
  border-radius:.7rem!important;
}

/* Keep adjacent sections visually connected instead of creating large dead bands. */
body.homeaid-system .premium-lower-grid,
body.homeaid-system .dealer-dashboard-grid,
body.homeaid-system .request-detail-grid,
body.homeaid-system .detail-grid{
  gap:.9rem!important;
  margin-top:.9rem!important;
}
body.homeaid-system .premium-card.mt-3,
body.homeaid-system .detail-grid.mt-3{margin-top:.9rem!important}

/* When cards share the same grid row, keep a uniform height without returning
   to the oversized/tall look from older regressions. */
body.homeaid-system .detail-grid,
body.homeaid-system .premium-lower-grid,
body.homeaid-system .dealer-dashboard-grid,
body.homeaid-system .request-detail-grid{
  align-items:stretch!important;
}
body.homeaid-system .detail-grid > .premium-card,
body.homeaid-system .premium-lower-grid > .premium-card,
body.homeaid-system .dealer-dashboard-grid > .premium-card,
body.homeaid-system .request-detail-grid > .premium-card{
  height:100%!important;
  display:flex!important;
  flex-direction:column!important;
}
body.homeaid-system .detail-grid > .premium-card > .premium-card-body,
body.homeaid-system .premium-lower-grid > .premium-card > .premium-card-body,
body.homeaid-system .dealer-dashboard-grid > .premium-card > .premium-card-body,
body.homeaid-system .request-detail-grid > .premium-card > .premium-card-body{
  flex:1 1 auto!important;
}

/* The Email Center was the clearest regression: no oversized KPI strip. */
body.homeaid-system .email-center-v1619>.premium-metrics{
  margin-top:0!important;
  margin-bottom:.75rem!important;
}
body.homeaid-system .email-center-v1619>.premium-metrics + .premium-card{
  margin-top:.75rem!important;
}

/* Tablet: retain compact rows and avoid stretched grid items. */
@media(max-width:991.98px){
  body.homeaid-system .premium-metrics,
  body.homeaid-system .stats{gap:.65rem!important}
  body.homeaid-system .premium-metric{padding:.68rem .75rem!important}
}

/* Phone: one compact horizontal KPI row per card. This is intentionally not
   the old tall centered mobile card layout. */
@media(max-width:575.98px){
  body.homeaid-system .premium-metrics,
  body.homeaid-system .stats{
    grid-template-columns:1fr!important;
    grid-auto-rows:auto!important;
    gap:.5rem!important;
    margin-bottom:.7rem!important;
  }
  body.homeaid-system .premium-metric{
    grid-template-columns:34px minmax(0,1fr)!important;
    min-height:0!important;
    height:auto!important;
    padding:.6rem .68rem!important;
    border-radius:.78rem!important;
  }
  body.homeaid-system .premium-metric>.metric-icon{
    width:34px!important;
    height:34px!important;
    min-width:34px!important;
    border-radius:.65rem!important;
  }
  body.homeaid-system .premium-metric strong{font-size:1.25rem!important;margin:.11rem 0 .05rem!important}
  body.homeaid-system .premium-metric small{font-size:.64rem!important;-webkit-line-clamp:1}
  body.homeaid-system .premium-card-head{padding:.72rem .78rem!important}
  body.homeaid-system .premium-card-body{padding:.78rem!important}
  body.homeaid-system .premium-card + .premium-card,
  body.homeaid-system .card + .card{margin-top:.7rem!important}
  body.homeaid-system .premium-lower-grid,
  body.homeaid-system .dealer-dashboard-grid,
  body.homeaid-system .request-detail-grid,
  body.homeaid-system .detail-grid{gap:.7rem!important;margin-top:.7rem!important}
}
