/* =========================================================
   RELAY STRATA — RISK RECORD UI POLISH
   Tightens the risk record layout and keeps actions contextual.
   ========================================================= */

/* The global risk-record header should identify the page only.
   Context-specific actions are moved into the active tab. */
.risk-record-header-actions {
  display: none !important;
}

.risk-record-header {
  margin-bottom: 20px !important;
}

/* Context actions injected into Renewal / Documents. */
.relay-risk-context-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0 0 14px;
}

.relay-risk-context-actions:empty {
  display: none;
}

/* Property panel: less whitespace, stronger data-record feel. */
.relay-property-position {
  padding: 28px 32px !important;
}

.relay-property-position > div:first-child {
  margin-bottom: 18px;
}

.relay-property-position .relay-property-heading h2 {
  margin-top: 5px !important;
  margin-bottom: 0 !important;
}

/* Core property facts: address gets more room without oversized cells. */
.relay-property-position > .relay-property-facts {
  display: grid !important;
  grid-template-columns: 2.6fr 1fr 1fr 1.25fr !important;
  gap: 0 !important;
  margin-top: 0 !important;
  border-top: 1px solid #dfe4e8;
  border-left: 1px solid #dfe4e8;
}

.relay-property-position > .relay-property-facts > .relay-property-fact {
  min-width: 0;
  min-height: 64px !important;
  padding: 13px 16px !important;
  border-right: 1px solid #dfe4e8 !important;
  border-bottom: 1px solid #dfe4e8 !important;
}

.relay-property-position > .relay-property-facts > .relay-property-fact-address {
  grid-column: auto !important;
}

/* Building characteristics: a consistent 3 x 3 grid removes the broken rows. */
#buildingDetailsContent > .relay-property-facts {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin-top: 0 !important;
  border-top: 1px solid #dfe4e8;
  border-left: 1px solid #dfe4e8;
}

#buildingDetailsContent > .relay-property-facts > .relay-property-fact {
  min-width: 0;
  min-height: 64px !important;
  padding: 13px 16px !important;
  border-right: 1px solid #dfe4e8 !important;
  border-bottom: 1px solid #dfe4e8 !important;
}

.relay-property-fact .risk-meta-label {
  display: block;
  margin-bottom: 6px !important;
}

.relay-property-fact strong {
  display: block;
  line-height: 1.3;
}

/* Tighten the construction and supporting sections. */
.relay-property-position > div[style*="margin-top:42px"] {
  margin-top: 28px !important;
}

.relay-property-position > div[style*="margin-top:42px"] > h3 {
  margin: 6px 0 12px !important;
}

#buildingDetailsContent > div[style*="margin-top:32px"] {
  margin-top: 22px !important;
  padding-top: 18px !important;
}

#buildingDetailsContent > div[style*="margin-top:24px"] {
  margin-top: 18px !important;
  padding-top: 14px !important;
}

/* Missing data should read as a task, not a passive status. */
.relay-property-fact strong.needs-confirmation {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.relay-property-fact strong.needs-confirmation::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f28a30;
  flex: 0 0 6px;
}

@media (max-width: 980px) {
  .relay-property-position > .relay-property-facts,
  #buildingDetailsContent > .relay-property-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .relay-property-position > .relay-property-facts > .relay-property-fact-address {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 640px) {
  .relay-property-position {
    padding: 22px 18px !important;
  }

  .relay-property-position > .relay-property-facts,
  #buildingDetailsContent > .relay-property-facts {
    grid-template-columns: 1fr !important;
  }

  .relay-property-position > .relay-property-facts > .relay-property-fact-address {
    grid-column: auto !important;
  }

  .relay-risk-context-actions {
    justify-content: flex-start;
  }
}
