/* RoomScribe desktop layout patch 32 / 32A / 32B.
   Presentation only; uses the existing desktop breakpoint above 860px.
   The homepage hero remains the width reference. No DOM or behaviour changes.
   !important is limited to overriding the existing layout/inline declarations. */
@media screen and (min-width: 861px) {
  /* Match the existing 760px welcome hero, within the centred page container. */
  #rsStartMenu > .rs-start-grid,
  #rsStartMenu > #rsManualCloudSyncCard {
    width: 100%;
    max-width: 760px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
  }

  #rsStartMenu > .rs-start-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 24px !important;
  }

  #rsStartMenu > .rs-start-grid > #rsCreatePropertyForm {
    grid-column: 1 / -1 !important;
    grid-row: 1;
    min-width: 0;
  }

  #rsStartMenu > .rs-start-grid > #rsUpcomingInspectionsStage8 {
    grid-column: 1 / -1 !important;
    grid-row: 2;
    min-width: 0;
  }

  #rsStartMenu > .rs-start-grid > .rs-property-list-card:not(#rsCloudMasterLibrary) {
    grid-column: 1 / -1 !important;
    grid-row: 3;
    min-width: 0;
  }

  #rsStartMenu > .rs-start-grid > #rsCloudMasterLibrary {
    grid-column: 1 / -1 !important;
    grid-row: 4;
    min-width: 0;
  }

  #rsStartMenu > .rs-start-grid > #rsStorageQuotaCard.rs-storage-quota-card {
    grid-column: 1 / -1 !important;
    grid-row: 5;
    min-width: 0;
  }

  /* Homepage saved properties only: two equal cards across the full row. */
  #rsStartMenu #rsPropertyGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #rsStartMenu #rsPropertyGrid > .rs-property-card {
    min-width: 0;
    margin-top: 0 !important;
  }

  #rsStartMenu #rsPropertyGrid > .dm-empty-state {
    grid-column: 1 / -1;
  }

  /* Keep the existing desktop reminder rows: one day section per row, with
     each delete button beside its link and the date above the reminder text. */
  #rsStartMenu #rsUpcomingInspectionsStage8 [data-rs-upcoming-body] {
    grid-template-columns: minmax(0, 1fr);
  }

  #rsStartMenu #rsUpcomingInspectionsStage8 article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  #rsStartMenu #rsUpcomingInspectionsStage8 article > .rs-upcoming-inspection-link {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  /* Let the title/preview use the existing workspace width. Statistics stay
     in their existing DOM position, on the following row. */
  #rsWorkspace .rs-workspace-head {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #rsWorkspace .rs-workspace-head > div:first-child {
    min-width: 0;
  }

  #rsWorkspace #rsWorkspacePortfolioPreview {
    width: 100% !important;
  }

  #rsWorkspace .rs-workspace-head > .rs-workspace-kpis {
    justify-self: start;
  }

  /* Patch 34: report rows live in half-width property cards on desktop.
     Give the long save action its own line instead of squeezing the title. */
  #rsApp .rs-report-property-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  #rsApp .rs-report-property-row-copy > span { overflow-wrap: anywhere; }
  #rsApp .rs-report-property-row-actions {
    justify-content: flex-start;
    gap: 8px;
  }
  #rsApp .rs-report-property-row-actions > .rs-report-property-current {
    flex-basis: 100%;
  }
  #rsApp .rs-report-property-row-actions > .rs-report-property-open {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
  #rsApp .rs-report-property-row-actions > .rs-report-property-cloud {
    max-width: none;
    text-align: left;
  }

  /* Only the Properties screen: leave its outer container width unchanged. */
  #rsBottomPropertiesScreen #rsBottomPropertyList {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #rsBottomPropertiesScreen #rsBottomPropertyList > .rs-bottom-empty-card {
    grid-column: 1 / -1;
  }
}
