/* TESSIRVE Theme 5.17.290 — Main: intrinsic shared score/crest/name row.
   Names, crests, score and incident artwork keep their approved sizes/styles.
   Only the non-interactive wrappers become display:contents. The original
   DOM, selectors, match link and scorer-toggle event handling stay intact.
   Status + toggle share one lower row; empty penalties reserve no height.
   Scope: home agenda only; fixture, H2H, profile, header and footer unchanged. */

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match {
  min-height:0!important;
  row-gap:2px!important;
  padding-block:5px!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline {
  display:grid!important;
  grid-template-columns:minmax(0,1fr) max-content minmax(40px,max-content) minmax(20px,max-content) max-content minmax(0,1fr)!important;
  grid-template-rows:auto auto auto!important;
  grid-template-areas:none!important;
  align-items:center!important;
  column-gap:4px!important;
  row-gap:0!important;
  min-height:0!important;
  height:auto!important;
  overflow:visible!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > :is(span.is-home,span.is-away,.ms-compact-center),
body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > .ms-compact-center > .ms-compact-center-stack {
  display:contents!important;
}

/* Older fixed heights let a wrapped label hang below the shared row. */
body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-team-copy,
body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-team-copy > strong {
  height:auto!important;
  min-height:0!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-home > .ms-compact-team-copy {
  grid-column:1!important;
  grid-row:1!important;
  align-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-home > .ms-compact-crest-wrap {
  grid-column:2!important;
  grid-row:1!important;
  align-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-away > .ms-compact-crest-wrap {
  grid-column:5!important;
  grid-row:1!important;
  align-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-away > .ms-compact-team-copy {
  grid-column:6!important;
  grid-row:1!important;
  align-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > * {
  grid-column:3 / 5!important;
  justify-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-compact-score-row {
  grid-column:3 / 5!important;
  grid-row:1!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  justify-self:center!important;
  align-self:center!important;
  position:relative!important;
  box-sizing:content-box!important;
  width:max-content!important;
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  margin:0!important;
}

/* Reserve incident lanes only when they contain an actual VAR/red marker. */
body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match.has-ms-incidents .ms-compact-center-stack > .ms-compact-score-row {
  display:grid!important;
  grid-template-columns:18px max-content 18px!important;
  column-gap:2px!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match.has-ms-incidents .ms-compact-score-row > .ms-compact-score-pill {
  grid-column:2!important;
  grid-row:1!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-compact-pen-score {
  grid-column:3 / 5!important;
  grid-row:2!important;
  margin:0!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-compact-pen-score:empty {
  display:none!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-compact-aggregate {
  grid-row:4!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-match-status-chip {
  grid-column:3!important;
  grid-row:3!important;
  justify-self:end!important;
  align-self:center!important;
  margin:2px 0 0!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-compact-mobile-toggle {
  grid-column:4!important;
  grid-row:3!important;
  justify-self:start!important;
  align-self:center!important;
  margin:2px 0 0!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match:not(:has(.ms-compact-mobile-toggle)) .ms-compact-center-stack > .ms-match-status-chip {
  grid-column:3 / 5!important;
  justify-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-score-row > .ms-compact-red-rail {
  position:absolute!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  width:18px!important;
  min-width:18px!important;
  min-height:0!important;
  height:auto!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-score-row > .ms-compact-red-rail.is-home {
  left:0!important;
  right:auto!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-score-row > .ms-compact-red-rail.is-away {
  left:auto!important;
  right:0!important;
}

/* Flow height includes VAR + red markers instead of letting them cover the
   time/status rows when several incidents stack on the same side. */
body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match.has-ms-incidents .ms-compact-score-row > .ms-compact-red-rail {
  position:static!important;
  transform:none!important;
  grid-row:1!important;
  align-self:center!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match.has-ms-incidents .ms-compact-score-row > .ms-compact-red-rail.is-home {
  grid-column:1!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match.has-ms-incidents .ms-compact-score-row > .ms-compact-red-rail.is-away {
  grid-column:3!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-home > .ms-compact-team-goals {
  grid-column:1 / 3!important;
  grid-row:2 / 4!important;
  align-self:start!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline > span.is-away > .ms-compact-team-goals {
  grid-column:5 / 7!important;
  grid-row:2 / 4!important;
  align-self:start!important;
}

body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-footer {
  min-height:0!important;
  margin-top:1px!important;
}

/* On wider screens the existing scorer control is hidden; center the status. */
@media(min-width:681px) {
  body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match .ms-compact-center-stack > .ms-match-status-chip {
    grid-column:3 / 5!important;
    justify-self:center!important;
  }
}

@media(max-width:680px) {
  body.tessirve-theme .ms-app.ms-home-app .ms-home-today .ms-match-groups .ms-compact-match > .ms-compact-scoreline {
    column-gap:3px!important;
  }
}
