/* Track Mishnah UI 2.17.20
 * Fixed full memorial, floating account menu, and a better balanced dashboard.
 * Presentation-only: no database/schema, assignment, reminder, permission,
 * export, or messaging-data behavior changes.
 */

@media (min-width: 1220px) {
  /* Keep the full memorial permanently visible and fixed within the sidebar.
   * It is intentionally independent of the utility cluster so project/account
   * controls cannot push it around. */
  body.app-theme-jewel .tm-sidebar-memorial-fixed {
    position: absolute;
    top: 47%;
    right: 10px;
    left: 10px;
    z-index: 4;
    min-height: 194px;
    margin: 0 !important;
    padding: 31px 12px 16px;
    align-content: center;
    transform: translateY(-50%);
    background: #073d2e;
    box-shadow: 0 10px 28px rgb(0 18 12 / 18%);
  }

  body.app-theme-jewel .tm-sidebar-memorial-fixed .tm-sidebar-memorial-kicker,
  body.app-theme-jewel .tm-sidebar-memorial-fixed .tm-sidebar-memorial-hebrew,
  body.app-theme-jewel .tm-sidebar-memorial-fixed .tm-sidebar-memorial-copy {
    position: relative;
    z-index: 1;
  }

  /* The account options should behave like a pop-out, not expand the rail. */
  body.app-theme-jewel .tm-sidebar-account {
    position: relative;
    z-index: 45;
  }

  body.app-theme-jewel .tm-sidebar-account-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 7px);
    left: 0;
    z-index: 55;
    display: grid;
    gap: 3px;
    padding: 5px;
    border: 1px solid rgb(196 163 90 / 52%);
    border-radius: 7px;
    background: #0a4736;
    box-shadow: 0 14px 30px rgb(0 14 9 / 30%);
  }

  body.app-theme-jewel .tm-sidebar-account-panel::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: -5px;
    width: 9px;
    height: 9px;
    border-right: 1px solid rgb(196 163 90 / 52%);
    border-bottom: 1px solid rgb(196 163 90 / 52%);
    background: #0a4736;
    transform: rotate(45deg);
  }

  body.app-theme-jewel .tm-sidebar-account-panel a,
  body.app-theme-jewel .tm-sidebar-account-panel button {
    min-height: 34px;
    padding: 6px 9px;
    color: #f1e8d7;
    border: 1px solid transparent;
    border-radius: 5px;
  }

  body.app-theme-jewel .tm-sidebar-account-panel a:hover,
  body.app-theme-jewel .tm-sidebar-account-panel button:hover {
    color: #fff8ea;
    border-color: rgb(196 163 90 / 34%);
    background: #0b513d;
  }

  /* Slightly more room for the dashboard, while My Learning remains primary. */
  body.app-theme-jewel .dashboard-primary-workspace {
    grid-template-columns: minmax(430px, 1.02fr) minmax(0, 1.98fr);
    gap: 10px;
  }

  /* Match the right-side work surface height without changing the internal
   * stack into another horizontal grid. */
  body.app-theme-jewel .dashboard-primary-workspace > .project-overview {
    height: var(--tm-dashboard-workspace-height) !important;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    gap: 7px;
    overflow: hidden !important;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    min-height: 0;
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-card {
    height: 100% !important;
    min-height: 0 !important;
    align-content: center;
  }

  /* Give the wider cards a touch more breathing room than v2.17.16 while
   * retaining its compact fit. */
  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-card {
    padding: 8px 10px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-card-heading h2 {
    font-size: .86rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-copy h3 {
    font-size: .86rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-copy p,
  body.app-theme-jewel .dashboard-primary-workspace .personal-progress-lead,
  body.app-theme-jewel .dashboard-primary-workspace .personal-goal-note,
  body.app-theme-jewel .dashboard-primary-workspace .progress-segment-legend,
  body.app-theme-jewel .dashboard-primary-workspace .progress-legend,
  body.app-theme-jewel .dashboard-primary-workspace .project-progress-primary span {
    font-size: .53rem;
  }
}

@media (min-width: 1220px) and (max-height: 760px) {
  body.app-theme-jewel .tm-sidebar-memorial-fixed {
    top: 45%;
    min-height: 170px;
    padding-top: 27px;
    padding-bottom: 12px;
  }

  body.app-theme-jewel .tm-sidebar-memorial-fixed .tm-sidebar-memorial-copy {
    font-size: .61rem;
    line-height: 1.48;
  }
}
