.index-panel-grid{
  display: flex;
  flex-wrap: wrap;        /* <-- this is the key */
  gap: 18px;              /* spacing between panels */
  align-items: flex-start;
}

/* IMPORTANT: use classes, not ids, for repeated panels */
.index-panel{
  position: relative;
  overflow: hidden;
  width: 280px;
  max-width: calc(100vw - 36px);
  height: 350px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.08);

  display: flex;          /* you had flex-direction but not display:flex */
  flex-direction: column;

  flex: 0 0 auto;         /* don't stretch, just wrap */
}

.index-panel-header{ padding: 14px 16px; }
.index-panel-title{ font-weight: 700; }

