/* Track Mishnah UI 2.17.19
 * Corrective release for v2.17.18: restore the approved v2.17.17 dashboard
 * proportions and keep the memorial pop-out entirely inside the left rail.
 * Signed-out/auth refresh and private release notes from v2.17.18 are retained.
 */

@media (min-width: 1220px) {
  /* Undo ONLY the dashboard stretching introduced in v2.17.18. Earlier
   * v2.17.16/v2.17.17 sizing remains the source of truth. */
  body.app-theme-jewel .dashboard-primary-workspace > .project-overview {
    height: auto !important;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    overflow: visible !important;
    scrollbar-gutter: auto;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    min-height: 0;
    grid-template-rows: none !important;
    align-items: initial;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-card {
    height: auto !important;
    align-content: initial;
  }

  /* The rail itself may expose popovers, but the memorial panel is constrained
   * to the rail's width so it can never cover the dashboard. */
  body.app-theme-jewel .tm-memorial-sidebar { overflow: visible !important; }

  body.app-theme-jewel .tm-sidebar-memorial-popout {
    right: 10px;
    left: 10px;
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel {
    top: auto !important;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0 !important;
    width: auto !important;
    min-height: 188px;
    padding: 28px 12px 16px;
    color: #f7efe0;
    border-color: var(--tm-memorial-gold-line);
    background: #073d2e;
    box-shadow: 0 16px 34px rgb(0 16 10 / 28%);
    transform: none !important;
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel::before {
    border-color: rgb(196 163 90 / 38%);
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-mark {
    background: #073d2e;
  }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-kicker { color: #d8b45b; }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-hebrew { color: #f0c85e; font-size: .78rem; }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-copy { color: #eee4d2; font-size: .62rem; line-height: 1.55; }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-rule { background: #c4a35a; }
}

@media (min-width: 1220px) and (max-height: 759px) {
  /* Keep the trigger vertically centered on short desktops too; unlike
   * v2.17.18, do not return it to document flow. */
  body.app-theme-jewel .tm-sidebar-memorial-popout {
    position: absolute;
    top: 50%;
    right: 10px;
    left: 10px;
    margin: 0;
    transform: translateY(-50%);
  }
  body.app-theme-jewel .tm-sidebar-memorial-panel {
    top: auto !important;
    bottom: calc(100% + 8px);
    transform: none !important;
  }
}
